属性错误:"时间戳"对象在python中没有属性"split"


#Create the independent data set
for day in df_days:
days.append([int(day.split('-')[4])])
#Create the dependent data set (adj close prices)
for adj_close_price in df_adj_close:
adj_close_prices.append( float(adj_close_price))

我收到了错误的消息";AttributeError:"Timestamp"对象没有属性"split">

有人能帮忙吗?

我认为您需要一个字符串对象来执行slip操作。我相信你使用的是时间戳("datetime"类型(对象。使用对象的字符串格式或使用";day=datetimeobj.strftime("%d"(";如果您使用";日期时间";。如果您正在使用时间戳,则首先将其转换为"时间戳";日期时间"datetimeobj=datetime.fromtimestamp(时间戳(";

最新更新