【问题标题】:Indentation issue Python begginer [closed]缩进问题Python初学者[关闭]
【发布时间】:2022-06-13 17:52:50
【问题描述】:

我正在尝试使用 python 运行以下循环,但不断出现错误

文件“”,第 2 行

IndentationError: 在第 1 行的“for”语句之后需要一个缩进块

对于 df.index 中的 i:

for i in df.index:
    try:
        location = geolocator.geocode(df['query'][i])
        df.loc[i,'location_lat'] = location.latitude
        df.loc[i,'location_long'] = location.longitude
        df.loc[i,'location_address'] = location.address
    except: 
        df.loc[i,'location_lat'] = ""
        df.loc[i,'location_long'] = ""
        df.loc[i,'location_address'] = ""

我必须提到我正在使用 Visual Studio 代码来制作我的脚本。我会感谢所有建议。

【问题讨论】:

  • 请包含完整的回溯错误。

标签: python database indentation


猜你喜欢
  • 2021-02-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-07-19
  • 1970-01-01
  • 2017-07-31
  • 2011-08-17
  • 1970-01-01
相关资源
最近更新 更多