From excel I’m importing the following table as dataframe in pandas:
to import those I’m using the following code:
<code>f_1=df.iloc[indice, df.columns.get_loc('col1')]
f_2=df.iloc[indice, df.columns.get_loc('col2')]
f_3=df.iloc[indice, df.columns.get_loc('col3')]
</code>
<code>f_1=df.iloc[indice, df.columns.get_loc('col1')]
f_2=df.iloc[indice, df.columns.get_loc('col2')]
f_3=df.iloc[indice, df.columns.get_loc('col3')]
</code>
f_1=df.iloc[indice, df.columns.get_loc('col1')]
f_2=df.iloc[indice, df.columns.get_loc('col2')]
f_3=df.iloc[indice, df.columns.get_loc('col3')]
I want to create strings based on the “row” in the first column, so something like
<code>string1=ae1
string2=bf2
string3=cg3
string4=d
</code>
<code>string1=ae1
string2=bf2
string3=cg3
string4=d
</code>
string1=ae1
string2=bf2
string3=cg3
string4=d
If I try to convert the f_1
f_2
and f_3
in a list using .to_list() it gives me this error:
<code>AttributeError: 'str' object has no attribute 'to_list'
</code>
<code>AttributeError: 'str' object has no attribute 'to_list'
</code>
AttributeError: 'str' object has no attribute 'to_list'
1