v0.16.0 (March 22, 2015)¶
This is a major release from 0.15.2 and includes a small number of API changes, several new features, enhancements, and performance improvements along with a large number of bug fixes. We recommend that all users upgrade to this version.
Highlights include:
DataFrame.assignmethod, see hereSeries.to_coo/from_coomethods to interact withscipy.sparse, see here- Backwards incompatible change to
Timedeltato conform the.secondsattribute withdatetime.timedelta, see here - Changes to the
.locslicing API to conform with the behavior of.ixsee here - Changes to the default for ordering in the
Categoricalconstructor, see here - Enhancement to the
.straccessor to make string operations easier, see here - The
pandas.tools.rplot,pandas.sandbox.qtpandasandpandas.rpymodules are deprecated. We refer users to external packages like seaborn, pandas-qt and rpy2 for similar or equivalent functionality, see here
Check the API Changes and deprecations before updating.
What’s new in v0.16.0
New features¶
DataFrame assign¶
Inspired by dplyr’s mutate verb, DataFrame has a new
assign() method.
The function signature for assign is simply **kwargs. The keys
are the column names for the new fields, and the values are either a value
to be inserted (for example, a Series or NumPy array), or a function
of one argument to be called on the DataFrame. The new values are inserted,
and the entire DataFrame (with all original and new columns) is returned.
In [1]: iris = pd.read_csv('data/iris.data')
In [2]: iris.head()
Out[2]:
SepalLength SepalWidth PetalLength PetalWidth Name
0 5.1 3.5 1.4 0.2 Iris-setosa
1 4.9 3.0 1.4 0.2 Iris-setosa
2 4.7 3.2 1.3 0.2 Iris-setosa
3 4.6 3.1 1.5 0.2 Iris-setosa
4 5.0 3.6 1.4 0.2 Iris-setosa
[5 rows x 5 columns]
In [3]: iris.assign(sepal_ratio=iris['SepalWidth'] / iris['SepalLength']).head()