Skip to content

Commit a5535f4

Browse files
Merge remote-tracking branch 'upstream/master' into bisect
2 parents 36a4183 + 6e18023 commit a5535f4

File tree

148 files changed

+2890
-1905
lines changed

Some content is hidden

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

148 files changed

+2890
-1905
lines changed

.github/workflows/autoupdate-pre-commit-config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Update pre-commit config packages
2424
uses: technote-space/create-pr-action@v2
2525
with:
26-
GITHUB_TOKEN: ${{ secrets.ACTION_TRIGGER_TOKEN }}
26+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2727
EXECUTE_COMMANDS: |
2828
pip install pre-commit
2929
pre-commit autoupdate || (exit 0);

.github/workflows/comment_bot.yml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Comment-bot
2+
3+
on:
4+
issue_comment:
5+
types:
6+
- created
7+
- edited
8+
9+
jobs:
10+
autotune:
11+
name: "Fixup pre-commit formatting"
12+
if: startsWith(github.event.comment.body, '@github-actions pre-commit')
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: r-lib/actions/pr-fetch@master
17+
with:
18+
repo-token: ${{ secrets.GITHUB_TOKEN }}
19+
- name: Cache multiple paths
20+
uses: actions/cache@v2
21+
with:
22+
path: |
23+
~/.cache/pre-commit
24+
~/.cache/pip
25+
key: pre-commit-dispatched-${{ runner.os }}-build
26+
- uses: actions/setup-python@v2
27+
with:
28+
python-version: 3.8
29+
- name: Install-pre-commit
30+
run: python -m pip install --upgrade pre-commit
31+
- name: Run pre-commit
32+
run: pre-commit run --all-files || (exit 0)
33+
- name: Commit results
34+
run: |
35+
git config user.name "$(git log -1 --pretty=format:%an)"
36+
git config user.email "$(git log -1 --pretty=format:%ae)"
37+
git commit -a -m 'Fixes from pre-commit [automated commit]' || echo "No changes to commit"
38+
- uses: r-lib/actions/pr-push@master
39+
with:
40+
repo-token: ${{ secrets.GITHUB_TOKEN }}

.pre-commit-config.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ repos:
8989
# No direct imports from conftest
9090
conftest\ import|
9191
import\ conftest
92+
93+
# Check for use of pandas.testing instead of tm
94+
pd\.testing\.
9295
types: [python]
9396
files: ^pandas/tests/
9497
- id: incorrect-code-directives

asv_bench/benchmarks/algorithms.py

-12
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
from pandas._libs import lib
66

77
import pandas as pd
8-
from pandas.core.algorithms import make_duplicates_of_left_unique_in_right
98

109
from .pandas_vb_common import tm
1110

@@ -175,15 +174,4 @@ def time_argsort(self, N):
175174
self.array.argsort()
176175

177176

178-
class RemoveDuplicates:
179-
def setup(self):
180-
N = 10 ** 5
181-
na = np.arange(int(N / 2))
182-
self.left = np.concatenate([na[: int(N / 4)], na[: int(N / 4)]])
183-
self.right = np.concatenate([na, na])
184-
185-
def time_make_duplicates_of_left_unique_in_right(self):
186-
make_duplicates_of_left_unique_in_right(self.left, self.right)
187-
188-
189177
from .pandas_vb_common import setup # noqa: F401 isort:skip

ci/deps/azure-38-locale.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ dependencies:
1818
- html5lib
1919
- ipython
2020
- jinja2
21+
- jedi<0.18.0
2122
- lxml
2223
- matplotlib <3.3.0
2324
- moto

ci/deps/azure-38-slow.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies:
3030
- moto>=1.3.14
3131
- scipy
3232
- sqlalchemy
33-
- xlrd<2.0
33+
- xlrd>=2.0
3434
- xlsxwriter
3535
- xlwt
3636
- moto

ci/deps/azure-windows-37.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dependencies:
3333
- s3fs>=0.4.2
3434
- scipy
3535
- sqlalchemy
36-
- xlrd<2.0
36+
- xlrd>=2.0
3737
- xlsxwriter
3838
- xlwt
3939
- pyreadstat

doc/source/conf.py

+25
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,30 @@ def process_class_docstrings(app, what, name, obj, options, lines):
687687
lines[:] = joined.split("\n")
688688

689689

690+
_BUSINED_ALIASES = [
691+
"pandas.tseries.offsets." + name
692+
for name in [
693+
"BDay",
694+
"CDay",
695+
"BMonthEnd",
696+
"BMonthBegin",
697+
"CBMonthEnd",
698+
"CBMonthBegin",
699+
]
700+
]
701+
702+
703+
def process_business_alias_docstrings(app, what, name, obj, options, lines):
704+
"""
705+
Starting with sphinx 3.4, the "autodoc-process-docstring" event also
706+
gets called for alias classes. This results in numpydoc adding the
707+
methods/attributes to the docstring, which we don't want (+ this
708+
causes warnings with sphinx).
709+
"""
710+
if name in _BUSINED_ALIASES:
711+
lines[:] = []
712+
713+
690714
suppress_warnings = [
691715
# We "overwrite" autosummary with our PandasAutosummary, but
692716
# still want the regular autosummary setup to run. So we just
@@ -716,6 +740,7 @@ def setup(app):
716740
app.connect("source-read", rstjinja)
717741
app.connect("autodoc-process-docstring", remove_flags_docstring)
718742
app.connect("autodoc-process-docstring", process_class_docstrings)
743+
app.connect("autodoc-process-docstring", process_business_alias_docstrings)
719744
app.add_autodocumenter(AccessorDocumenter)
720745
app.add_autodocumenter(AccessorAttributeDocumenter)
721746
app.add_autodocumenter(AccessorMethodDocumenter)

doc/source/getting_started/overview.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ pandas possible. Thanks to `all of our contributors <https://github.com/pandas-d
147147

148148
If you're interested in contributing, please visit the :ref:`contributing guide <contributing>`.
149149

150-
pandas is a `NumFOCUS <https://www.numfocus.org/open-source-projects/>`__ sponsored project.
150+
pandas is a `NumFOCUS <https://numfocus.org/sponsored-projects>`__ sponsored project.
151151
This will help ensure the success of the development of pandas as a world-class open-source
152152
project and makes it possible to `donate <https://pandas.pydata.org/donate.html>`__ to the project.
153153

doc/source/user_guide/10min.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Selection
163163

164164
.. note::
165165

166-
While standard Python / Numpy expressions for selecting and setting are
166+
While standard Python / NumPy expressions for selecting and setting are
167167
intuitive and come in handy for interactive work, for production code, we
168168
recommend the optimized pandas data access methods, ``.at``, ``.iat``,
169169
``.loc`` and ``.iloc``.
@@ -239,7 +239,7 @@ Select via the position of the passed integers:
239239
240240
df.iloc[3]
241241
242-
By integer slices, acting similar to numpy/Python:
242+
By integer slices, acting similar to NumPy/Python:
243243

244244
.. ipython:: python
245245

doc/source/user_guide/cookbook.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Simplified, condensed, new-user friendly, in-line examples have been inserted wh
1515
augment the Stack-Overflow and GitHub links. Many of the links contain expanded information,
1616
above what the in-line examples offer.
1717

18-
pandas (pd) and Numpy (np) are the only two abbreviated imported modules. The rest are kept
18+
pandas (pd) and NumPy (np) are the only two abbreviated imported modules. The rest are kept
1919
explicitly imported for newer users.
2020

2121
Idioms

doc/source/user_guide/io.rst

+28-3
Original file line numberDiff line numberDiff line change
@@ -2834,15 +2834,40 @@ parse HTML tables in the top-level pandas io function ``read_html``.
28342834
Excel files
28352835
-----------
28362836

2837-
The :func:`~pandas.read_excel` method can read Excel 2003 (``.xls``)
2838-
files using the ``xlrd`` Python module. Excel 2007+ (``.xlsx``) files
2839-
can be read using either ``xlrd`` or ``openpyxl``. Binary Excel (``.xlsb``)
2837+
The :func:`~pandas.read_excel` method can read Excel 2007+ (``.xlsx``) files
2838+
using the ``openpyxl`` Python module. Excel 2003 (``.xls``) files
2839+
can be read using ``xlrd``. Binary Excel (``.xlsb``)
28402840
files can be read using ``pyxlsb``.
28412841
The :meth:`~DataFrame.to_excel` instance method is used for
28422842
saving a ``DataFrame`` to Excel. Generally the semantics are
28432843
similar to working with :ref:`csv<io.read_csv_table>` data.
28442844
See the :ref:`cookbook<cookbook.excel>` for some advanced strategies.
28452845

2846+
.. warning::
2847+
2848+
The `xlwt <https://xlwt.readthedocs.io/en/latest/>`__ package for writing old-style ``.xls``
2849+
excel files is no longer maintained.
2850+
The `xlrd <https://xlrd.readthedocs.io/en/latest/>`__ package is now only for reading
2851+
old-style ``.xls`` files.
2852+
2853+
Previously, the default argument ``engine=None`` to :func:`~pandas.read_excel`
2854+
would result in using the ``xlrd`` engine in many cases, including new
2855+
Excel 2007+ (``.xlsx``) files.
2856+
If `openpyxl <https://openpyxl.readthedocs.io/en/stable/>`__ is installed,
2857+
many of these cases will now default to using the ``openpyxl`` engine.
2858+
See the :func:`read_excel` documentation for more details.
2859+
2860+
Thus, it is strongly encouraged to install ``openpyxl`` to read Excel 2007+
2861+
(``.xlsx``) files.
2862+
**Please do not report issues when using ``xlrd`` to read ``.xlsx`` files.**
2863+
This is no longer supported, switch to using ``openpyxl`` instead.
2864+
2865+
Attempting to use the the ``xlwt`` engine will raise a ``FutureWarning``
2866+
unless the option :attr:`io.excel.xls.writer` is set to ``"xlwt"``.
2867+
While this option is now deprecated and will also raise a ``FutureWarning``,
2868+
it can be globally set and the warning suppressed. Users are recommended to
2869+
write ``.xlsx`` files using the ``openpyxl`` engine instead.
2870+
28462871
.. _io.excel_reader:
28472872

28482873
Reading Excel files

doc/source/user_guide/timeseries.rst

+28
Original file line numberDiff line numberDiff line change
@@ -1888,6 +1888,34 @@ Those two examples are equivalent for this time series:
18881888
18891889
Note the use of ``'start'`` for ``origin`` on the last example. In that case, ``origin`` will be set to the first value of the timeseries.
18901890

1891+
Backward resample
1892+
~~~~~~~~~~~~~~~~~
1893+
1894+
.. versionadded:: 1.3.0
1895+
1896+
Instead of adjusting the beginning of bins, sometimes we need to fix the end of the bins to make a backward resample with a given ``freq``. The backward resample sets ``closed`` to ``'right'`` by default since the last value should be considered as the edge point for the last bin.
1897+
1898+
We can set ``origin`` to ``'end'``. The value for a specific ``Timestamp`` index stands for the resample result from the current ``Timestamp`` minus ``freq`` to the current ``Timestamp`` with a right close.
1899+
1900+
.. ipython:: python
1901+
1902+
ts.resample('17min', origin='end').sum()
1903+
1904+
Besides, in contrast with the ``'start_day'`` option, ``end_day`` is supported. This will set the origin as the ceiling midnight of the largest ``Timestamp``.
1905+
1906+
.. ipython:: python
1907+
1908+
ts.resample('17min', origin='end_day').sum()
1909+
1910+
The above result uses ``2000-10-02 00:29:00`` as the last bin's right edge since the following computation.
1911+
1912+
.. ipython:: python
1913+
1914+
ceil_mid = rng.max().ceil('D')
1915+
freq = pd.offsets.Minute(17)
1916+
bin_res = ceil_mid - freq * ((ceil_mid - rng.max()) // freq)
1917+
bin_res
1918+
18911919
.. _timeseries.periods:
18921920

18931921
Time span representation

doc/source/whatsnew/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Version 1.2
2424
.. toctree::
2525
:maxdepth: 2
2626

27+
v1.2.1
2728
v1.2.0
2829

2930
Version 1.1

0 commit comments

Comments
 (0)