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

Python Pandas has low CPU usage and not using all cores
Pandas Set on copy warning when using .loc
Merge very large csv using pandas or awk
seasonal_decompose: operands could not be broadcast together with shapes on a series
How to properly sample from a numpy.random.multivariate_normal (positive-semidefinite covariance matrix issue)
how to do logical operation between dataframe columns?
Console hangs up at the time of plotting
Pandas apply a function at fixed interval
float type column in pandas to convert to tuple/list
Getting an error with Pandas Panel boolean indexing
pandas dataframe subtraction causing nan
Pandas dataframe: truncate string fields
how to add new categorical column in pandas
Finding different Ids with the same value in pandas dataframe
Why can't iterrows do math - and instead returns integer values where these should be floats
How to merge/concatenate based on column multiindex? (Pandas)

Categories

HOME
maven
osgi
isabelle
server
drivers
smarty
relayjs
kalman-filter
maven-3
packages
win32gui
mouse
bs4
awesome-wm
maude-system
imacros
resize
google-cloud-spanner
spring-tool-suite
percona
designer
dosgi
fatal-error
solaris-10
excel-vba-mac
openedx
viewport
amazonsellercentral
jquery-ajaxq
ehcache
intel-pin
internet-explorer-9
entitlements
vision
tinymce-4
nameservers
iframe-resizer
http-get
copying
webtest
suricata
vxworks
reportbuilder
sqlite2
spring-security-kerberos
fakeiteasy
galleria
cubic-spline
zip4j
winscp-net
pebble-watch
dotnetzip
media-player
pillow
epson
webdriverjs
crosswalk-runtime
mediaelement
xcb
slicknav
database-optimization
autorest
simplewebrtc
hill-climbing
testng-dataprovider
php-parse-error
revolution-r
python-green
c3
javafx-webengine
neolane
eol
contenttype
comexception
openlaszlo
shellexecute
itmstransporter
hamiltonian-cycle
unc
appconkit
punbb
cufon
vdsp
visitor-statistic
gamequery
suppress
xsdobjectgen
ncqrs
fixed-width
user-friendly
audio-capture
sustainable-pace

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