I have a pandas Dataframe like this:
Codice | PrelievoPunto | Piombo | Benzene | Etilbenzene |
---|---|---|---|---|
2200002.001 | PZ65 | < 1.0 | < 1.0 | < 1.0 |
2200002.002 | PZ43 | < 1.0 | < 2.0 | < 1.0 |
etc | etc | etc | etc | etc |
I need to obtain something like this:
Codice | PrelievoPunto | Element | Value |
---|---|---|---|
2200002.001 | PZ65 | Piombo | < 1.0 |
2200002.002 | PZ43 | Piombo | < 2.0 |
etc | etc | etc | etc |
Substantially I need to put the dataframe into one column and add another column with the name of element.
At the moment I using 'ravel' command but it's not correct what I get.
pd.Series(my_data.values.ravel('F'))