python tushare date data format local storage problem

In the previous article "Python tushare stock big data analysis and report generation (optimized version 2)", I wrote "The daily limit is less than 15 days: %d, the daily limit is less than 1 year: %d' %" During the implementation of the function, it was found that tushare data will be automatically converted to float64 format when the tushare data is stored in the .csv format, and it is very troublesome to convert to the date format in the process of using it. If you want to convert it into a date format that can be calculated , First you have to convert the float format to int format, because float format comes with a decimal mantissa, directly converted to str format will bring a decimal mantissa, so the path is float–int–str–strptime, and the most troublesome is localization during storage, the format of the date of 20200101 is converted into the format strptime much, so: a .csv during storage before adding such a code
df_all['list_date'] = pd.to_datetime(df_all['list_date'])
can be changed as follows so that the time format of FIG
Insert picture description here
no longer be as follows Picture like this
Insert picture description here

Guess you like

Origin blog.csdn.net/Wilburzzz/article/details/106780038