后续详细。
def getFirstLastDayListWk(dateSeries):
weekNum = pd.to_datetime(dateSeries).strftime("%W")
weekNum = weekNum.astype(int)
weekNum0 = np.argwhere(weekNum == 0)
#assuming the first date is not 0 week, otherwise, it needs more
for i in range(len(weekNum0)):
weekNum[list(weekNum).index(0)] = weekNum[list(weekNum).index(0)-1]
#index(0)returns the location of the first 0 it appears
#assuming that the #no assuming change them
lastDayofPeriod = weekNum[0:-1] - weekNum[1:]
# 0 -1 0r 51, 51 is the difference of the 52 and 1
#nonono, it can give the result of -2, where there are holidays such as the
#spring festival and the national day. but they have one charactersitics in common
#they are positive, not always 51, they can be 52, such as the year 2018
lastDayList = np.argwhere(lastDayofPeriod!=0)
#lastDayofPeriod[np.where((lastDayofPer