Skip to content

Commit 0d8cf0e

Browse files
Merge remote-tracking branch 'upstream/master' into pandas.io.sas.sasreader
2 parents 6c27421 + 50ae37d commit 0d8cf0e

File tree

565 files changed

+1553
-824
lines changed

Some content is hidden

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

565 files changed

+1553
-824
lines changed

RELEASE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ Release Notes
22
=============
33

44
The list of changes to Pandas between each release can be found
5-
[here](http://pandas.pydata.org/pandas-docs/stable/whatsnew.html). For full
5+
[here](https://pandas.pydata.org/pandas-docs/stable/whatsnew/index.html). For full
66
details, see the commit logs at http://github.com/pandas-dev/pandas.

asv_bench/asv.conf.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"project": "pandas",
88

99
// The project's homepage
10-
"project_url": "http://pandas.pydata.org/",
10+
"project_url": "https://pandas.pydata.org/",
1111

1212
// The URL of the source code repository for the project being
1313
// benchmarked

asv_bench/benchmarks/categoricals.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44

55
import pandas as pd
6-
import pandas.util.testing as tm
6+
import pandas._testing as tm
77

88
try:
99
from pandas.api.types import union_categoricals

asv_bench/benchmarks/ctors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33
from pandas import DatetimeIndex, Index, MultiIndex, Series, Timestamp
4-
import pandas.util.testing as tm
4+
import pandas._testing as tm
55

66

77
def no_change(arr):

asv_bench/benchmarks/frame_ctor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33
from pandas import DataFrame, MultiIndex, Series, Timestamp, date_range
4-
import pandas.util.testing as tm
4+
import pandas._testing as tm
55

66
try:
77
from pandas.tseries.offsets import Nano, Hour

asv_bench/benchmarks/frame_methods.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import numpy as np
55

66
from pandas import DataFrame, MultiIndex, NaT, Series, date_range, isnull, period_range
7-
import pandas.util.testing as tm
7+
import pandas._testing as tm
88

99

1010
class GetNumericData:

asv_bench/benchmarks/gil.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import numpy as np
22

33
from pandas import DataFrame, Series, date_range, factorize, read_csv
4+
import pandas._testing as tm
45
from pandas.core.algorithms import take_1d
5-
import pandas.util.testing as tm
66

77
try:
88
from pandas import (
@@ -24,7 +24,7 @@
2424
except ImportError:
2525
from pandas import algos
2626
try:
27-
from pandas.util.testing import test_parallel
27+
from pandas._testing import test_parallel
2828

2929
have_real_test_parallel = True
3030
except ImportError:

asv_bench/benchmarks/groupby.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
date_range,
1414
period_range,
1515
)
16-
import pandas.util.testing as tm
16+
import pandas._testing as tm
1717

1818
method_blacklist = {
1919
"object": {

asv_bench/benchmarks/index_object.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Series,
1313
date_range,
1414
)
15-
import pandas.util.testing as tm
15+
import pandas._testing as tm
1616

1717

1818
class SetOperations:

asv_bench/benchmarks/indexing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
option_context,
1818
period_range,
1919
)
20-
import pandas.util.testing as tm
20+
import pandas._testing as tm
2121

2222

2323
class NumericSeriesIndexing:

asv_bench/benchmarks/inference.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33
from pandas import DataFrame, Series, to_numeric
4-
import pandas.util.testing as tm
4+
import pandas._testing as tm
55

66
from .pandas_vb_common import lib, numeric_dtypes
77

asv_bench/benchmarks/io/csv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import numpy as np
66

77
from pandas import Categorical, DataFrame, date_range, read_csv, to_datetime
8-
import pandas.util.testing as tm
8+
import pandas._testing as tm
99

1010
from ..pandas_vb_common import BaseIO
1111

asv_bench/benchmarks/io/excel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from odf.text import P
77

88
from pandas import DataFrame, ExcelWriter, date_range, read_excel
9-
import pandas.util.testing as tm
9+
import pandas._testing as tm
1010

1111

1212
def _generate_dataframe():

asv_bench/benchmarks/io/hdf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33
from pandas import DataFrame, HDFStore, date_range, read_hdf
4-
import pandas.util.testing as tm
4+
import pandas._testing as tm
55

66
from ..pandas_vb_common import BaseIO
77

asv_bench/benchmarks/io/json.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33
from pandas import DataFrame, concat, date_range, read_json, timedelta_range
4-
import pandas.util.testing as tm
4+
import pandas._testing as tm
55

66
from ..pandas_vb_common import BaseIO
77

asv_bench/benchmarks/io/pickle.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33
from pandas import DataFrame, date_range, read_pickle
4-
import pandas.util.testing as tm
4+
import pandas._testing as tm
55

66
from ..pandas_vb_common import BaseIO
77

asv_bench/benchmarks/io/sql.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from sqlalchemy import create_engine
55

66
from pandas import DataFrame, date_range, read_sql_query, read_sql_table
7-
import pandas.util.testing as tm
7+
import pandas._testing as tm
88

99

1010
class SQL:

asv_bench/benchmarks/io/stata.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33
from pandas import DataFrame, date_range, read_stata
4-
import pandas.util.testing as tm
4+
import pandas._testing as tm
55

66
from ..pandas_vb_common import BaseIO
77

asv_bench/benchmarks/join_merge.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44

55
from pandas import DataFrame, MultiIndex, Series, concat, date_range, merge, merge_asof
6-
import pandas.util.testing as tm
6+
import pandas._testing as tm
77

88
try:
99
from pandas import merge_ordered

asv_bench/benchmarks/multiindex_object.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44

55
from pandas import DataFrame, MultiIndex, RangeIndex, date_range
6-
import pandas.util.testing as tm
6+
import pandas._testing as tm
77

88

99
class GetLoc:

asv_bench/benchmarks/reindex.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import numpy as np
22

33
from pandas import DataFrame, Index, MultiIndex, Series, date_range, period_range
4-
import pandas.util.testing as tm
4+
import pandas._testing as tm
55

66
from .pandas_vb_common import lib
77

asv_bench/benchmarks/series_methods.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44

55
from pandas import NaT, Series, date_range
6-
import pandas.util.testing as tm
6+
import pandas._testing as tm
77

88

99
class SeriesConstructor:

asv_bench/benchmarks/strings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import numpy as np
44

55
from pandas import DataFrame, Series
6-
import pandas.util.testing as tm
6+
import pandas._testing as tm
77

88

99
class Methods:

ci/code_checks.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
139139
RET=$(($RET + $?)) ; echo $MSG "DONE"
140140

141141
# Checks for test suite
142-
# Check for imports from pandas.util.testing instead of `import pandas.util.testing as tm`
143-
invgrep -R --include="*.py*" -E "from pandas.util.testing import" pandas/tests
142+
# Check for imports from pandas._testing instead of `import pandas._testing as tm`
143+
invgrep -R --include="*.py*" -E "from pandas._testing import" pandas/tests
144144
RET=$(($RET + $?)) ; echo $MSG "DONE"
145145
invgrep -R --include="*.py*" -E "from pandas.util import testing as tm" pandas/tests
146146
RET=$(($RET + $?)) ; echo $MSG "DONE"

conda.recipe/meta.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ test:
3636

3737

3838
about:
39-
home: http://pandas.pydata.org
39+
home: https://pandas.pydata.org
4040
license: BSD

doc/source/development/code_style.rst

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
.. _code_style:
2+
3+
{{ header }}
4+
5+
=======================
6+
pandas code style guide
7+
=======================
8+
9+
.. contents:: Table of contents:
10+
:local:
11+
12+
Patterns
13+
========
14+
15+
foo.__class__
16+
-------------
17+
18+
*pandas* uses 'type(foo)' instead 'foo.__class__' as it is making the code more
19+
readable.
20+
21+
For example:
22+
23+
**Good:**
24+
25+
.. code-block:: python
26+
27+
foo = "bar"
28+
type(foo)
29+
30+
**Bad:**
31+
32+
.. code-block:: python
33+
34+
foo = "bar"
35+
foo.__class__
36+
37+
38+
String formatting
39+
=================
40+
41+
Concatenated strings
42+
--------------------
43+
44+
f-strings
45+
~~~~~~~~~
46+
47+
*pandas* uses f-strings formatting instead of '%' and '.format()' string formatters.
48+
49+
The convention of using f-strings on a string that is concatenated over serveral lines,
50+
is to prefix only the lines containing the value needs to be interpeted.
51+
52+
For example:
53+
54+
**Good:**
55+
56+
.. code-block:: python
57+
58+
foo = "old_function"
59+
bar = "new_function"
60+
61+
my_warning_message = (
62+
f"Warning, {foo} is deprecated, "
63+
"please use the new and way better "
64+
f"{bar}"
65+
)
66+
67+
**Bad:**
68+
69+
.. code-block:: python
70+
71+
foo = "old_function"
72+
bar = "new_function"
73+
74+
my_warning_message = (
75+
f"Warning, {foo} is deprecated, "
76+
f"please use the new and way better "
77+
f"{bar}"
78+
)
79+
80+
White spaces
81+
~~~~~~~~~~~~
82+
83+
Putting the white space only at the end of the previous line, so
84+
there is no whitespace at the beggining of the concatenated string.
85+
86+
For example:
87+
88+
**Good:**
89+
90+
.. code-block:: python
91+
92+
example_string = (
93+
"Some long concatenated string, "
94+
"with good placement of the "
95+
"whitespaces"
96+
)
97+
98+
**Bad:**
99+
100+
.. code-block:: python
101+
102+
example_string = (
103+
"Some long concatenated string,"
104+
" with bad placement of the"
105+
" whitespaces"
106+
)
107+
108+
Representation function (aka 'repr()')
109+
--------------------------------------
110+
111+
*pandas* uses 'repr()' instead of '%r' and '!r'.
112+
113+
The use of 'repr()' will only happend when the value is not an obvious string.
114+
115+
For example:
116+
117+
**Good:**
118+
119+
.. code-block:: python
120+
121+
value = str
122+
f"Unknown recived value, got: {repr(value)}"
123+
124+
**Good:**
125+
126+
.. code-block:: python
127+
128+
value = str
129+
f"Unknown recived type, got: '{type(value).__name__}'"

doc/source/development/contributing.rst

+4-5
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ The utility script ``scripts/validate_docstrings.py`` can be used to get a csv
434434
summary of the API documentation. And also validate common errors in the docstring
435435
of a specific class, function or method. The summary also compares the list of
436436
methods documented in ``doc/source/api.rst`` (which is used to generate
437-
the `API Reference <http://pandas.pydata.org/pandas-docs/stable/api.html>`_ page)
437+
the `API Reference <https://pandas.pydata.org/pandas-docs/stable/api.html>`_ page)
438438
and the actual public methods.
439439
This will identify methods documented in ``doc/source/api.rst`` that are not actually
440440
class methods, and existing methods that are not documented in ``doc/source/api.rst``.
@@ -569,8 +569,7 @@ do not make sudden changes to the code that could have the potential to break
569569
a lot of user code as a result, that is, we need it to be as *backwards compatible*
570570
as possible to avoid mass breakages.
571571

572-
Additional standards are outlined on the `code style wiki
573-
page <https://github.com/pandas-dev/pandas/wiki/Code-Style-and-Conventions>`_.
572+
Additional standards are outlined on the `pandas code style guide <code_style>`_
574573

575574
Optional dependencies
576575
---------------------
@@ -957,7 +956,7 @@ inspiration. If your test requires working with files or
957956
network connectivity, there is more information on the `testing page
958957
<https://github.com/pandas-dev/pandas/wiki/Testing>`_ of the wiki.
959958

960-
The ``pandas.util.testing`` module has many special ``assert`` functions that
959+
The ``pandas._testing`` module has many special ``assert`` functions that
961960
make it easier to make statements about whether Series or DataFrame objects are
962961
equivalent. The easiest way to verify that your code is correct is to
963962
explicitly construct the result you expect, then compare the actual result to
@@ -1143,7 +1142,7 @@ If your change involves checking that a warning is actually emitted, use
11431142

11441143
.. code-block:: python
11451144
1146-
import pandas.util.testing as tm
1145+
import pandas._testing as tm
11471146
11481147
11491148
df = pd.DataFrame()

0 commit comments

Comments
 (0)