so I have a problem in python, which solution I just can't get into my head. Basically I have data frame df1a, which columns are of dtype "float64." Now I want to go through that data frame and assign a 1 if a specific criteria is met:
vs_pe = pd.DataFrame(index=date1, columns=df1a.columns)
for x in df1a:
if x < 5:
vs_pe.loc[t] = 1
What I get is:
'<' not supported between instances of 'str' and 'int'
When I do:
vs_pe = pd.DataFrame(index=date1, columns=df1a.columns)
for int(x) in df1a:
if x < 5:
vs_pe.loc[t] = 1
I'll get:
invalid literal for int() with base 10:
Seriously I just tried everything, like transforming everything to integers using the to.numeric command, but nothing gives me the solution.
Would be happy if someone could help out.
Aucun commentaire:
Enregistrer un commentaire