pandas - Python: how to pick specific entries in the data as the columns -
this code:
df= pd.read_csv("mort2015.csv", usecols=['sex', 'placdth', 'ager52','ucr130', 'ranum','record_1','record_2','record_3','record_4','record_5', 'record_6','record_7','record_8','record_9','record_10','record_11']) bothsex=(df[(df).ager52<12]).drop(['ucr130', 'ager52', 'ranum','placdth', 'sex'], axis=1)
then tried with: pivotrows=(bothsex.apply((pd.value_counts), axis=1))
gives me count.
as picture shows below, trying pick specific entries create new columns. example 'g039', 'p529' , 'q798' columns.
in addition, trying use "table" run ols regression find/show correlation between diseases (ex. g039, p529)and gender. problem don't understand how go ahead results want.
picture of table
Comments
Post a Comment