Johan Nilssons Lifestream

Pandas: Delimiter in DataFrame.from_dict()

Basically, I'm using Pandas to easily write my dictionary to .csv:

import pandas as pd

df = pd.DataFrame.from_dict(dict, orient="index")
df.to_csv("test.csv")

But my .csv file looks like this:

key1: value1, value2
key2: value1
key3: value1, value2

And I want it to look like this:

key1: value1
kay1: value2
key2: value1
key3: value1
key3: value2

Is it possible to define some sort of delimiter for data in pandas? Thanks.

via Stack Overflow

blog comments powered by Disqus
Get the source for phplifestream at Github