python - AttributeError:'Timestamp'对象在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' object has no attribute 'split'"
有人可以帮忙吗?
解决方案
我相信您需要一个字符串对象来执行滑动操作。我相信你正在使用时间戳(“日期时间”类型)对象。如果您使用“datetime”,请对对象使用字符串格式或直接在时间戳对象上使用“day = datetimeobj.strftime("%d")”。如果您使用的是时间戳,请先将其转换为“datetime”、“datetimeobj=datetime.fromtimestamp(timestamp)”
推荐阅读
- css - Flexbox,行中等高的一个例外
- javascript - JS - 回调不是异步的
- c++ - 在堆栈上分配的向量元素?
- doctrine-orm - 自定义扩展禁用了急切加载
- java - 无法使用 AsyncTask 从 html 获取数据
- python - Sympy Subs、Replace 和 Xreplace 不适用于表达式
- javascript - 如何计算标签内标签/元素的数量并减小字体大小
- android - LazyColumnFor 滚动不流畅
- ruby - 了解 ruby 数据处理
- javascript - 如何使用用户使用 REACTJS 和 Axios 提供的数据发布 JSON