python - How to remove just the index name and not the content in Pandas multiindex data frame -
i have following tab delimited file (mydata.txt
):
set coolthing route organ down set4 foo id ln 81 60 set4 bar id ln 542 92 set4 foo id lv 73 73 set4 bar id lv 143 78 set4 foo id sp 32 82 set4 bar id sp 90 129
and following code:
import pandas pd df = pd.io.parsers.read_table("http://dpaste.com/3zttvqh.txt") df = df.pivot(index="coolthing",columns="organ") df.drop('set',axis=1,inplace=true) df.drop('route',axis=1,inplace=true)
i have following data frame:
in [15]: df out[15]: down organ ln lv sp ln lv sp coolthing bar 542 143 90 92 78 129 foo 81 73 32 60 73 82
then using df.to_html(index=true, justify="left")
create html:
what want remove index names organ
, coolthing
. resulting this:
down ln lv sp ln lv sp bar 542 143 90 92 78 129 foo 81 73 32 60 73 82
how can achieve that?
there name
single level names , names
multi-level names example need clear names index , columns:
in [372]: df.index.name = none df.columns.names = (none,none) df out[372]: down ln lv sp ln lv sp bar 542 143 90 92 78 129 foo 81 73 32 60 73 82
Comments
Post a Comment