Home > other >  How to calculate the Excel in python a repeat the number of data items in the list
How to calculate the Excel in python a repeat the number of data items in the list

Time:11-26



For Excel form the date of the items above, how to use python statistics the number of occurrences of different date, after the completion of the statistical remove duplicate date and record to the "number" column, just like the following example:




Now can only think of the following ideas:
Data=https://bbs.csdn.net/topics/pd.read_excel ('/statistical date. XLS ')

Use drop_duplicates cleandata=(https://bbs.csdn.net/topics/data.drop_duplicates # ([' date ']) can be returned without date column duplicates, but how to statistics to repeat the number and the date of record to the "number" column?

CodePudding user response:

 df_count=df [' date '] value_counts () reset_index (name='occurrences). Rename ({" index ":" date "}, axis=' columns') 
  • Related