Python 2.7 Invalid syntax when running script from .csv file using pandas -


i running script python 2.7 using pandas read 2 csv files. keep getting "invalid syntax" error messages, particularly on line 6 , 8. can't figure out problem, since line 6 identical line 5 , there don't error. !

import numpy np import csv csv import pandas pd  da = pd.read_csv('snp_rs.csv', index_col=(0,1), usecols=(0, 1), header=none,    converters = dict.fromkeys([0,1]) db = pd.read_csv('chl.map.csv', index_col=(0,1), usecols=(0,1), header=none,    converters = dict.fromkeys([0,1])  result = da.join(db, how='inner') x = result.to_csv('snp_rs_out.csv', header=none) # write csv print x 

as commented need close parentheses around read_csv call:

da = pd.read_csv('snp_rs.csv', index_col=(0,1), usecols=(0, 1), header=none,    converters = dict.fromkeys([0,1]) 

it's missing closing paren.

i find lot easier write/read these if split lines:

da = pd.read_csv('snp_rs.csv',                  index_col=(0,1),                  usecols=(0, 1),                  header=none,                  converters=dict.fromkeys([0,1]) 

then it's clearer final ) missing.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -