Skip to content

Commit 1fb9751

Browse files
committed
Merge branch 'master' of https://github.com/pandas-dev/pandas into BUG29751
2 parents 988ff30 + 5d745bc commit 1fb9751

File tree

117 files changed

+2585
-1541
lines changed

Some content is hidden

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

117 files changed

+2585
-1541
lines changed

.pre-commit-config.yaml

+2-4
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,9 @@ repos:
2020
types: [text]
2121
args: [--append-config=flake8/cython-template.cfg]
2222
- repo: https://github.com/PyCQA/isort
23-
rev: 5.6.4
23+
rev: 5.7.0
2424
hooks:
2525
- id: isort
26-
types: [text] # overwrite upstream `types: [python]`
27-
types_or: [python, cython]
2826
- repo: https://github.com/asottile/pyupgrade
2927
rev: v2.7.4
3028
hooks:
@@ -128,7 +126,7 @@ repos:
128126
entry: python scripts/validate_unwanted_patterns.py --validation-type="bare_pytest_raises"
129127
types: [python]
130128
files: ^pandas/tests/
131-
exclude: ^pandas/tests/(computation|extension|io)/
129+
exclude: ^pandas/tests/extension/
132130
- id: inconsistent-namespace-usage
133131
name: 'Check for inconsistent use of pandas namespace in tests'
134132
entry: python scripts/check_for_inconsistent_pandas_namespace.py

asv_bench/benchmarks/rolling.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -50,20 +50,24 @@ class Engine:
5050
["int", "float"],
5151
[np.sum, lambda x: np.sum(x) + 5],
5252
["cython", "numba"],
53+
["sum", "max", "min", "median", "mean"],
5354
)
54-
param_names = ["constructor", "dtype", "function", "engine"]
55+
param_names = ["constructor", "dtype", "function", "engine", "method"]
5556

56-
def setup(self, constructor, dtype, function, engine):
57+
def setup(self, constructor, dtype, function, engine, method):
5758
N = 10 ** 3
5859
arr = (100 * np.random.random(N)).astype(dtype)
5960
self.data = getattr(pd, constructor)(arr)
6061

61-
def time_rolling_apply(self, constructor, dtype, function, engine):
62+
def time_rolling_apply(self, constructor, dtype, function, engine, method):
6263
self.data.rolling(10).apply(function, raw=True, engine=engine)
6364

64-
def time_expanding_apply(self, constructor, dtype, function, engine):
65+
def time_expanding_apply(self, constructor, dtype, function, engine, method):
6566
self.data.expanding().apply(function, raw=True, engine=engine)
6667

68+
def time_rolling_methods(self, constructor, dtype, function, engine, method):
69+
getattr(self.data.rolling(10), method)(engine=engine)
70+
6771

6872
class ExpandingMethods:
6973

ci/deps/actions-37-locale.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies:
3030
- openpyxl
3131
- pandas-gbq
3232
- google-cloud-bigquery>=1.27.2 # GH 36436
33-
- pyarrow>=0.17
33+
- pyarrow=0.17 # GH 38803
3434
- pytables>=3.5.1
3535
- scipy
3636
- xarray=0.12.3
Loading
238 KB
Loading
67.5 KB
Loading
243 KB
Loading
68.5 KB
Loading

doc/source/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@
432432

433433

434434
ipython_warning_is_error = False
435-
ipython_exec_lines = [
435+
ipython_execlines = [
436436
"import numpy as np",
437437
"import pandas as pd",
438438
# This ensures correct rendering on system with console encoding != utf8

doc/source/development/contributing.rst

+6
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,12 @@ to run its checks with::
698698

699699
without needing to have done ``pre-commit install`` beforehand.
700700

701+
If you want to run checks on all recently commited files on upstream/master you can use::
702+
703+
pre-commit run --from-ref=upstream/master --to-ref=HEAD --all-files
704+
705+
without needing to have done ``pre-commit install`` beforehand.
706+
701707
.. note::
702708

703709
If you have conflicting installations of ``virtualenv``, then you may get an

doc/source/getting_started/comparison/comparison_with_sas.rst

+19-37
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,13 @@
44

55
Comparison with SAS
66
********************
7+
78
For potential users coming from `SAS <https://en.wikipedia.org/wiki/SAS_(software)>`__
89
this page is meant to demonstrate how different SAS operations would be
910
performed in pandas.
1011

1112
.. include:: includes/introduction.rst
1213

13-
.. note::
14-
15-
Throughout this tutorial, the pandas ``DataFrame`` will be displayed by calling
16-
``df.head()``, which displays the first N (default 5) rows of the ``DataFrame``.
17-
This is often used in interactive work (e.g. `Jupyter notebook
18-
<https://jupyter.org/>`_ or terminal) - the equivalent in SAS would be:
19-
20-
.. code-block:: sas
21-
22-
proc print data=df(obs=5);
23-
run;
2414

2515
Data structures
2616
---------------
@@ -120,7 +110,7 @@ The pandas method is :func:`read_csv`, which works similarly.
120110
"pandas/master/pandas/tests/io/data/csv/tips.csv"
121111
)
122112
tips = pd.read_csv(url)
123-
tips.head()
113+
tips
124114
125115
126116
Like ``PROC IMPORT``, ``read_csv`` can take a number of parameters to specify
@@ -138,6 +128,19 @@ In addition to text/csv, pandas supports a variety of other data formats
138128
such as Excel, HDF5, and SQL databases. These are all read via a ``pd.read_*``
139129
function. See the :ref:`IO documentation<io>` for more details.
140130

131+
Limiting output
132+
~~~~~~~~~~~~~~~
133+
134+
.. include:: includes/limit.rst
135+
136+
The equivalent in SAS would be:
137+
138+
.. code-block:: sas
139+
140+
proc print data=df(obs=5);
141+
run;
142+
143+
141144
Exporting data
142145
~~~~~~~~~~~~~~
143146

@@ -173,20 +176,8 @@ be used on new or existing columns.
173176
new_bill = total_bill / 2;
174177
run;
175178
176-
pandas provides similar vectorized operations by
177-
specifying the individual ``Series`` in the ``DataFrame``.
178-
New columns can be assigned in the same way.
179+
.. include:: includes/column_operations.rst
179180

180-
.. ipython:: python
181-
182-
tips["total_bill"] = tips["total_bill"] - 2
183-
tips["new_bill"] = tips["total_bill"] / 2.0
184-
tips.head()
185-
186-
.. ipython:: python
187-
:suppress:
188-
189-
tips = tips.drop("new_bill", axis=1)
190181

191182
Filtering
192183
~~~~~~~~~
@@ -278,18 +269,7 @@ drop, and rename columns.
278269
rename total_bill=total_bill_2;
279270
run;
280271
281-
The same operations are expressed in pandas below.
282-
283-
.. ipython:: python
284-
285-
# keep
286-
tips[["sex", "total_bill", "tip"]].head()
287-
288-
# drop
289-
tips.drop("sex", axis=1).head()
290-
291-
# rename
292-
tips.rename(columns={"total_bill": "total_bill_2"}).head()
272+
.. include:: includes/column_selection.rst
293273

294274

295275
Sorting by values
@@ -442,6 +422,8 @@ input frames.
442422
Missing data
443423
------------
444424

425+
Both pandas and SAS have a representation for missing data.
426+
445427
.. include:: includes/missing_intro.rst
446428

447429
One difference is that missing data cannot be compared to its sentinel value.

0 commit comments

Comments
 (0)