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

rename columns function not working in pandas
Number format column with pandas.DataFrame.to_csv()?
Matplotlib Subplot Labels Disappear
Counting rows between dates in pandas with groupby
Taking second last observed row
retrieve data from pandas dataframe if it doesn't cooccur in previous column
pandas resample MAX-VALUE with corresponding ANGLE-VALUE
Performance issues with writing data to HDFStore
Finding same value index of pandas Series
Get Maximum Value from Dataframe
Slicing in group by function
Grouping factors in python patsy
pandas Series groupby col not found
Annotate labels in pandas scatter plot
Arithmetic in pandas HDF5 queries
Exception appending DataFrame chunk with string values to large HDF5 file using pandas

Categories

HOME
proxy
urbancode
relative-path
sd-card
c#-2.0
ckeditor
fancybox
swagger-ui
communication
node-pdfkit
quicklook
handsontable
vb.net-2010
dtrace
netflix
clearcase-ucm
uitypeeditor
worldwind
finite-automata
apache-metamodel
nhibernate-envers
openedx
google-pagespeed
plunker
dcevm
kvc
php-openssl
smb
opentype
windows-server-2000
phonegap
framemaker
form-data
http-referer
overriding
restlet
service-discovery
impersonation
unoconv
quadratic-programming
slick-3.0
qwt
user-accounts
zip4j
react-scripts
winscp-net
nativeapplication
python-cryptography
mcafee
messenger
azure-virtual-network
measures
py2app
nsfilemanager
clang-static-analyzer
markojs
react-native-listview
python-stackless
dlna
fadeout
oauth2client
intellij-14
spidermonkey
sframe
emailrelay
ibaction
geonetwork
gwidgets
cdt
html-helper
document-classification
elliptic-curve
system.net.webexception
pyhdf
quantlib-swig
inbox
dataservice
flash-builder4.5
buster.js
html4
eventual-consistency
padarn
pushbackinputstream
android-hardware
e4x
armcc
enter
hgsubversion
mod-auth
celltable
site.master
virtual-functions
yagni
procedural-music
mediarss
rtml
caching-application-block

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