Version 0.12.0 (July 24, 2013) — pandas 2.2.3 documentation (original) (raw)

This is a major release from 0.11.0 and includes several new features and enhancements along with a large number of bug fixes.

Highlights include a consistent I/O API naming scheme, routines to read html, write MultiIndexes to csv files, read & write STATA data files, read & write JSON format files, Python 3 support for HDFStore, filtering of groupby expressions via filter, and a revamped replace routine that accepts regular expressions.

API changes#

B False
C True
D False
E True
Name: a, dtype: bool

this is what you should use

In [9]: df.loc[mask]
Out[9]:
a
A 0
C 2
E 4

this will work as well

In [10]: df.iloc[mask.values]
Out[10]:
a
A 0
C 2
E 4
df.iloc[mask] will raise a ValueError

IO enhancements#

0 0.713216 -0.778461
1 -0.661062 0.862877
2 0.344342 0.149565
0 1
3 -0.626968 -0.875772
4 -0.930687 -0.218983
5 0.949965 -0.442354
0 1
6 -0.402985 1.111358
7 -0.241527 -0.670477
8 0.049355 0.632633
0 1
9 -1.502767 -1.225492

Other enhancements#

Experimental features#

As an interesting example, let's look at Egypt where

a Friday-Saturday weekend is observed.

In [32]: weekmask_egypt = "Sun Mon Tue Wed Thu"

They also observe International Workers' Day so let's

add that for a couple of years

In [33]: holidays = ["2012-05-01", datetime(2013, 5, 1), np.datetime64("2014-05-01")]
In [34]: bday_egypt = CustomBusinessDay(holidays=holidays, weekmask=weekmask_egypt)
In [35]: dt = datetime(2013, 4, 30)
In [36]: print(dt + 2 * bday_egypt)
2013-05-05 00:00:00
In [37]: dts = pd.date_range(dt, periods=5, freq=bday_egypt)
In [38]: print(pd.Series(dts.weekday, dts).map(pd.Series("Mon Tue Wed Thu Fri Sat Sun".split())))
2013-04-30 Tue
2013-05-02 Thu
2013-05-05 Sun
2013-05-06 Mon
2013-05-07 Tue
Freq: C, dtype: object

Bug fixes#

2 e
3 o
dtype: object
0 NaN
1 NaN
2 NaN
3 w
dtype: object
In [41]: s
Out[41]:
0 NaN
1 NaN
2 NaN
3 w
dtype: object
In [42]: s.dropna().values.item() == "w"
Out[42]: True
The last element yielded by the iterator will be a Series containing the last element of the longest string in the Series with all other elements being NaN. Here since 'slow' is the longest string and there are no other strings with the same length 'w' is the only non-null string in the yielded Series.

See the full release notes or issue tracker on GitHub for a complete list.

Contributors#

A total of 50 people contributed patches to this release. People with a “+” by their names contributed a patch for the first time.