2
그래서 'df'라는 DataFrame 개체와 'timestamp'를 실제 읽을 수있는 날짜로 변환하려고합니다.팬더는 날짜를 정수로 변환합니다.
timestamp
0 1465893683657
1 1457783741932
2 1459730006393
3 1459744745346
4 1459744756375
은 필자
df['timestamp'] = pd.to_datetime(df['timestamp'],unit='s')
을 시도하지만 내가 날짜가 올해 또는 작년이어야한다 알고 있기 때문에 분명히 잘못
timestamp
0 1970-01-01 00:24:25.893683657
1 1970-01-01 00:24:17.783741932
2 1970-01-01 00:24:19.730006393
3 1970-01-01 00:24:19.744745346
4 1970-01-01 00:24:19.744756375
을 제공합니다.
내가 뭘 잘못하고 있니?
. 나는 이전과 같은 결과를 얻는다. 몇 가지 추가 정보 : type (df [ 'timestamp']) -> 준다 -> pandas.core.series.Series –
아마도 나쁜 데이터가 있습니다.'(pd.to_datetime (df.timestamp, unit = 'ms ', errors ='coerce '))'NaN'으로 변환합니다. 또한 df.timestamp = df.timestamp 인 경우에도'print df [pd.to_datetime (df.timestamp, unit = 'ms', errors = 'coerce'). isnull()]' – jezrael
로이 행을 검사 할 수 있습니다. 'series'객체에 'to_datetime'속성이 없습니다. –