0

I have a dataframe which I am working with which contains information about chemical reactions.

Dataframe

From this, I'd like to take create a new dataframe where each type of chemical in 'class' (photocatalyst, base, reagent, etc.) is a column the categories and the rows contain each of the iterations of that chemical (i.e. where a 'photocatalyst' column contains PC1, PC2, PC3, etc.).

I tried using the .groupby() operation, but couldn't figure out a function which would let me do this. Any help is greatly appreciated.

  • That sounds like a pivot_table() operation. – Nick ODell Mar 29 '23 at 22:11
  • Welcome to Stack Overflow. Please post your data in text format, not as screenshots (see [Why not upload images of code/data/errors when asking a question?](https://meta.stackoverflow.com/q/285551/)) and show your desired result and attempted code. Also see [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391). – AlexK Mar 29 '23 at 23:31

0 Answers0