Skip to content

Commit 144ef86

Browse files
committed
Merge remote-tracking branch 'upstream/master' into depr_concat_join_axes
2 parents d2aa496 + a5fe9cf commit 144ef86

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+733
-499
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ build: clean_pyc
1313
python setup.py build_ext --inplace
1414

1515
lint-diff:
16-
git diff master --name-only -- "*.py" | grep "pandas" | xargs flake8
16+
git diff master --name-only -- "*.py" | grep -E "pandas|scripts" | xargs flake8
1717

1818
develop: build
1919
-python setup.py develop

ci/lint.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ if [ "$LINT" ]; then
2424
if [ $? -ne "0" ]; then
2525
RET=1
2626
fi
27+
28+
flake8 scripts/tests --filename=*.py
29+
if [ $? -ne "0" ]; then
30+
RET=1
31+
fi
2732
echo "Linting *.py DONE"
2833

2934
echo "Linting setup.py"
@@ -175,7 +180,7 @@ if [ "$LINT" ]; then
175180
RET=1
176181
fi
177182
echo "Check for old-style classes DONE"
178-
183+
179184
echo "Check for backticks incorrectly rendering because of missing spaces"
180185
grep -R --include="*.rst" -E "[a-zA-Z0-9]\`\`?[a-zA-Z0-9]" doc/source/
181186

ci/script_single.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ elif [ "$COVERAGE" ]; then
2828
echo pytest -s -m "single" -r xXs --strict --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=/tmp/single.xml $TEST_ARGS pandas
2929
pytest -s -m "single" -r xXs --strict --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=/tmp/single.xml $TEST_ARGS pandas
3030

31+
echo pytest -s -r xXs --strict scripts
32+
pytest -s -r xXs --strict scripts
3133
else
3234
echo pytest -m "single" -r xXs --junitxml=/tmp/single.xml --strict $TEST_ARGS pandas
3335
pytest -m "single" -r xXs --junitxml=/tmp/single.xml --strict $TEST_ARGS pandas # TODO: doctest

doc/source/groupby.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ consider the following ``DataFrame``:
103103

104104
.. note::
105105

106-
.. versionadded:: 0.20
107-
108106
A string passed to ``groupby`` may refer to either a column or an index level.
109107
If a string matches both a column name and an index level name, a
110108
``ValueError`` will be raised.

doc/source/text.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ The same alignment can be used when ``others`` is a ``DataFrame``:
306306
Concatenating a Series and many objects into a Series
307307
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
308308

309-
All one-dimensional list-likes can be arbitrarily combined in a list-like container (including iterators, ``dict``-views, etc.):
309+
All one-dimensional list-likes can be combined in a list-like container (including iterators, ``dict``-views, etc.):
310310

311311
.. ipython:: python
312312

doc/source/timeseries.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2228,7 +2228,7 @@ To remove timezone from tz-aware ``DatetimeIndex``, use ``tz_localize(None)`` or
22282228
didx.tz_convert(None)
22292229
22302230
# tz_convert(None) is identical with tz_convert('UTC').tz_localize(None)
2231-
didx.tz_convert('UCT').tz_localize(None)
2231+
didx.tz_convert('UTC').tz_localize(None)
22322232
22332233
.. _timeseries.timezone_ambiguous:
22342234

doc/source/whatsnew/v0.24.0.txt

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,14 +507,16 @@ Other API Changes
507507
Deprecations
508508
~~~~~~~~~~~~
509509

510-
- :meth:`DataFrame.to_stata`, :meth:`read_stata`, :class:`StataReader` and :class:`StataWriter` have deprecated the ``encoding`` argument. The encoding of a Stata dta file is determined by the file type and cannot be changed (:issue:`21244`).
511-
- :meth:`MultiIndex.to_hierarchical` is deprecated and will be removed in a future version (:issue:`21613`)
510+
- :meth:`DataFrame.to_stata`, :meth:`read_stata`, :class:`StataReader` and :class:`StataWriter` have deprecated the ``encoding`` argument. The encoding of a Stata dta file is determined by the file type and cannot be changed (:issue:`21244`)
511+
- :meth:`MultiIndex.to_hierarchical` is deprecated and will be removed in a future version (:issue:`21613`)
512512
- :meth:`Series.ptp` is deprecated. Use ``numpy.ptp`` instead (:issue:`21614`)
513513
- :meth:`Series.compress` is deprecated. Use ``Series[condition]`` instead (:issue:`18262`)
514514
- The signature of :meth:`Series.to_csv` has been uniformed to that of doc:meth:`DataFrame.to_csv`: the name of the first argument is now 'path_or_buf', the order of subsequent arguments has changed, the 'header' argument now defaults to True. (:issue:`19715`)
515515
- :meth:`Categorical.from_codes` has deprecated providing float values for the ``codes`` argument. (:issue:`21767`)
516516
- :meth:`pandas.concat` has deprecated the ``join_axes``-keyword. Instead, use :meth:`DataFrame.reindex` or :meth:`DataFrame.reindex_like` on the result (:issue:`21951`)
517517
- :func:`pandas.read_table` is deprecated. Instead, use :func:`pandas.read_csv` passing ``sep='\t'`` if necessary (:issue:`21948`)
518+
- :meth:`Series.str.cat` has deprecated using arbitrary list-likes *within* list-likes. A list-like container may still contain
519+
many ``Series``, ``Index`` or 1-dimensional ``np.ndarray``, or alternatively, only scalar values. (:issue:`21950`)
518520

519521
.. _whatsnew_0240.prior_deprecations:
520522

@@ -526,6 +528,7 @@ Removal of prior version deprecations/changes
526528
- Several private functions were removed from the (non-public) module ``pandas.core.common`` (:issue:`22001`)
527529
- Removal of the previously deprecated module ``pandas.core.datetools`` (:issue:`14105`, :issue:`14094`)
528530
- Strings passed into :meth:`DataFrame.groupby` that refer to both column and index levels will raise a ``ValueError`` (:issue:`14432`)
531+
- :meth:`Index.repeat` and :meth:`MultiIndex.repeat` have renamed the ``n`` argument to ``repeats``(:issue:`14645`)
529532
-
530533

531534
.. _whatsnew_0240.performance:
@@ -583,6 +586,7 @@ Datetimelike
583586
- Bug in :class:`DataFrame` comparisons against ``Timestamp``-like objects failing to raise ``TypeError`` for inequality checks with mismatched types (:issue:`8932`,:issue:`22163`)
584587
- Bug in :class:`DataFrame` with mixed dtypes including ``datetime64[ns]`` incorrectly raising ``TypeError`` on equality comparisons (:issue:`13128`,:issue:`22163`)
585588
- Bug in :meth:`DataFrame.eq` comparison against ``NaT`` incorrectly returning ``True`` or ``NaN`` (:issue:`15697`,:issue:`22163`)
589+
- Bug in :class:`DatetimeIndex` subtraction that incorrectly failed to raise `OverflowError` (:issue:`22492`, :issue:`22508`)
586590

587591
Timedelta
588592
^^^^^^^^^
@@ -664,6 +668,7 @@ Indexing
664668
- Fixed ``DataFrame[np.nan]`` when columns are non-unique (:issue:`21428`)
665669
- Bug when indexing :class:`DatetimeIndex` with nanosecond resolution dates and timezones (:issue:`11679`)
666670
- Bug where indexing with a Numpy array containing negative values would mutate the indexer (:issue:`21867`)
671+
- Bug where mixed indexes wouldn't allow integers for ``.at`` (:issue:`19860`)
667672
- ``Float64Index.get_loc`` now raises ``KeyError`` when boolean key passed. (:issue:`19087`)
668673

669674
Missing
@@ -704,6 +709,7 @@ Groupby/Resample/Rolling
704709
- Multiple bugs in :func:`pandas.core.Rolling.min` with ``closed='left'` and a
705710
datetime-like index leading to incorrect results and also segfault. (:issue:`21704`)
706711
- Bug in :meth:`Resampler.apply` when passing postiional arguments to applied func (:issue:`14615`).
712+
- Bug in :meth:`Series.resample` when passing ``numpy.timedelta64`` to `loffset` kwarg (:issue:`7687`).
707713

708714
Sparse
709715
^^^^^^
@@ -736,9 +742,10 @@ Build Changes
736742
Other
737743
^^^^^
738744

739-
- :meth: `~pandas.io.formats.style.Styler.background_gradient` now takes a ``text_color_threshold`` parameter to automatically lighten the text color based on the luminance of the background color. This improves readability with dark background colors without the need to limit the background colormap range. (:issue:`21258`)
745+
- :meth:`~pandas.io.formats.style.Styler.background_gradient` now takes a ``text_color_threshold`` parameter to automatically lighten the text color based on the luminance of the background color. This improves readability with dark background colors without the need to limit the background colormap range. (:issue:`21258`)
740746
- Require at least 0.28.2 version of ``cython`` to support read-only memoryviews (:issue:`21688`)
741-
- :meth: `~pandas.io.formats.style.Styler.background_gradient` now also supports tablewise application (in addition to rowwise and columnwise) with ``axis=None`` (:issue:`15204`)
747+
- :meth:`~pandas.io.formats.style.Styler.background_gradient` now also supports tablewise application (in addition to rowwise and columnwise) with ``axis=None`` (:issue:`15204`)
748+
- :meth:`~pandas.io.formats.style.Styler.bar` now also supports tablewise application (in addition to rowwise and columnwise) with ``axis=None`` and setting clipping range with ``vmin`` and ``vmax`` (:issue:`21548` and :issue:`21526`). ``NaN`` values are also handled properly.
742749
-
743750
-
744751
-

pandas/_libs/algos_common_helper.pxi.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,9 @@ cpdef map_indices_{{name}}(ndarray[{{c_type}}] index):
5555

5656
Better to do this with Cython because of the enormous speed boost.
5757
"""
58-
cdef Py_ssize_t i, length
59-
cdef dict result = {}
58+
cdef:
59+
Py_ssize_t i, length
60+
dict result = {}
6061

6162
length = len(index)
6263

pandas/_libs/index.pyx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,7 @@ cdef class IndexEngine:
104104
loc = self.get_loc(key)
105105
value = convert_scalar(arr, value)
106106

107-
if PySlice_Check(loc) or util.is_array(loc):
108-
arr[loc] = value
109-
else:
110-
util.set_value_at(arr, loc, value)
107+
arr[loc] = value
111108

112109
cpdef get_loc(self, object val):
113110
if is_definitely_invalid_key(val):

pandas/_libs/lib.pyx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,7 @@ def astype_intsafe(ndarray[object] arr, new_dtype):
492492
if is_datelike and checknull(v):
493493
result[i] = NPY_NAT
494494
else:
495-
# we can use the unsafe version because we know `result` is mutable
496-
# since it was created from `np.empty`
497-
util.set_value_at_unsafe(result, i, v)
495+
result[i] = v
498496

499497
return result
500498

@@ -505,9 +503,7 @@ cpdef ndarray[object] astype_unicode(ndarray arr):
505503
ndarray[object] result = np.empty(n, dtype=object)
506504

507505
for i in range(n):
508-
# we can use the unsafe version because we know `result` is mutable
509-
# since it was created from `np.empty`
510-
util.set_value_at_unsafe(result, i, unicode(arr[i]))
506+
result[i] = unicode(arr[i])
511507

512508
return result
513509

@@ -518,9 +514,7 @@ cpdef ndarray[object] astype_str(ndarray arr):
518514
ndarray[object] result = np.empty(n, dtype=object)
519515

520516
for i in range(n):
521-
# we can use the unsafe version because we know `result` is mutable
522-
# since it was created from `np.empty`
523-
util.set_value_at_unsafe(result, i, str(arr[i]))
517+
result[i] = str(arr[i])
524518

525519
return result
526520

0 commit comments

Comments
 (0)