I have a pandas dataframe with elements that are strings but are expressed as 'objects':
I want to access the string itself. This seems extremely simple but I can't seem to turn it into a string:
I also tried vocab.iloc[0].astype(str) and .astype('|S') as suggested in another post but this still printed something similar to the first picture.
Edit: I just realized that the dataframe titles are the vocab words, and the entries are NaN.... The full dataframe looks something like
. However I selected the answer that fits the assumption that dataframe entries are strings.


print(mydataframe.head())vocab.astype(str), then runvocab.iloc[0]