pandas


Pandas option to keep levels after xs operation


Is there a way to perform a cross-section on a hierarchical dataframe that returns the dataframe without the searched levels being dropped?
That is, if you have a dataframe with index.names = ['month','year'] and perform the following command
newdf = df.xs(('January'),level=('month'))
such that the new dataframe retains the month index?
It seems that drop_level kwarg has been added to version 0.13 for this exact purpose.

Related Links

MultiIndex-based indexing in pandas
How to get the number of the most frequent value in a column?
Using pandas.ols on multiple dependent variables at once
Insert 0-values for missing dates within MultiIndex
Reindexing dataframes
pandas access axis by user-defined name
Trouble with groupss and aggregation
Replace MultiIndex's contents with DataFrame columns
What's the `DataFrameGroupBy`-equivalent of `dict.keys`?
How to split a dataframe according to a boolean criterion?
Pandas Rolling Computations on Sliding Windows (Unevenly spaced)
Resampling Minute data
How to get the last n row of pandas dataframe?
Resample time series in pandas to a weekly interval
Suppress output of object when plotting in ipython
qtconsole not rendering pandas dataframes as html notebook_repr_html option

Categories

HOME
winforms
cloud
vbscript
tizen
relative-path
session
syntax
analysis
infragistics
malloc
rdf
alpha
ezpublish
in-app-purchase
swagger-ui
medical
session-variables
gnupg
adobe-analytics
qt-creator
vb.net-2010
moonmail
flask-wtforms
workload-scheduler
connection-string
normalizr
dxf
su
virtualdub
lxd
appfabric
file-format
lto
libraries
ssjs
lumberjack
galen
nand2tetris
slick-3.0
babel-core
avconv
xml-documentation
upstart
ionicons
datastax-startup
domain-model
powercli
knockout-components
np-complete
ifs
gcsfuse
lync-client-sdk
chord-diagram
mediaelement
home-directory
markojs
blackberry-10
ubuntu-10.04
essence
hexdump
bluemix-app-scan
nessus
associative-array
system.management
pervasive-sql
atk4
muse
android-listview
map-projections
drawbitmap
twirl
php-ci
oberon
lustre
bigbluebutton
tld
p4java
htmlcleaner
java.nio.file
intentservice
xsockets.net
pygit2
type-equivalence
jelly
delphi-6
hamiltonian-cycle
unc
coderush
bluepill
cascalog
chrono
code-cleanup
php-parser
vdsp
infobox
netbeans-7.1
sef
sustainable-pace
nerddinner
procedural-music
post-build

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App