python DataFrame或者Series重置index
对于一些需要筛选的数据,判断得到满足条件的index对应的值,此时筛选出的series的index为:
index = ((year_site == 2018) & (month_site == 2) & (day_site == 1))
Site_data = Site_SD[index]
如果想要index从0开始排列,则需要如下操作:
index = ((year_site == 2018) & (month_site == 2) & (day_site == 1)) Site_data = Site_SD[index].reset_index(drop=True)