Last active
August 21, 2017 08:22
-
-
Save cpascual/4d44c3307aa4ed707ce3afa234e8b428 to your computer and use it in GitHub Desktop.
A simple example of using taurus eval scheme with pandas to read a column of a CSV data file
This file contains hidden or 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
""" | |
A simple example of using taurus eval scheme with pandas to | |
read a column of a CSV data file | |
""" | |
#create a dummy csv file with 2 columns with headers "x" and "y" | |
data=\ | |
''' | |
x,y | |
2,4 | |
3,6 | |
4,8 | |
5,10 | |
''' | |
with open('foo.csv', 'w') as f: | |
f.write(data) | |
# read column "y" from foo.csv file as a taurus attribute using pandas | |
import taurus | |
m = "eval:@pandas.*/read_csv('foo.csv')['y'].as_matrix()" | |
a = taurus.Attribute(m) | |
print a.read() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment