I have a dataframe:
| column1 | column2 |
| -------- | -------------- |
| abc | 1 |
| def | 16 |
| ghi | 982 |
I'm selecting a row and using to_string(index=False) on it.
something = df.loc(df['column2'] == 982]
print(something.column1.to_string(index=False))
I'm doing this repeatedly over a large dataframe and 99 times out of 100 it's fine. Every once in a while though, I get AttributeError: 'str' object has no attribute 'to_string'.
There's nothing unusual about the data in the instances where this happens. What could be causing this?
something.column1.iloc[0]instead ofsomething.column1.to_string(index=False)