DataFrame 将某列数据转为数组

import pandas as pd

df = pd.DataFrame({'id': [1,2,3,4,5],
                    'coor':[[117.894302, 38.947542],
                           [116.117183, 38.679313],
                           [116.269203, 37.681805],
                           [116.485037, 39.108832],
                           [115.80366, 34.709146]]})
print(df)

print(df['coor'].tolist())
   id                     coor
0   1  [117.894302, 38.947542]
1   2  [116.117183, 38.679313]
2   3  [116.269203, 37.681805]
3   4  [116.485037, 39.108832]
4   5   [115.80366, 34.709146]

[[117.894302, 38.947542], [116.117183, 38.679313], [116.269203, 37.681805], [116.485037, 39.108832], [115.80366, 34.709146]]

你可能感兴趣的:(DataFrame 将某列数据转为数组)