我正在尝试从pandas数据框中的"日期"列中提取年/日/月信息.这是我的示例代码:
from datetime import datetime
def date_split(calendar):
for row in calendar:
new_calendar={}
listdate=datetime.strptime(row['date'],'%Y-%M-%D')
Run Code Online (Sandbox Code Playgroud)
我还没有完成完整的代码,但是当我测试运行这部分时,我一直得到这样的错误:
----> 7 listdate=datetime.strptime(row['date'],'%Y-%M-%D')
TypeError: string indices must be integers
Run Code Online (Sandbox Code Playgroud)
任何人有任何想法?
顺便说一句,这是我使用的数据帧(calendar_data):

我正在尝试使用Google Map API可视化jupyter笔记本中的某些数据。这是我用来在jupyter中显示基本地图的代码:
import gmaps
import os
import json
import gmaps.datasets
gmaps.configure(api_key="AIz....")
fig=gmaps.figure()
fig
Run Code Online (Sandbox Code Playgroud)
运行代码后,什么都没有显示。我使用了自己的Google API密钥,无法弄清楚为什么不显示地图。我是geojson领域的新手,所以任何想法或想法都值得赞赏。