I've read my data into a Pandas dataframe. I wish to split the data out into separate files based on two variables, "Zone" and "Type".
So I want to have something like:
contents[(contents['Zone']==zone) & (contents['Type']==type)].to_csv(outfl, sep=' ', header=False, index = False, float_format='%9.3f')
Strangely, my output looks like this:
200 225 255 504671.321 6342290.967 " -323.271" 1 " 0.040" " 0.319" " 0.249" " 0.141" " 2.000"
202 224 254 504721.351 6342265.992 " -323.725" 1 " 0.032" " 0.254" " 0.258" " 0.127" " 2.000"
200 225 254 504671.321 6342290.967 " -323.350" 1 " 0.038" " 0.376" " 0.243" " 0.137" " 2.000"
201 225 254 504696.336 6342290.967 " -323.593" 1 " 0.035" " 0.359" " 0.249" " 0.128" " 2.000"
Why are these quote characters appearing? I don't want them (obv) as I'm trying to create a space delimited output file. Seems like I am doing something wrong with the float_format... But not sure what?
Edited to add info at someone's request:
print contents.info()
yields:
<class 'pandas.core.frame.DataFrame'>
Int64Index: 233976 entries, 0 to 233975
Data columns (total 12 columns):
I 233976 non-null int64
J 233976 non-null int64
K 233976 non-null int64
X 233976 non-null float64
Y 233976 non-null float64
Z 233976 non-null float64
Type 233976 non-null int64
VMI_LVMI 233976 non-null float64
SWT 233976 non-null float64
PHIT 233976 non-null float64
VCLA 233976 non-null float64
Zone 233976 non-null float64
dtypes: float64(8), int64(4)
memory usage: 23.2 MB
None