I am creating a dataframe based on a csv import:
ID, attachment, attachment, comment, comment
1, lol.jpg, lmfao.png, 'Luigi',
2, cat.docx, , 'It's me', 'Mario'
Basically the number of 'attachments' and 'comment' columns corresponds to the line that has the bigger number of said attachment and comment. Since I am exporting the CSV from a third party software, I do not know in advance how many attachments and comment columns there will be.
Importing this CSV with pd.read_csv
creates the following dataframe
ID | attachment | attachment.1 | comment | comment.1 | |
---|---|---|---|---|---|
0 | 1 | lol.jpg | lmfao.png | 'Luigi' | |
1 | 2 | cat.docx | 'It's me' | 'Mario' |
Is there a simple way to select all attachment/comment columns?
Such as attachments_df = imported_df.attachment.all
or comments_df = imported_df['comment].??
Thanks.