python create dataframe by row

Solutions on MaxInterview for python create dataframe by row by the best coders in the world

showing results for - "python create dataframe by row"
Rafael
14 Jan 2016
1In [7]: df = pandas.DataFrame(columns=['a','b','c','d'], index=['x','y','z'])
2In [8]: df.loc['y'] = pandas.Series({'a':1, 'b':5, 'c':2, 'd':3})
3In [9]: df
4Out[9]: 
5     a    b    c    d
6x  NaN  NaN  NaN  NaN
7y    1    5    2    3
8z  NaN  NaN  NaN  NaN