Skip to content

Commit 012eac8

Browse files
committed
Merge and fix conflict
1 parent fb77182 commit 012eac8

25 files changed

+118
-128
lines changed

ci/code_checks.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ fi
241241
### DOCSTRINGS ###
242242
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
243243

244-
MSG='Validate docstrings (GL06, GL07, GL09, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT04, RT05, SA05)' ; echo $MSG
245-
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL06,GL07,GL09,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT04,RT05,SA05
244+
MSG='Validate docstrings (GL03, GL06, GL07, GL09, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT04, RT05, SA05)' ; echo $MSG
245+
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL03,GL06,GL07,GL09,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT04,RT05,SA05
246246
RET=$(($RET + $?)) ; echo $MSG "DONE"
247247

248248
fi

doc/source/whatsnew/v0.25.0.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Performance Improvements
131131
Bug Fixes
132132
~~~~~~~~~
133133
- Bug in :func:`to_datetime` which would raise an (incorrect) ``ValueError`` when called with a date far into the future and the ``format`` argument specified instead of raising ``OutOfBoundsDatetime`` (:issue:`23830`)
134-
-
134+
- Bug in an error message in :meth:`DataFrame.plot`. Improved the error message if non-numerics are passed to :meth:`DataFrame.plot` (:issue:`25481`)
135135
-
136136

137137
Categorical
@@ -224,7 +224,7 @@ I/O
224224
- Bug in :func:`read_json` for ``orient='table'`` when it tries to infer dtypes by default, which is not applicable as dtypes are already defined in the JSON schema (:issue:`21345`)
225225
- Bug in :func:`read_json` for ``orient='table'`` and float index, as it infers index dtype by default, which is not applicable because index dtype is already defined in the JSON schema (:issue:`25433`)
226226
- Bug in :func:`read_json` for ``orient='table'`` and string of float column names, as it makes a column name type conversion to Timestamp, which is not applicable because column names are already defined in the JSON schema (:issue:`25435`)
227-
-
227+
- :meth:`DataFrame.to_html` now raises ``TypeError`` when using an invalid type for the ``classes`` parameter instead of ``AsseertionError`` (:issue:`25608`)
228228
-
229229
-
230230

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1156,7 +1156,6 @@ class Timedelta(_Timedelta):
11561156
Notes
11571157
-----
11581158
The ``.value`` attribute is always in ns.
1159-
11601159
"""
11611160
def __new__(cls, object value=_no_input, unit=None, **kwargs):
11621161
cdef _Timedelta td_base

pandas/core/arrays/datetimes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def f(self):
119119
return result
120120

121121
f.__name__ = name
122-
f.__doc__ = "\n{}\n".format(docstring)
122+
f.__doc__ = docstring
123123
return property(f)
124124

125125

pandas/core/arrays/sparse.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,6 @@ class SparseArray(PandasObject, ExtensionArray, ExtensionOpsMixin):
541541
3. ``data.dtype.fill_value`` if `fill_value` is None and `dtype`
542542
is not a ``SparseDtype`` and `data` is a ``SparseArray``.
543543
544-
545544
kind : {'integer', 'block'}, default 'integer'
546545
The type of storage for sparse locations.
547546

pandas/core/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,6 @@ def to_numpy(self, dtype=None, copy=False):
870870
871871
.. versionadded:: 0.24.0
872872
873-
874873
Parameters
875874
----------
876875
dtype : str or numpy.dtype, optional

pandas/core/config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,6 @@ def _build_option_description(k):
651651
.format(rkey=d.rkey if d.rkey else ''))
652652
s += u(')')
653653

654-
s += '\n\n'
655654
return s
656655

657656

pandas/core/frame.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,7 +2184,6 @@ def to_html(self, buf=None, columns=None, col_space=None, header=True,
21842184
Convert URLs to HTML links.
21852185
21862186
.. versionadded:: 0.24.0
2187-
21882187
%(returns)s
21892188
See Also
21902189
--------
@@ -6027,7 +6026,6 @@ def unstack(self, level=-1, fill_value=None):
60276026
columns, considered measured variables (`value_vars`), are "unpivoted" to
60286027
the row axis, leaving just two non-identifier columns, 'variable' and
60296028
'value'.
6030-
60316029
%(versionadded)s
60326030
Parameters
60336031
----------

pandas/core/generic.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,6 @@ def swaplevel(self, i=-2, j=-1, axis=0):
948948
949949
The indexes ``i`` and ``j`` are now optional, and default to
950950
the two innermost levels of the index.
951-
952951
"""
953952
axis = self._get_axis_number(axis)
954953
result = self.copy()
@@ -4951,9 +4950,7 @@ def pipe(self, func, *args, **kwargs):
49514950

49524951
_shared_docs['aggregate'] = dedent("""
49534952
Aggregate using one or more operations over the specified axis.
4954-
49554953
%(versionadded)s
4956-
49574954
Parameters
49584955
----------
49594956
func : function, str, list or dict
@@ -4983,17 +4980,13 @@ def pipe(self, func, *args, **kwargs):
49834980
* DataFrame : when DataFrame.agg is called with several functions
49844981
49854982
Return scalar, Series or DataFrame.
4986-
49874983
%(see_also)s
4988-
49894984
Notes
49904985
-----
49914986
`agg` is an alias for `aggregate`. Use the alias.
49924987
49934988
A passed user-defined-function will be passed a Series for evaluation.
4994-
4995-
%(examples)s
4996-
""")
4989+
%(examples)s""")
49974990

49984991
_shared_docs['transform'] = ("""
49994992
Call ``func`` on self producing a %(klass)s with transformed values
@@ -10307,7 +10300,7 @@ def _doc_parms(cls):
1030710300
1030810301
Returns
1030910302
-------
10310-
%(name1)s or %(name2)s (if level specified)
10303+
%(name1)s or %(name2)s (if level specified)\
1031110304
%(see_also)s
1031210305
%(examples)s\
1031310306
"""
@@ -10464,8 +10457,7 @@ def _doc_parms(cls):
1046410457
%(name2)s.cumsum : Return cumulative sum over %(name2)s axis.
1046510458
%(name2)s.cumprod : Return cumulative product over %(name2)s axis.
1046610459
10467-
%(examples)s
10468-
"""
10460+
%(examples)s"""
1046910461

1047010462
_cummin_examples = """\
1047110463
Examples

pandas/core/groupby/base.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,7 @@ class where members are defined.
126126
property_wrapper_template = \
127127
"""@property
128128
def %(name)s(self) :
129-
\"""
130-
%(doc)s
131-
\"""
129+
\"""%(doc)s\"""
132130
return self.__getattr__('%(name)s')"""
133131

134132
for name in whitelist:

pandas/core/groupby/groupby.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,7 @@ class providing the base-class of operations.
221221
222222
Examples
223223
--------
224-
%(examples)s
225-
"""
224+
%(examples)s"""
226225

227226
_transform_template = """
228227
Call function producing a like-indexed %(klass)s on each group and
@@ -1106,9 +1105,7 @@ def mean(self, *args, **kwargs):
11061105
Returns
11071106
-------
11081107
pandas.Series or pandas.DataFrame
1109-
11101108
%(see_also)s
1111-
11121109
Examples
11131110
--------
11141111
>>> df = pd.DataFrame({'A': [1, 1, 2, 1, 2],
@@ -1564,9 +1561,7 @@ def nth(self, n, dropna=None):
15641561
dropna : None or str, optional
15651562
apply the specified dropna operation before counting which row is
15661563
the nth row. Needs to be None, 'any' or 'all'
1567-
15681564
%(see_also)s
1569-
15701565
Examples
15711566
--------
15721567
@@ -2139,9 +2134,7 @@ def head(self, n=5):
21392134
21402135
Essentially equivalent to ``.apply(lambda x: x.head(n))``,
21412136
except ignores as_index flag.
2142-
21432137
%(see_also)s
2144-
21452138
Examples
21462139
--------
21472140
@@ -2167,9 +2160,7 @@ def tail(self, n=5):
21672160
21682161
Essentially equivalent to ``.apply(lambda x: x.tail(n))``,
21692162
except ignores as_index flag.
2170-
21712163
%(see_also)s
2172-
21732164
Examples
21742165
--------
21752166

pandas/core/indexes/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3104,7 +3104,6 @@ def reindex(self, target, method=None, level=None, limit=None,
31043104
Resulting index.
31053105
indexer : np.ndarray or None
31063106
Indices of output values in original index.
3107-
31083107
"""
31093108
# GH6552: preserve names when reindexing to non-named target
31103109
# (i.e. neither Index nor Series).

pandas/io/feather_format.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ def read_feather(path, columns=None, use_threads=True):
110110
Returns
111111
-------
112112
type of object stored in file
113-
114113
"""
115114

116115
feather, pyarrow = _try_import()

pandas/io/formats/html.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ def _write_table(self, indent=0):
163163
if isinstance(self.classes, str):
164164
self.classes = self.classes.split()
165165
if not isinstance(self.classes, (list, tuple)):
166-
raise AssertionError('classes must be list or tuple, not {typ}'
167-
.format(typ=type(self.classes)))
166+
raise TypeError('classes must be a string, list, or tuple, '
167+
'not {typ}'.format(typ=type(self.classes)))
168168
_classes.extend(self.classes)
169169

170170
if self.table_id is None:

pandas/plotting/_core.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,9 @@ def _compute_plot_data(self):
361361
except AttributeError:
362362
is_empty = not len(numeric_data)
363363

364-
# no empty frames or series allowed
364+
# no non-numeric frames or series allowed
365365
if is_empty:
366-
raise TypeError('Empty {0!r}: no numeric data to '
367-
'plot'.format(numeric_data.__class__.__name__))
366+
raise TypeError('no numeric data to plot')
368367

369368
self.data = numeric_data
370369

pandas/plotting/_misc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ def andrews_curves(frame, class_column, ax=None, samples=200, color=None,
303303
Returns
304304
-------
305305
class:`matplotlip.axis.Axes`
306-
307306
"""
308307
from math import sqrt, pi
309308
import matplotlib.pyplot as plt

pandas/tests/frame/test_asof.py

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@
66
from pandas import DataFrame, Series, Timestamp, date_range, to_datetime
77
import pandas.util.testing as tm
88

9-
from .common import TestData
109

10+
@pytest.fixture
11+
def date_range_frame():
12+
"""
13+
Fixture for DataFrame of ints with date_range index
1114
12-
class TestFrameAsof(TestData):
13-
def setup_method(self, method):
14-
self.N = N = 50
15-
self.rng = date_range('1/1/1990', periods=N, freq='53s')
16-
self.df = DataFrame({'A': np.arange(N), 'B': np.arange(N)},
17-
index=self.rng)
15+
Columns are ['A', 'B'].
16+
"""
17+
N = 50
18+
rng = date_range('1/1/1990', periods=N, freq='53s')
19+
return DataFrame({'A': np.arange(N), 'B': np.arange(N)}, index=rng)
1820

19-
def test_basic(self):
20-
df = self.df.copy()
21+
22+
class TestFrameAsof():
23+
24+
def test_basic(self, date_range_frame):
25+
df = date_range_frame
26+
N = 50
2127
df.loc[15:30, 'A'] = np.nan
22-
dates = date_range('1/1/1990', periods=self.N * 3,
23-
freq='25s')
28+
dates = date_range('1/1/1990', periods=N * 3, freq='25s')
2429

2530
result = df.asof(dates)
2631
assert result.notna().all(1).all()
@@ -35,11 +40,9 @@ def test_basic(self):
3540
rs = result[mask]
3641
assert (rs == 14).all(1).all()
3742

38-
def test_subset(self):
43+
def test_subset(self, date_range_frame):
3944
N = 10
40-
rng = date_range('1/1/1990', periods=N, freq='53s')
41-
df = DataFrame({'A': np.arange(N), 'B': np.arange(N)},
42-
index=rng)
45+
df = date_range_frame.iloc[:N].copy()
4346
df.loc[4:8, 'A'] = np.nan
4447
dates = date_range('1/1/1990', periods=N * 3,
4548
freq='25s')
@@ -54,20 +57,18 @@ def test_subset(self):
5457
expected = df.asof(dates)
5558
tm.assert_frame_equal(result, expected)
5659

57-
# B gives self.df.asof
60+
# B gives df.asof
5861
result = df.asof(dates, subset='B')
5962
expected = df.resample('25s', closed='right').ffill().reindex(dates)
6063
expected.iloc[20:] = 9
6164

6265
tm.assert_frame_equal(result, expected)
6366

64-
def test_missing(self):
67+
def test_missing(self, date_range_frame):
6568
# GH 15118
6669
# no match found - `where` value before earliest date in index
6770
N = 10
68-
rng = date_range('1/1/1990', periods=N, freq='53s')
69-
df = DataFrame({'A': np.arange(N), 'B': np.arange(N)},
70-
index=rng)
71+
df = date_range_frame.iloc[:N].copy()
7172
result = df.asof('1989-12-31')
7273

7374
expected = Series(index=['A', 'B'], name=Timestamp('1989-12-31'))
@@ -78,22 +79,24 @@ def test_missing(self):
7879
columns=['A', 'B'], dtype='float64')
7980
tm.assert_frame_equal(result, expected)
8081

81-
def test_all_nans(self):
82+
def test_all_nans(self, date_range_frame):
8283
# GH 15713
8384
# DataFrame is all nans
8485
result = DataFrame([np.nan]).asof([0])
8586
expected = DataFrame([np.nan])
8687
tm.assert_frame_equal(result, expected)
8788

8889
# testing non-default indexes, multiple inputs
89-
dates = date_range('1/1/1990', periods=self.N * 3, freq='25s')
90-
result = DataFrame(np.nan, index=self.rng, columns=['A']).asof(dates)
90+
N = 150
91+
rng = date_range_frame.index
92+
dates = date_range('1/1/1990', periods=N, freq='25s')
93+
result = DataFrame(np.nan, index=rng, columns=['A']).asof(dates)
9194
expected = DataFrame(np.nan, index=dates, columns=['A'])
9295
tm.assert_frame_equal(result, expected)
9396

9497
# testing multiple columns
95-
dates = date_range('1/1/1990', periods=self.N * 3, freq='25s')
96-
result = DataFrame(np.nan, index=self.rng,
98+
dates = date_range('1/1/1990', periods=N, freq='25s')
99+
result = DataFrame(np.nan, index=rng,
97100
columns=['A', 'B', 'C']).asof(dates)
98101
expected = DataFrame(np.nan, index=dates, columns=['A', 'B', 'C'])
99102
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)