熊猫转换时间戳

时间:2017-10-07 04:09:59

标签: python pandas timestamp google-bigquery

当我使用命令时:

data['DATE_KEY']=pd.to_datetime(data.DATE_KEY)

以“&yyyy-mm-dd'”格式返回时间戳。我希望它还能返回该时间戳中的其他内容。我该怎么做?

原始数据的格式发布在上一个问题:Bigquery Error When Loading Timestamp

这是我正在使用的完整代码:

data=pd.read_csv('original_data.csv', index_col=False)
data['DATE_KEY']=pd.to_datetime(data.DATE_KEY)
useful_columns = ['DATE_KEY','ITEM_DESCRIPTION','SCAN_UNITS','AVE_UNIT_PRC', 'SCAN_DOLLARS']
data[useful_columns].to_csv('new_data.csv', index=False, sep=",")

这是我的结果文件: enter image description here

1 个答案:

答案 0 :(得分:0)

Could not find ssh-agent: IOException: Cannot run program "ssh-agent": CreateProcess error=2, The system cannot find the file specified
Check if ssh-agent is installed and in PATH

我认为您编写的代码可以使用,或者您可以发布数据以便更好地进行调试。