'PCA' object has no attribute 'explained_variance_'
PCA is an estimator and by that you need to call the fit() method in order to calculate the principal components and all the statistics related to them, such as the variances of the projections en hence the explained_variance_ratio.
pca.fit(preprocessed_essay_tfidf) or pca.fit_transform(preprocessed_essay_tfidf)