Skip to content

Commit 49f1def

Browse files
committed
Merge branch 'master' into feature/groupby-repr-ellipses-1135
2 parents 43dbc6b + 597f9f3 commit 49f1def

File tree

28 files changed

+547
-78
lines changed

28 files changed

+547
-78
lines changed

asv_bench/benchmarks/eval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def setup(self):
4545
index = pd.date_range('20010101', periods=N, freq='T')
4646
s = pd.Series(index)
4747
self.ts = s.iloc[halfway]
48-
self.df = pd.DataFrame({'a': np.random.randn(N), 'dates': s},
48+
self.df = pd.DataFrame({'a': np.random.randn(N), 'dates': index},
4949
index=index)
5050
data = np.random.randn(N)
5151
self.min_val = data.min()

ci/deps/travis-27.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ dependencies:
2222
- patsy
2323
- psycopg2
2424
- py
25-
- pyarrow=0.7.0
25+
- pyarrow=0.9.0
2626
- PyCrypto
2727
- pymysql=0.6.3
2828
- pytables

doc/source/extending.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,14 @@ decorate a class, providing the name of attribute to add. The class's
2828
@pd.api.extensions.register_dataframe_accessor("geo")
2929
class GeoAccessor(object):
3030
def __init__(self, pandas_obj):
31+
self._validate(pandas_obj)
3132
self._obj = pandas_obj
3233
34+
@staticmethod
35+
def _validate(obj):
36+
if 'lat' not in obj.columns or 'lon' not in obj.columns:
37+
raise AttributeError("Must have 'lat' and 'lon'.")
38+
3339
@property
3440
def center(self):
3541
# return the geographic center point of this DataFrame
@@ -54,6 +60,13 @@ This can be a convenient way to extend pandas objects without subclassing them.
5460
If you write a custom accessor, make a pull request adding it to our
5561
:ref:`ecosystem` page.
5662

63+
We highly recommend validating the data in your accessor's `__init__`.
64+
In our ``GeoAccessor``, we validate that the data contains the expected columns,
65+
raising an ``AttributeError`` when the validation fails.
66+
For a ``Series`` accessor, you should validate the ``dtype`` if the accessor
67+
applies only to certain dtypes.
68+
69+
5770
.. _extending.extension-types:
5871

5972
Extension Types

doc/source/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ Optional Dependencies
257257
* `SciPy <http://www.scipy.org>`__: miscellaneous statistical functions, Version 0.18.1 or higher
258258
* `xarray <http://xarray.pydata.org>`__: pandas like handling for > 2 dims, needed for converting Panels to xarray objects. Version 0.7.0 or higher is recommended.
259259
* `PyTables <http://www.pytables.org>`__: necessary for HDF5-based storage, Version 3.4.2 or higher
260-
* `pyarrow <http://arrow.apache.org/docs/python/>`__ (>= 0.7.0): necessary for feather-based storage.
260+
* `pyarrow <http://arrow.apache.org/docs/python/>`__ (>= 0.9.0): necessary for feather-based storage.
261261
* `Apache Parquet <https://parquet.apache.org/>`__, either `pyarrow <http://arrow.apache.org/docs/python/>`__ (>= 0.7.0) or `fastparquet <https://fastparquet.readthedocs.io/en/latest>`__ (>= 0.2.1) for parquet-based storage. The `snappy <https://pypi.org/project/python-snappy>`__ and `brotli <https://pypi.org/project/brotlipy>`__ are available for compression support.
262262
* `SQLAlchemy <http://www.sqlalchemy.org>`__: for SQL database support. Version 0.8.1 or higher recommended. Besides SQLAlchemy, you also need a database specific driver. You can find an overview of supported drivers for each SQL dialect in the `SQLAlchemy docs <http://docs.sqlalchemy.org/en/latest/dialects/index.html>`__. Some common drivers are:
263263

doc/source/whatsnew/v0.24.0.rst

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ Pandas 0.24.0 includes a number of API breaking changes.
438438
Dependencies have increased minimum versions
439439
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
440440

441-
We have updated our minimum supported versions of dependencies (:issue:`21242`, :issue:`18742`, :issue:`23774`).
441+
We have updated our minimum supported versions of dependencies (:issue:`21242`, :issue:`18742`, :issue:`23774`, :issue:`24767`).
442442
If installed, we now require:
443443

444444
+-----------------+-----------------+----------+
@@ -456,7 +456,7 @@ If installed, we now require:
456456
+-----------------+-----------------+----------+
457457
| pandas-gbq | 0.8.0 | |
458458
+-----------------+-----------------+----------+
459-
| pyarrow | 0.7.0 | |
459+
| pyarrow | 0.9.0 | |
460460
+-----------------+-----------------+----------+
461461
| pytables | 3.4.2 | |
462462
+-----------------+-----------------+----------+
@@ -1159,6 +1159,7 @@ Other API Changes
11591159
- :meth:`CategoricalIndex.reindex` now raises a ``ValueError`` if the target index is non-unique and not equal to the current index. It previously only raised if the target index was not of a categorical dtype (:issue:`23963`).
11601160
- :func:`Series.to_list` and :func:`Index.to_list` are now aliases of ``Series.tolist`` respectively ``Index.tolist`` (:issue:`8826`)
11611161
- The result of ``SparseSeries.unstack`` is now a :class:`DataFrame` with sparse values, rather than a :class:`SparseDataFrame` (:issue:`24372`).
1162+
- :class:`DatetimeIndex` and :class:`TimedeltaIndex` no longer ignore the dtype precision. Passing a non-nanosecond resolution dtype will raise a ``ValueError`` (:issue:`24753`)
11621163

11631164

11641165
.. _whatsnew_0240.api.extension:
@@ -1259,6 +1260,7 @@ Deprecations
12591260
- :meth:`Series.nonzero` is deprecated and will be removed in a future version (:issue:`18262`)
12601261
- Passing an integer to :meth:`Series.fillna` and :meth:`DataFrame.fillna` with ``timedelta64[ns]`` dtypes is deprecated, will raise ``TypeError`` in a future version. Use ``obj.fillna(pd.Timedelta(...))`` instead (:issue:`24694`)
12611262
- ``Series.cat.categorical``, ``Series.cat.name`` and ``Sersies.cat.index`` have been deprecated. Use the attributes on ``Series.cat`` or ``Series`` directly. (:issue:`24751`).
1263+
- Passing a dtype without a precision like ``np.dtype('datetime64')`` or ``timedelta64`` to :class:`Index`, :class:`DatetimeIndex` and :class:`TimedeltaIndex` is now deprecated. Use the nanosecond-precision dtype instead (:issue:`24753`).
12621264

12631265
.. _whatsnew_0240.deprecations.datetimelike_int_ops:
12641266

@@ -1548,6 +1550,7 @@ Datetimelike
15481550
- Bug in :meth:`DatetimeIndex.astype`, :meth:`PeriodIndex.astype` and :meth:`TimedeltaIndex.astype` ignoring the sign of the ``dtype`` for unsigned integer dtypes (:issue:`24405`).
15491551
- Fixed bug in :meth:`Series.max` with ``datetime64[ns]``-dtype failing to return ``NaT`` when nulls are present and ``skipna=False`` is passed (:issue:`24265`)
15501552
- Bug in :func:`to_datetime` where arrays of ``datetime`` objects containing both timezone-aware and timezone-naive ``datetimes`` would fail to raise ``ValueError`` (:issue:`24569`)
1553+
- Bug in :func:`to_datetime` with invalid datetime format doesn't coerce input to ``NaT`` even if ``errors='coerce'`` (:issue:`24763`)
15511554

15521555
Timedelta
15531556
^^^^^^^^^
@@ -1689,8 +1692,8 @@ Missing
16891692
- Bug in :func:`Series.hasnans` that could be incorrectly cached and return incorrect answers if null elements are introduced after an initial call (:issue:`19700`)
16901693
- :func:`Series.isin` now treats all NaN-floats as equal also for ``np.object``-dtype. This behavior is consistent with the behavior for float64 (:issue:`22119`)
16911694
- :func:`unique` no longer mangles NaN-floats and the ``NaT``-object for ``np.object``-dtype, i.e. ``NaT`` is no longer coerced to a NaN-value and is treated as a different entity. (:issue:`22295`)
1692-
- :func:`DataFrame` and :func:`Series` now properly handle numpy masked arrays with hardened masks. Previously, constructing a DataFrame or Series from a masked array with a hard mask would create a pandas object containing the underlying value, rather than the expected NaN. (:issue:`24574`)
1693-
1695+
- :class:`DataFrame` and :class:`Series` now properly handle numpy masked arrays with hardened masks. Previously, constructing a DataFrame or Series from a masked array with a hard mask would create a pandas object containing the underlying value, rather than the expected NaN. (:issue:`24574`)
1696+
- Bug in :class:`DataFrame` constructor where ``dtype`` argument was not honored when handling numpy masked record arrays. (:issue:`24874`)
16941697

16951698
MultiIndex
16961699
^^^^^^^^^^
@@ -1705,6 +1708,7 @@ I/O
17051708
^^^
17061709

17071710
- Bug in :func:`read_csv` in which a column specified with ``CategoricalDtype`` of boolean categories was not being correctly coerced from string values to booleans (:issue:`20498`)
1711+
- Bug in :func:`read_csv` in which unicode column names were not being properly recognized with Python 2.x (:issue:`13253`)
17081712
- Bug in :meth:`DataFrame.to_sql` when writing timezone aware data (``datetime64[ns, tz]`` dtype) would raise a ``TypeError`` (:issue:`9086`)
17091713
- Bug in :meth:`DataFrame.to_sql` where a naive :class:`DatetimeIndex` would be written as ``TIMESTAMP WITH TIMEZONE`` type in supported databases, e.g. PostgreSQL (:issue:`23510`)
17101714
- Bug in :meth:`read_excel()` when ``parse_cols`` is specified with an empty dataset (:issue:`9208`)
@@ -1782,6 +1786,7 @@ Groupby/Resample/Rolling
17821786
- Bug in :meth:`DataFrame.groupby` did not respect the ``observed`` argument when selecting a column and instead always used ``observed=False`` (:issue:`23970`)
17831787
- Bug in :func:`pandas.core.groupby.SeriesGroupBy.pct_change` or :func:`pandas.core.groupby.DataFrameGroupBy.pct_change` would previously work across groups when calculating the percent change, where it now correctly works per group (:issue:`21200`, :issue:`21235`).
17841788
- Bug preventing hash table creation with very large number (2^32) of rows (:issue:`22805`)
1789+
- Bug in groupby when grouping on categorical causes ``ValueError`` and incorrect grouping if ``observed=True`` and ``nan`` is present in categorical column (:issue:`24740`, :issue:`21151`).
17851790

17861791
Reshaping
17871792
^^^^^^^^^

doc/source/whatsnew/v0.24.1.rst

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
:orphan:
2+
3+
.. _whatsnew_0241:
4+
5+
Whats New in 0.24.1 (February XX, 2019)
6+
---------------------------------------
7+
8+
.. warning::
9+
10+
The 0.24.x series of releases will be the last to support Python 2. Future feature
11+
releases will support Python 3 only. See :ref:`install.dropping-27` for more.
12+
13+
{{ header }}
14+
15+
These are the changes in pandas 0.24.1. See :ref:`release` for a full changelog
16+
including other versions of pandas.
17+
18+
19+
.. _whatsnew_0241.enhancements:
20+
21+
Enhancements
22+
^^^^^^^^^^^^
23+
24+
25+
.. _whatsnew_0241.bug_fixes:
26+
27+
Bug Fixes
28+
~~~~~~~~~
29+
30+
**Conversion**
31+
32+
-
33+
-
34+
-
35+
36+
**Indexing**
37+
38+
-
39+
-
40+
-
41+
42+
**I/O**
43+
44+
-
45+
-
46+
-
47+
48+
**Categorical**
49+
50+
-
51+
-
52+
-
53+
54+
**Timezones**
55+
56+
-
57+
-
58+
-
59+
60+
**Timedelta**
61+
62+
-
63+
-
64+
-
65+
66+
67+
**Other**
68+
69+
-
70+
-
71+
72+
.. _whatsnew_0.241.contributors:
73+
74+
Contributors
75+
~~~~~~~~~~~~
76+
77+
.. contributors:: v0.24.0..v0.24.1

0 commit comments

Comments
 (0)