I am going through the bar plot section in dataquest. I came across a statement bar_heights = norm_reviews[num_cols].iloc[0].values . How is this different from bar_heights = norm_reviews[num_cols].iloc[0] ? Is there any special purpose for the .Values?
Thank you in advance.
You can read the documentation on .values
using the help
builtin-method.
import numpy as np
import pandas as pd
help(pd.Series.values)
The purpose of .values
is to convert the pd.Series
as np.ndarray
or ndarray-like.
@alvinctk Thank you…it is helpful
I was trying to understand this also. What I don’t get is why this step is needed. Does the axes.bar() method specifically require a np.ndarray
rather than a pd.Series
?