语法错误:无法分配给函数调用 Python



当我尝试运行此代码时,我得到了错误"SyntaxError:无法分配给函数调用",并且我不知道该更改什么,因为此代码对显示我的人有效。

代码:

import pandas as pd
BTC= pd.DataFrame(BTC, columns=['Open time', 'Open', 'High', 'Low', 'Close', 'Volume', 'Close time', 'Quote asset volume', 'Number of trades', 'Taker buy asset volume', 'taker buy quote asset volume', 'Ignore'])
BTC['Open time'] = pd.to_datetime(BTC['Open time']), unit='ms'
BTC.set_index('Open time',inplace=True)
BTC

错误指向第三行。

BTC['Open time'] = pd.to_datetime(BTC['Open time']), unit='ms'

我在想,自从我得到的代码几年前以来,包装器中的一些语法可能已经改变了。

您需要将unit属性放在括号内:

BTC['Open time'] = pd.to_datetime(BTC['Open time']), unit='ms'

BTC['Open time'] = pd.to_datetime(BTC['Open time'], unit='ms')

我认为赋值语句在Python中不会给出值。所以,

,单位='ms'

无效。

最新更新