python - Get result of value_count() to excel from Pandas -


i have data frame "df" column called "column1". running below code:

df.column1.value_counts() 

i output contains values in column1 , frequency. want result in excel. when try running below code:

df.column1.value_counts().to_excel("result.xlsx",index=none) 

i below error:

attributeerror: 'series' object has no attribute 'to_excel'

how can accomplish above task?

you using index = none, need index, name of values.

pd.dataframe(df.column1.value_counts()).to_excel("result.xlsx")  

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -