I have some data I'm trying to organize into a DataFrame in Pandas. I was trying to make each row a Series and append it to the DataFrame. I found a way to do it by appending the Series to an empty list and then converting the list of Series to a DataFrame
DF = DataFrame([series1,series2],columns=series1.index)
This list to DataFrame step seems to be excessive. I've checked out a few examples on here but none of the Series preserved the Index labels from the Series to use them as column labels.
My long way where columns are id_names and rows are type_names: enter image description here
Is it possible to append Series to rows of DataFrame without making a list first?
#!/usr/bin/python
DF = DataFrame()
for sample,data in D_sample_data.items():
SR_row = pd.Series(data.D_key_value)
DF.append(SR_row)
DF.head()
TypeError: Can only append a Series if ignore_index=True or if the Series has a name
Then I tried
DF = DataFrame()
for sample,data in D_sample_data.items():
SR_row = pd.Series(data.D_key_value,name=sample)
DF.append(SR_row)
DF.head()
Empty DataFrame
Tried Insert a row to pandas dataframe Still getting an empty dataframe :/
I am trying to get the Series to be the rows, where the index of the Series becomes the column labels of the DataFrame