0

I have an array created from a dataframe using .value_counts() which appears as

7     600
6     522
8     358
1     336
5     323
11    319
4     316
10    299
12    294
9     278
3     233
2     232
Name: Month, dtype: int64

When I do the following the resultant dataframe has the first column as the index rather than a column of data.

month_count= pd.DataFrame(month_count)

How do I make this two columns of data that I can add headers to?

jpp
  • 159,742
  • 34
  • 281
  • 339
Bethany
  • 35
  • 3
  • `value_counts` returns a series. The dup I'm marking this explains how to convert to a dataframe with columns as required. – jpp May 04 '18 at 16:32
  • Thanks, I didn't realise it was a series so did not realise I'd posted a duplicate question. – Bethany May 07 '18 at 09:50
  • That's OK, easily done :). Your question is still useful for us since the next person who uses the same wording can come here and follow the duplicate link. Thanks! – jpp May 07 '18 at 09:51

0 Answers0