I ran into a weird error with pandas quantile() (pandas.DataFrame.quantile()
) method. I have a dataframe with both numeric and non-numeric columns. I wanted to calculate the 75th quantile for each numeric column. So instead of providing only the numeric columns, I saw in the documentation that quantile()
takes a keyword argument numeric_only
which does the job. Here is the link to the documentation. But when I run the quantile() with numeric_only = True
, python gives me this error:
TypeError: quantile() got an unexpected keyword argument 'numeric_only'
I also checked the implementation of the quantile() and this keyword argument is implemented. Can anyone explain why am I getting this error? Below is a toy example.
df = pd.DataFrame.from_dict({'a':[1,1,2,1,3,2,4,5,4,6,2,3,2,5,5,5]})
df['a'].quantile(q=0.5,numeric_only=True) # doesn't work
df['a'].quantile(q=0.5) # works
Thanks for your help.