'How to save a data frame with with the split (explode) method in a separte row?
I want to save a CSV-File but it doesn't really save the changes. That's my code:
 import pandas as pd
 data=pd.read_csv("Olympic.csv", parse_dates=["Birthday"])
 data['Birthday'] = data['Birthday'].dt.strftime('%d.%m.%Y')
 data['Medaille'].str.split(', ')
 data.assign(Medaille=data['Medaille'].str.split(', ')).explode('Medaille')
The output of the data.head() is:
      Medaille
0     Gold   800m
1     Silver 600m
2     Bronze 300m
3     Gold   500m
4     Silver 500m
5     Silver 600m
6     Gold   400m
I wanted to save the CSV with the Method data.to_csv("Save.csv", index=False)
But after i saved it and looked at the changes again with the method data.head() it goes to the default changes (also inside of the saved CSV-File):
data.head()
     Medaille
0    Gold   800m, Silver 600m
1    Bronze 300m, Gold   500m
2    Silver 500m
3    Silver 600m
4    Gold   400m
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source | 
|---|
