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

Edit field and append value to a python dataframe column
column_stack returns non cotiguous array
pandas: conditionally select a row cell for each column based on a mask
pandas custom function apply on melted dataframe
How to check for boolean codition in pandas dataframe
Reading batches of data from BigQuery into Datalab
Jupyter/ipywidgets sorting dataframe on two levels
Groupby.sum() giving ValueError: overflow in timedelta operation
Why does DataFrameGroupBy.boxplot method throw error when given argument “subplots=True/False”?
Calculate age in months - optimize date transformations in pandas
pandas: list of dictionaries grouped by key from df
Pandas data frames and matplotlib.pyplot
Pandas.to_csv thousand separator
Annotating a graph with certain values of another series (Index is datetime)
Pandas rolling sum on string column
pandas apply() with and without lambda

Categories

HOME
ms-access
bluetooth
netbeans
mockito
tizen
ngrx
tesseract
relay
bpmn
rsyslog
adb
jxls
win32gui
icloud
google-project-tango
disassembler
blueprintjs
ojdbc
azure-storage-tables
applepay
vaadin7
lombok
telephony
solaris-10
crystal-reports-2008
firefox-webextensions
custom-wordpress-pages
accessor
wkwebview
extjs5
chromium-embedded
claims-based-identity
p-value
fopen
quote
sql-server-2012-express
code-contracts
framemaker
html5-fullscreen
overriding
jmonkeyengine
libraries
galen
core-plot
botbuilder
s
zip4j
jquery-validate
integrity
crypt
epson
dwscript
specrun
xcb
visual-c++-2008
google-feed-api
gridview-sorting
connect-by
persist
actionbardrawertoggle
suffix-tree
oauth2client
tform
ios8-today-widget
sdhc
thredds
0xdbe
tableau-online
npapi
python-green
clicktag
mesa
bundles
app42
typo3-neos
html5-notifications
cdc
dotnetnuke-5
ril
ora-00911
rabl
eventlistener
free-variable
automount
errai
onsubmit
bubble-chart
pendrive
coercion
jmock
site.master
h.323
ext3
microsoft-virtualization
zend-decorators
putchar
zune
ajax-forms

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