python - How is literal_eval() here is helping to fix the error?
问题描述
I have a pandas dataframe, which has a column called location, it has geo coordinates and the dtype is object as seen below.
I would like to use the values (as below) in this column to calculate the distance but I get the error as str cannot be accepted, only number type
But when literal_eval function is applied (as in first screenshot) on the column, I am able to calculate the distance between the coordinates.
I would like to understand what did literal_eval do to fix this error.
解决方案
推荐阅读
- node.js - 从 catapi 读取 xml
- sql-server - 克隆行并维护对克隆行的引用
- primefaces - 使用 jqplot 在堆积条形图中显示堆积值
- android - 仅在省电模式下重新创建后,Android服务无法连接到服务器
- android - 导入没有产品包名称的 R 包
- spring - ignoreUnresolvablePlaceholders 不起作用
- angular - 在指令实例上应用方法
- php - api中的Laravel Restclient 500错误
- ios - 无法在 Bitrise 上运行 iOS 的 UI 测试
- selenium - 窗口选项卡自行关闭时测试脚本出错