Developer.
pd.DataFrame(data=pca.explained_variance_ratio_, index=range(1,len(feature_cols)+1)) .rename(columns={0:'pct_explained_variance'}) # Calculate cumulative explained variance evar_df['cum_explained_variance'] = evar_df.cumsum() # Plot using matplotlib fig = plt.figure(figsize=(6,4)) ax = fig.gca()