import tushare as ts
import pandas as pd
shareCode = '600848'
dfLoad = ts.get_k_data(shareCode,start='2018-01-05',end='2018-01-09')
dfUpda1 = ts.get_k_data(shareCode,start='2018-01-05',end='2018-01-12')
dfUpda2 = ts.get_k_data(shareCode,start='2018-01-15',end='2018-01-20')
dfConc = pd.concat([dfLoad,dfUpda2,dfUpda1])
dfSort = dfConc.sort_values(by = 'date',ascending = False)
dfDrop = dfSort.drop_duplicates(subset = ['date'],keep = 'first')
print(dfSort)
print(dfDrop)
dfDrop.to_csv('days/' + shareCode + '.csv',index = False)
dfRead = pd.read_csv('days/' + shareCode + '.csv')
pd.set_option('display.max_column',None)
print('dfRead:')
print(dfRead)