Skip to content

Commit 292ba87

Browse files
author
Mike Phung
committed
Merge branch 'master' into fillna-other-missing-values-not-modified
2 parents 8249829 + 11a8c17 commit 292ba87

36 files changed

+525
-101
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Bug Report
2+
description: Report incorrect behavior in the pandas library
3+
title: "BUG: "
4+
labels: [Bug, Needs Triage]
5+
6+
body:
7+
- type: checkboxes
8+
id: checks
9+
attributes:
10+
options:
11+
- label: >
12+
I have checked that this issue has not already been reported.
13+
required: true
14+
- label: >
15+
I have confirmed this bug exists on the
16+
[latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas.
17+
required: true
18+
- label: >
19+
I have confirmed this bug exists on the master branch of pandas.
20+
- type: textarea
21+
id: example
22+
attributes:
23+
label: Reproducible Example
24+
description: >
25+
Please follow [this guide](https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports) on how to
26+
provide a minimal, copy-pastable example.
27+
placeholder: >
28+
import pandas as pd
29+
30+
df = pd.DataFrame(range(5))
31+
32+
...
33+
render: python
34+
validations:
35+
required: true
36+
- type: textarea
37+
id: problem
38+
attributes:
39+
label: Issue Description
40+
description: >
41+
Please provide a description of the issue shown in the reproducible example.
42+
validations:
43+
required: true
44+
- type: textarea
45+
id: expected-behavior
46+
attributes:
47+
label: Expected Behavior
48+
description: >
49+
Please describe or show a code example of the expected behavior.
50+
validations:
51+
required: true
52+
- type: textarea
53+
id: version
54+
attributes:
55+
label: Installed Versions
56+
description: >
57+
Please paste the output of ``pd.show_versions()``
58+
value: >
59+
<details>
60+
61+
62+
Replace this line with the output of pd.show_versions()
63+
64+
65+
</details>
66+
validations:
67+
required: true
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Installation Issue
2+
description: Report issues installing the pandas library on your system
3+
title: "BUILD: "
4+
labels: [Build, Needs Triage]
5+
6+
body:
7+
- type: checkboxes
8+
id: checks
9+
attributes:
10+
options:
11+
- label: >
12+
I have read the [installation guide](https://pandas.pydata.org/pandas-docs/stable/getting_started/install.html#installing-pandas).
13+
required: true
14+
- type: input
15+
id: platform
16+
attributes:
17+
label: Platform
18+
description: >
19+
Please provide the output of ``import platform; print(platform.platform())``
20+
validations:
21+
required: true
22+
- type: dropdown
23+
id: method
24+
attributes:
25+
label: Installation Method
26+
description: >
27+
Please provide how you tried to install pandas from a clean environment.
28+
options:
29+
- pip install
30+
- conda install
31+
- apt-get install
32+
- Built from source
33+
- Other
34+
validations:
35+
required: true
36+
- type: input
37+
id: pandas
38+
attributes:
39+
label: pandas Version
40+
description: >
41+
Please provide the version of pandas you are trying to install.
42+
validations:
43+
required: true
44+
- type: input
45+
id: python
46+
attributes:
47+
label: Python Version
48+
description: >
49+
Please provide the installed version of Python.
50+
validations:
51+
required: true
52+
- type: textarea
53+
id: logs
54+
attributes:
55+
label: Installation Logs
56+
description: >
57+
If possible, please copy and paste the installation logs when attempting to install pandas.
58+
value: >
59+
<details>
60+
61+
62+
Replace this line with the installation logs.
63+
64+
65+
</details>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Performance Issue
2+
description: Report slow performance or memory issues when running pandas code
3+
title: "PERF: "
4+
labels: [Performance, Needs Triage]
5+
6+
body:
7+
- type: checkboxes
8+
id: checks
9+
attributes:
10+
options:
11+
- label: >
12+
I have checked that this issue has not already been reported.
13+
required: true
14+
- label: >
15+
I have confirmed this issue exists on the
16+
[latest version](https://pandas.pydata.org/docs/whatsnew/index.html) of pandas.
17+
required: true
18+
- label: >
19+
I have confirmed this issue exists on the master branch of pandas.
20+
- type: textarea
21+
id: example
22+
attributes:
23+
label: Reproducible Example
24+
description: >
25+
Please provide a minimal, copy-pastable example that quantifies
26+
[slow runtime](https://docs.python.org/3/library/timeit.html) or
27+
[memory](https://pypi.org/project/memory-profiler/) issues.
28+
validations:
29+
required: true
30+
- type: textarea
31+
id: version
32+
attributes:
33+
label: Installed Versions
34+
description: >
35+
Please paste the output of ``pd.show_versions()``
36+
value: >
37+
<details>
38+
39+
40+
Replace this line with the output of pd.show_versions()
41+
42+
43+
</details>
44+
validations:
45+
required: true
46+
- type: textarea
47+
id: prior-performance
48+
attributes:
49+
label: Prior Performance
50+
description: >
51+
If applicable, please provide the prior version of pandas and output
52+
of the same reproducible example where the performance issue did not exist.

doc/source/whatsnew/v1.3.2.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Fixed regressions
2626
- Fixed regression in :func:`concat` where ``copy=False`` was not honored in ``axis=1`` Series concatenation (:issue:`42501`)
2727
- Regression in :meth:`Series.nlargest` and :meth:`Series.nsmallest` with nullable integer or float dtype (:issue:`42816`)
2828
- Fixed regression in :meth:`Series.quantile` with :class:`Int64Dtype` (:issue:`42626`)
29+
- Fixed regression in :meth:`Series.groupby` and :meth:`DataFrame.groupby` where supplying the ``by`` argument with a Series named with a tuple would incorrectly raise (:issue:`42731`)
2930

3031
.. ---------------------------------------------------------------------------
3132

doc/source/whatsnew/v1.3.3.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Fixed regressions
1717
- Fixed regression in :class:`DataFrame` constructor failing to broadcast for defined :class:`Index` and len one list of :class:`Timestamp` (:issue:`42810`)
1818
- Performance regression in :meth:`core.window.ewm.ExponentialMovingWindow.mean` (:issue:`42333`)
1919
- Fixed regression in :meth:`.GroupBy.agg` incorrectly raising in some cases (:issue:`42390`)
20+
- Fixed regression in :meth:`.GroupBy.apply` where ``nan`` values were dropped even with ``dropna=False`` (:issue:`43205`)
2021
- Fixed regression in :meth:`.GroupBy.quantile` which was failing with ``pandas.NA`` (:issue:`42849`)
2122
- Fixed regression in :meth:`merge` where ``on`` columns with ``ExtensionDtype`` or ``bool`` data types were cast to ``object`` in ``right`` and ``outer`` merge (:issue:`40073`)
2223
- Fixed regression in :meth:`RangeIndex.where` and :meth:`RangeIndex.putmask` raising ``AssertionError`` when result did not represent a :class:`RangeIndex` (:issue:`43240`)

doc/source/whatsnew/v1.4.0.rst

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ Performance improvements
291291
- Performance improvement in :func:`read_stata` (:issue:`43059`)
292292
- Performance improvement in :meth:`to_datetime` with ``uint`` dtypes (:issue:`42606`)
293293
- Performance improvement in :meth:`Series.sparse.to_coo` (:issue:`42880`)
294-
-
294+
- Performance improvement in indexing with a :class:`MultiIndex` indexer on another :class:`MultiIndex` (:issue:43370`)
295295

296296
.. ---------------------------------------------------------------------------
297297
@@ -322,7 +322,7 @@ Timedelta
322322

323323
Timezones
324324
^^^^^^^^^
325-
-
325+
- Bug in :meth:`Series.dt.tz_convert` resetting index in a :class:`Series` with :class:`CategoricalIndex` (:issue:`43080`)
326326
-
327327

328328
Numeric
@@ -361,6 +361,7 @@ Indexing
361361
- Bug in :meth:`DataFrame.drop` where the error message did not show missing labels with commas when raising ``KeyError`` (:issue:`42881`)
362362
-
363363

364+
364365
Missing
365366
^^^^^^^
366367
- Bug in :meth:`DataFrame.fillna` with limit and no method ignores axis='columns' or ``axis = 1`` (:issue:`40989`)
@@ -383,7 +384,7 @@ I/O
383384
- Bug in :func:`Series.to_json` and :func:`DataFrame.to_json` where some attributes were skipped when serialising plain Python objects to JSON (:issue:`42768`, :issue:`33043`)
384385
- Column headers are dropped when constructing a :class:`DataFrame` from a sqlalchemy's ``Row`` object (:issue:`40682`)
385386
- Bug in unpickling a :class:`Index` with object dtype incorrectly inferring numeric dtypes (:issue:`43188`)
386-
-
387+
- Bug in :func:`read_csv` where reading multi-header input with unequal lengths incorrectly raising uncontrolled ``IndexError`` (:issue:`43102`)
387388

388389
Period
389390
^^^^^^
@@ -407,6 +408,7 @@ Groupby/resample/rolling
407408
- Bug in :meth:`pandas.DataFrame.rolling` operation along rows (``axis=1``) incorrectly omits columns containing ``float16`` and ``float32`` (:issue:`41779`)
408409
- Bug in :meth:`Resampler.aggregate` did not allow the use of Named Aggregation (:issue:`32803`)
409410
- Bug in :meth:`Series.rolling` when the :class:`Series` ``dtype`` was ``Int64`` (:issue:`43016`)
411+
- Bug in :meth:`DataFrame.groupby.rolling` when specifying ``on`` and calling ``__getitem__`` would subsequently return incorrect results (:issue:`43355`)
410412

411413
Reshaping
412414
^^^^^^^^^

pandas/_libs/index.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import numpy as np
22

33
from pandas._typing import npt
44

5+
from pandas import MultiIndex
6+
57
class IndexEngine:
68
over_size_threshold: bool
79
def __init__(self, vgetter, n: int): ...
@@ -59,7 +61,7 @@ class BaseMultiIndexCodesEngine:
5961
self,
6062
target: npt.NDArray[np.object_],
6163
) -> npt.NDArray[np.intp]: ...
62-
def _extract_level_codes(self, target: object): ...
64+
def _extract_level_codes(self, target: MultiIndex) -> np.ndarray: ...
6365
def get_indexer_with_fill(
6466
self,
6567
target: np.ndarray, # np.ndarray[object] of tuples

pandas/_libs/index.pyx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -622,23 +622,22 @@ cdef class BaseMultiIndexCodesEngine:
622622
in zip(self.levels, zt)]
623623
return self._codes_to_ints(np.array(level_codes, dtype='uint64').T)
624624

625-
def get_indexer(self, target) -> np.ndarray:
625+
def get_indexer(self, target: np.ndarray) -> np.ndarray:
626626
"""
627627
Returns an array giving the positions of each value of `target` in
628628
`self.values`, where -1 represents a value in `target` which does not
629629
appear in `self.values`
630630

631631
Parameters
632632
----------
633-
target : MultiIndex
633+
target : np.ndarray
634634

635635
Returns
636636
-------
637637
np.ndarray[intp_t, ndim=1] of the indexer of `target` into
638638
`self.values`
639639
"""
640-
lab_ints = self._extract_level_codes(target)
641-
return self._base.get_indexer(self, lab_ints)
640+
return self._base.get_indexer(self, target)
642641

643642
def get_indexer_with_fill(self, ndarray target, ndarray values,
644643
str method, object limit) -> np.ndarray:
@@ -741,10 +740,9 @@ cdef class BaseMultiIndexCodesEngine:
741740

742741
return self._base.get_loc(self, lab_int)
743742

744-
def get_indexer_non_unique(self, target):
743+
def get_indexer_non_unique(self, target: np.ndarray) -> np.ndarray:
745744
# target: MultiIndex
746-
lab_ints = self._extract_level_codes(target)
747-
indexer = self._base.get_indexer_non_unique(self, lab_ints)
745+
indexer = self._base.get_indexer_non_unique(self, target)
748746

749747
return indexer
750748

pandas/_typing.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@
6969

7070
from pandas.io.formats.format import EngFormatter
7171
from pandas.tseries.offsets import DateOffset
72+
73+
# numpy compatible types
74+
NumpyValueArrayLike = Union[npt._ScalarLike_co, npt.ArrayLike]
75+
NumpySorter = Optional[npt._ArrayLikeInt_co]
76+
7277
else:
7378
npt: Any = None
7479

@@ -85,6 +90,7 @@
8590
PandasScalar = Union["Period", "Timestamp", "Timedelta", "Interval"]
8691
Scalar = Union[PythonScalar, PandasScalar]
8792

93+
8894
# timestamp and timedelta convertible types
8995

9096
TimestampConvertibleTypes = Union[

0 commit comments

Comments
 (0)