pandasデータフレームにcsvをインポートしています。私の日付の列は正しくインポートされません。 私のCSVデータ日付カラムを正しく解析していません
Ticker,Date_Time,Close,volume rate,Volatility,breakouthappened,prevdaycci negative,stopprice,day1gainpotential,day1closegainpotential,day2gainpotential,day3gainpotential,day4gainpotential,breakoutpoint,#
AAAP、12月27日/ 2016,26.29,263,6.12,0、-165.77,23.51、-2.49、-4.95、-2.53、-2.71,0.51,24.39,1 ABMD、2/6/2017,110.5,261,3,1、-128.78,103.82,0.54、-1.15、-0.76、-1.6、-2,105.93,30 AIMC、4/11/2017,38.55,50,2.67 、0、-20.65,37.6、-0.52、-2.46、-2.2、-3.37、-2.85,38.25,162
私は第2列に日付があります。
potential_trades_df=pd.read_csv('C:\\Users\\Ramesh\\PycharmProjects\\DemoTest\\TradeSignals.csv',parse_dates=True,keep_date_col = True)
currenttrade=potential_trades_df.iloc[0]
>>> currenttrade.Date_Time.strptime('%Y-%m-%d')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'str' object has no attribute 'strptime'
私のサンプルの日付形式は "%m /%d /%Y"ですが、私はそれを解析し、それを '%Y-%m-%d'に変換する必要がありますmysqlに照会する – junkone