Issue
I have got a dataset that has been revised before its release. However, its accessory codes had not been revised and now faces this error. The code expects a data frame explaining the features of 255 homes, though the item is just a messy string that has no exact delimiter to convert it!
I showed the error, the types of the items in the new dataset and the content of the string in this [picture][1].
Solution
I'm sure there's a better way, but I use this trick to get dataframes to work with from poorly formatted SO questions.
Print the string (to let print
take care of things like return characters, '\n'
), then select-all and copy it. Then use:
df = pd.read_clipboard("\s\s+")
Sometimes I have to manually adjust the spacing a little bit between a few column names for it to work correctly, but it is unreasonably effective.
Answered By - Frodnar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.