Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

create horizontal descriptives table pandas

df = pd.DataFrame({'A':[0, 2, 2, 4, 9, 10, 15, 8, 7, 4],
				   'B':['One', 'One', 'Two', 'Two', 'One', 'One', 'One', 'Two', 'Two', 'One]})


# Gets descriptive data for a column, but transposes to horizontal orientation
df['A'].describe().reset_index().transpose()

# Does the same as above, but breaks out by group
df.groupby('B')['A'].describe()
 
PREVIOUS NEXT
Tagged: #create #horizontal #descriptives #table #pandas
ADD COMMENT
Topic
Name
6+8 =