I need to convert a dictionary into a CSV. I have the following code.
dict01 = {
"A": ["1", "2", "3", "4"],
"B": [2.0, 3.0, 2.0, 5.0]
}
df01 = pd.DataFrame([dict01])
df01.to_csv('csv01.csv')
The resulting CSV looks like this:
A | B |
---|---|
["1", "2", "3", "4"] | [2.0, 3.0, 2.0, 5.0] |
But I need my resulting CSV to look like this:
A | B |
---|---|
1 | 2.0 |
2 | 3.0 |
3 | 4.0 |
4 | 5.0 |