python - How do I push coordinates from a pandas dataframe to into a List? -


i have pandas dataframe of x y coordiantes so;

import pandas pd coords = pd.read_csv("covariates/coords.csv") print coords.head(n=5)  coordinates                x               y 0  434483.347684  1873512.572689 1  433703.881013  1874208.610947 2  433087.930224  1874647.987855 3  432620.418522  1875015.801780 4  432623.666835  1875078.630570 

i want push coords list purpose of making point shapefile, à la this quesiton

how export coordinates data frame list style seen below?

ptlist =[[1873512.572689,1873512.572689],[1873512.572689, 1873512.572689],[1873512.572689, 1873512.572689]] 

use use df.values.tolist() ?

in [21]: df.values.tolist() out[21]: [[434483.34768400004, 1873512.572689],  [433703.88101300003, 1874208.610947],  [433087.93022399995, 1874647.987855],  [432620.418522, 1875015.8017799999],  [432623.66683500004, 1875078.63057]] 

df.values creates numpy array , call tolist() access list of lists.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -