Created
January 30, 2019 10:03
-
-
Save gubser/03e7d085cbce5c027ee2289d7467ff5d to your computer and use it in GitHub Desktop.
This python snippet parses the `vector` column as a list of integers delimited by space and adds it as a new column
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
| frame | which | center-x | center-y | vector | vector_array | | |
| 44 | 0 | 55.5 | 29.3 | "49 44 31 22 26 22 44 ..." | [49, 44, 31, 22, 26, 22, 44, ...] | | |
""" | |
import pandas as pd | |
df = pd.read_csv(r"C:\Users\egubser\Downloads\blobs.csv", sep=';') | |
df['vector_array'] = df.vector.apply(lambda v: [int(k) for k in v.split(' ')]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment