python - Formatting pandas pivot_table -
i'm trying copy pivot table in excel in python using pandas pivot_table
function, i'm having trouble output. basically, 1 of rows long string , when outputting console summary information.
i have set following options:
pd.set_printoptions(max_rows=200, max_columns=100) pd.set_option('display.precision',2)
something works:
df.pivot_table(['xx','yy'], rows=['page'], cols=['variant'], aggfunc='sum')
but doesn't:
df.pivot_table(['xx','yy'], rows=['page','long string'], cols=['variant'], aggfunc='sum')
the former ouputs pivot table expected output latter:
in [11]: test out[11]: <class 'pandas.core.frame.dataframe'> multiindex: 4 entries, (avip, text ads on avip) (srp/browse, search/browse below results set) data columns (total 4 columns): control 1 4 non-null values control 2 4 non-null values test variant 1 4 non-null values test variant 2 4 non-null values dtypes: int64(4)
here simple example
row1 row2 data
xx "very long string" 123
yy "very long string very" 456
zz "very long string very" 789
when group row1 output fine, when group row1 , row2 have trouble output
Comments
Post a Comment