Val Krem via Python-list wrote:

> Here is the first few lines of the data
> 
> 
> s1.csv
> size,w1,h1
> 512,214,26
> 123,250,34
> 234,124,25
> 334,213,43

Did you put these lines here using copy and paste? The fix below depends on 
the assumption that your data is more like

size, w1, h1
512, 214, 26
123, 250, 34
...

>     a=pd.read_csv("s1.csv", skipinitialspace=True).keys()

You should use the keys() method call for diagnosis only. The final script 
that might work if your problem is actually space after the commas is

import pandas as  pd

a = pd.read_csv("s1.csv", skipinitialspace=True)
a["test"] = a["h1"] + a["w1"]
print(a)


-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to