AttributeError: 'DataFrame' object has no attribute
value_counts()
is now a DataFrame method since pandas 1.1.0
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.value_counts.html
To get all the counts for all the columns in a dataframe, it's just df.count()
value_counts
is a Series method rather than a DataFrame method (and you are trying to use it on a DataFrame, clean
). You need to perform this on a specific column:
clean[column_name].value_counts()
It doesn't usually make sense to perform value_counts
on a DataFrame, though I suppose you could apply it to every entry by flattening the underlying values array:
pd.value_counts(df.values.flatten())