diff --git a/environment.yml b/environment.yml index ff7c5d56052d2..41f013c52041c 100644 --- a/environment.yml +++ b/environment.yml @@ -19,7 +19,7 @@ dependencies: - hypothesis>=3.82 - isort - moto - - pycodestyle=2.4 + - pycodestyle - pytest>=4.0.2 - pytest-mock - sphinx diff --git a/pandas/_libs/__init__.py b/pandas/_libs/__init__.py index b02c423b79f43..7650baed09ad7 100644 --- a/pandas/_libs/__init__.py +++ b/pandas/_libs/__init__.py @@ -2,4 +2,4 @@ # flake8: noqa from .tslibs import ( - iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime, Period) + iNaT, NaT, NaTType, Timestamp, Timedelta, OutOfBoundsDatetime, Period) diff --git a/pandas/_libs/tslibs/__init__.py b/pandas/_libs/tslibs/__init__.py index 38401cab57f5d..a21fdf95559e6 100644 --- a/pandas/_libs/tslibs/__init__.py +++ b/pandas/_libs/tslibs/__init__.py @@ -2,7 +2,7 @@ # flake8: noqa from .conversion import normalize_date, localize_pydatetime, tz_convert_single -from .nattype import NaT, iNaT, is_null_datetimelike +from .nattype import NaT, NaTType, iNaT, is_null_datetimelike from .np_datetime import OutOfBoundsDatetime from .period import Period, IncompatibleFrequency from .timestamps import Timestamp diff --git a/pandas/_libs/tslibs/nattype.pyx b/pandas/_libs/tslibs/nattype.pyx index 79e2e256c501d..e71f7dfe8b8ce 100644 --- a/pandas/_libs/tslibs/nattype.pyx +++ b/pandas/_libs/tslibs/nattype.pyx @@ -353,7 +353,7 @@ class NaTType(_NaT): .. versionadded:: 0.23.0 """) - day_name = _make_nan_func('day_name', # noqa:E128 + day_name = _make_nan_func('day_name', # noqa:E128 """ Return the day name of the Timestamp with specified locale. diff --git a/pandas/core/arrays/array_.py b/pandas/core/arrays/array_.py index 41d623c7efd9c..254ab876af1ac 100644 --- a/pandas/core/arrays/array_.py +++ b/pandas/core/arrays/array_.py @@ -1,8 +1,12 @@ +from typing import Optional, Sequence, Union + +import numpy as np + from pandas._libs import lib, tslibs from pandas.core.dtypes.common import ( is_datetime64_ns_dtype, is_extension_array_dtype, is_timedelta64_ns_dtype) -from pandas.core.dtypes.dtypes import registry +from pandas.core.dtypes.dtypes import ExtensionDtype, registry from pandas import compat diff --git a/pandas/core/arrays/base.py b/pandas/core/arrays/base.py index e770281596134..f7d427ce26e6a 100644 --- a/pandas/core/arrays/base.py +++ b/pandas/core/arrays/base.py @@ -6,6 +6,7 @@ without warning. """ import operator +from typing import Any, Callable, Optional, Sequence, Tuple, Union import numpy as np @@ -15,6 +16,7 @@ from pandas.util._decorators import Appender, Substitution from pandas.core.dtypes.common import is_list_like +from pandas.core.dtypes.dtypes import ExtensionDtype from pandas.core.dtypes.generic import ABCIndexClass, ABCSeries from pandas.core.dtypes.missing import isna @@ -365,7 +367,7 @@ def isna(self): raise AbstractMethodError(self) def _values_for_argsort(self): - # type: () -> ndarray + # type: () -> np.ndarray """ Return values for sorting. @@ -597,7 +599,7 @@ def searchsorted(self, value, side="left", sorter=None): return arr.searchsorted(value, side=side, sorter=sorter) def _values_for_factorize(self): - # type: () -> Tuple[ndarray, Any] + # type: () -> Tuple[np.ndarray, Any] """ Return an array and missing value suitable for factorization. @@ -622,7 +624,7 @@ def _values_for_factorize(self): return self.astype(object), np.nan def factorize(self, na_sentinel=-1): - # type: (int) -> Tuple[ndarray, ExtensionArray] + # type: (int) -> Tuple[np.ndarray, ExtensionArray] """ Encode the extension array as an enumerated type. diff --git a/pandas/core/arrays/datetimelike.py b/pandas/core/arrays/datetimelike.py index 94668c74c1693..27d7d4f888550 100644 --- a/pandas/core/arrays/datetimelike.py +++ b/pandas/core/arrays/datetimelike.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- from datetime import datetime, timedelta import operator +from typing import Any, Sequence, Tuple, Union import warnings import numpy as np -from pandas._libs import NaT, algos, iNaT, lib +from pandas._libs import NaT, NaTType, Timestamp, algos, iNaT, lib from pandas._libs.tslibs.period import ( DIFFERENT_FREQ, IncompatibleFrequency, Period) from pandas._libs.tslibs.timedeltas import Timedelta, delta_to_nanoseconds @@ -350,7 +351,7 @@ def __iter__(self): @property def asi8(self): - # type: () -> ndarray + # type: () -> np.ndarray """ Integer representation of the values. @@ -461,10 +462,10 @@ def __getitem__(self, key): def __setitem__( self, key, # type: Union[int, Sequence[int], Sequence[bool], slice] - value, # type: Union[NaTType, Scalar, Sequence[Scalar]] + value, # type: Union[NaTType, Any, Sequence[Any]] ): # type: (...) -> None - # I'm fudging the types a bit here. The "Scalar" above really depends + # I'm fudging the types a bit here. "Any" above really depends # on type(self). For PeriodArray, it's Period (or stuff coercible # to a period in from_sequence). For DatetimeArray, it's Timestamp... # I don't know if mypy can do that, possibly with Generics. diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index 89f2b9961a4d7..33e6674389e7c 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from datetime import datetime, time, timedelta import textwrap +from typing import Union import warnings import numpy as np diff --git a/pandas/core/arrays/integer.py b/pandas/core/arrays/integer.py index fd90aec3b5e8c..0144d04c6e197 100644 --- a/pandas/core/arrays/integer.py +++ b/pandas/core/arrays/integer.py @@ -510,7 +510,7 @@ def value_counts(self, dropna=True): return Series(array, index=index) def _values_for_argsort(self): - # type: () -> ndarray + # type: () -> np.ndarray """Return values for sorting. Returns diff --git a/pandas/core/arrays/period.py b/pandas/core/arrays/period.py index 0ec1bc7a84231..c12e019da1d8d 100644 --- a/pandas/core/arrays/period.py +++ b/pandas/core/arrays/period.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- from datetime import timedelta import operator +from typing import Any, Callable, Optional, Sequence, Union import numpy as np from pandas._libs.tslibs import ( - NaT, frequencies as libfrequencies, iNaT, period as libperiod) + NaT, NaTType, frequencies as libfrequencies, iNaT, period as libperiod) from pandas._libs.tslibs.fields import isleapyear_arr from pandas._libs.tslibs.period import ( DIFFERENT_FREQ, IncompatibleFrequency, Period, get_period_field_arr, @@ -23,7 +24,7 @@ from pandas.core.dtypes.missing import isna, notna import pandas.core.algorithms as algos -from pandas.core.arrays import datetimelike as dtl +from pandas.core.arrays import ExtensionArray, datetimelike as dtl import pandas.core.common as com from pandas.tseries import frequencies @@ -536,11 +537,14 @@ def _sub_period(self, other): @Appender(dtl.DatetimeLikeArrayMixin._addsub_int_array.__doc__) def _addsub_int_array( self, - other, # type: Union[Index, ExtensionArray, np.ndarray[int]] - op # type: Callable[Any, Any] + other, # type: Union[ExtensionArray, np.ndarray[int]] + op # type: Callable[Any, Any] ): # type: (...) -> PeriodArray + # TODO: ABCIndexClass is a valid type for other but had to be excluded + # due to length of Py2 compatability comment; add back in once migrated + # to Py3 syntax assert op in [operator.add, operator.sub] if op is operator.sub: other = -other diff --git a/pandas/core/arrays/sparse.py b/pandas/core/arrays/sparse.py index fd7149edc8d7c..8a4422120b7a3 100644 --- a/pandas/core/arrays/sparse.py +++ b/pandas/core/arrays/sparse.py @@ -6,13 +6,14 @@ import numbers import operator import re +from typing import Any, Callable, Union import warnings import numpy as np from pandas._libs import index as libindex, lib import pandas._libs.sparse as splib -from pandas._libs.sparse import BlockIndex, IntIndex +from pandas._libs.sparse import BlockIndex, IntIndex, SparseIndex from pandas._libs.tslibs import NaT import pandas.compat as compat from pandas.compat.numpy import function as nv @@ -372,7 +373,7 @@ def _subtype_with_str(self): def _get_fill(arr): - # type: (SparseArray) -> ndarray + # type: (SparseArray) -> np.ndarray """ Create a 0-dim ndarray containing the fill value diff --git a/pandas/core/base.py b/pandas/core/base.py index 9fc950b9e7b43..ce91c232bb92d 100644 --- a/pandas/core/base.py +++ b/pandas/core/base.py @@ -24,6 +24,7 @@ from pandas.core import algorithms, common as com from pandas.core.accessor import DirNamesMixin +from pandas.core.arrays import ExtensionArray import pandas.core.nanops as nanops _shared_docs = dict() diff --git a/pandas/core/common.py b/pandas/core/common.py index 5b83cb344b1e7..77b7b94e7a1f7 100644 --- a/pandas/core/common.py +++ b/pandas/core/common.py @@ -9,6 +9,7 @@ from datetime import datetime, timedelta from functools import partial import inspect +from typing import Any import numpy as np diff --git a/pandas/core/dtypes/base.py b/pandas/core/dtypes/base.py index 88bbdcf342d66..8269f8c88ffd3 100644 --- a/pandas/core/dtypes/base.py +++ b/pandas/core/dtypes/base.py @@ -1,4 +1,6 @@ """Extend pandas with custom array types""" +from typing import List, Optional, Type + import numpy as np from pandas.errors import AbstractMethodError @@ -211,7 +213,7 @@ def __str__(self): @property def type(self): - # type: () -> type + # type: () -> Type """ The scalar type for the array, e.g. ``int`` diff --git a/pandas/core/dtypes/dtypes.py b/pandas/core/dtypes/dtypes.py index 11a132c4d14ee..b3d46b7dc76a6 100644 --- a/pandas/core/dtypes/dtypes.py +++ b/pandas/core/dtypes/dtypes.py @@ -937,7 +937,7 @@ def construct_from_string(cls, string): if (string.lower() == 'interval' or cls._match.search(string) is not None): - return cls(string) + return cls(string) msg = ('Incorrectly formatted string passed to constructor. ' 'Valid formats include Interval or Interval[dtype] ' diff --git a/pandas/core/frame.py b/pandas/core/frame.py index b75680a2b48ef..b4f15905afc44 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -19,6 +19,7 @@ import sys import warnings from textwrap import dedent +from typing import List, Union import numpy as np import numpy.ma as ma diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index 3d0a6023ac29f..96eafbfae2cdb 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -12,6 +12,7 @@ class providing the base-class of operations. import datetime from functools import partial, wraps import types +from typing import Optional, Type import warnings import numpy as np @@ -1040,7 +1041,7 @@ def _bool_agg(self, val_test, skipna): """ def objs_to_bool(vals): - # type: (np.ndarray) -> (np.ndarray, typing.Type) + # type: (np.ndarray) -> (np.ndarray, Type) if is_object_dtype(vals): vals = np.array([bool(x) for x in vals]) else: @@ -1049,7 +1050,7 @@ def objs_to_bool(vals): return vals.view(np.uint8), np.bool def result_to_bool(result, inference): - # type: (np.ndarray, typing.Type) -> np.ndarray + # type: (np.ndarray, Type) -> np.ndarray return result.astype(inference, copy=False) return self._get_cythonized_result('group_any_all', self.grouper, @@ -1738,7 +1739,7 @@ def quantile(self, q=0.5, interpolation='linear'): """ def pre_processor(vals): - # type: (np.ndarray) -> (np.ndarray, Optional[typing.Type]) + # type: (np.ndarray) -> (np.ndarray, Optional[Type]) if is_object_dtype(vals): raise TypeError("'quantile' cannot be performed against " "'object' dtypes!") @@ -1753,7 +1754,7 @@ def pre_processor(vals): return vals, inference def post_processor(vals, inference): - # type: (np.ndarray, Optional[typing.Type]) -> np.ndarray + # type: (np.ndarray, Optional[Type]) -> np.ndarray if inference: # Check for edge case if not (is_integer_dtype(inference) and @@ -2016,7 +2017,7 @@ def _get_cythonized_result(self, how, grouper, aggregate=False, Function to be applied to result of Cython function. Should accept an array of values as the first argument and type inferences as its second argument, i.e. the signature should be - (ndarray, typing.Type). + (ndarray, Type). **kwargs : dict Extra arguments to be passed back to Cython funcs diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 29b9a47a92a48..f6d7d27eca598 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -1,6 +1,7 @@ from datetime import datetime, timedelta import operator from textwrap import dedent +from typing import Union import warnings import numpy as np diff --git a/pandas/core/internals/blocks.py b/pandas/core/internals/blocks.py index 0375f782badcc..e2ecb00f46df8 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -3,6 +3,7 @@ import functools import inspect import re +from typing import Any, List import warnings import numpy as np @@ -1826,8 +1827,11 @@ def interpolate(self, method='pad', axis=0, inplace=False, limit=None, limit=limit), placement=self.mgr_locs) - def shift(self, periods, axis=0, fill_value=None): - # type: (int, Optional[BlockPlacement], Any) -> List[ExtensionBlock] + def shift(self, + periods, # type: int + axis=0, # type: libinternals.BlockPlacement + fill_value=None): # type: Any + # type: (...) -> List[ExtensionBlock] """ Shift the block by `periods`. diff --git a/pandas/core/internals/managers.py b/pandas/core/internals/managers.py index 407db772d73e8..b9d478f3f14eb 100644 --- a/pandas/core/internals/managers.py +++ b/pandas/core/internals/managers.py @@ -4,6 +4,7 @@ import itertools import operator import re +from typing import List, Optional, Union import numpy as np @@ -18,6 +19,7 @@ _NS_DTYPE, is_datetimelike_v_numeric, is_extension_array_dtype, is_extension_type, is_list_like, is_numeric_v_string_like, is_scalar) import pandas.core.dtypes.concat as _concat +from pandas.core.dtypes.dtypes import ExtensionDtype from pandas.core.dtypes.generic import ABCExtensionArray, ABCSeries from pandas.core.dtypes.missing import isna diff --git a/pandas/io/formats/format.py b/pandas/io/formats/format.py index 91e5edc8de9f4..2bf0cd56daebf 100644 --- a/pandas/io/formats/format.py +++ b/pandas/io/formats/format.py @@ -440,7 +440,6 @@ def _chk_truncate(self): max_rows = self.max_rows if max_cols == 0 or max_rows == 0: # assume we are in the terminal - # (why else = 0) (w, h) = get_terminal_size() self.w = w self.h = h diff --git a/pandas/tests/frame/test_alter_axes.py b/pandas/tests/frame/test_alter_axes.py index bc5cf30d096fd..ade77c8dadeda 100644 --- a/pandas/tests/frame/test_alter_axes.py +++ b/pandas/tests/frame/test_alter_axes.py @@ -201,7 +201,8 @@ def test_set_index_pass_arrays_duplicate(self, frame_of_index_cols, drop, # need to adapt first drop for case that both keys are 'A' -- # cannot drop the same column twice; # use "is" because == would give ambiguous Boolean error for containers - first_drop = False if (keys[0] is 'A' and keys[1] is 'A') else drop + first_drop = False if ( + keys[0] is 'A' and keys[1] is 'A') else drop # noqa: F632 # to test against already-tested behaviour, we add sequentially, # hence second append always True; must wrap keys in list, otherwise @@ -1272,7 +1273,7 @@ def test_rename_axis_style_raises(self): df.rename(id, mapper=id) def test_reindex_api_equivalence(self): - # equivalence of the labels/axis and index/columns API's + # equivalence of the labels/axis and index/columns API's df = DataFrame([[1, 2, 3], [3, 4, 5], [5, 6, 7]], index=['a', 'b', 'c'], columns=['d', 'e', 'f']) diff --git a/pandas/tests/groupby/test_apply.py b/pandas/tests/groupby/test_apply.py index 659d1a9cf9813..dea7e518ac605 100644 --- a/pandas/tests/groupby/test_apply.py +++ b/pandas/tests/groupby/test_apply.py @@ -9,7 +9,7 @@ def test_apply_issues(): - # GH 5788 + # GH 5788 s = """2011.05.16,00:00,1.40893 2011.05.16,01:00,1.40760 diff --git a/pandas/tests/groupby/test_grouping.py b/pandas/tests/groupby/test_grouping.py index 44b5bd5f13992..bfb7f2636c8a0 100644 --- a/pandas/tests/groupby/test_grouping.py +++ b/pandas/tests/groupby/test_grouping.py @@ -649,17 +649,17 @@ def test_groupby_with_single_column(self): tm.assert_frame_equal(df.groupby('a').nth(1), exp) def test_gb_key_len_equal_axis_len(self): - # GH16843 - # test ensures that index and column keys are recognized correctly - # when number of keys equals axis length of groupby - df = pd.DataFrame([['foo', 'bar', 'B', 1], - ['foo', 'bar', 'B', 2], - ['foo', 'baz', 'C', 3]], - columns=['first', 'second', 'third', 'one']) - df = df.set_index(['first', 'second']) - df = df.groupby(['first', 'second', 'third']).size() - assert df.loc[('foo', 'bar', 'B')] == 2 - assert df.loc[('foo', 'baz', 'C')] == 1 + # GH16843 + # test ensures that index and column keys are recognized correctly + # when number of keys equals axis length of groupby + df = pd.DataFrame([['foo', 'bar', 'B', 1], + ['foo', 'bar', 'B', 2], + ['foo', 'baz', 'C', 3]], + columns=['first', 'second', 'third', 'one']) + df = df.set_index(['first', 'second']) + df = df.groupby(['first', 'second', 'third']).size() + assert df.loc[('foo', 'bar', 'B')] == 2 + assert df.loc[('foo', 'baz', 'C')] == 1 # groups & iteration diff --git a/pandas/tests/indexes/interval/test_interval_tree.py b/pandas/tests/indexes/interval/test_interval_tree.py index 5d9ef2a9a6c32..d924c0f1db38e 100644 --- a/pandas/tests/indexes/interval/test_interval_tree.py +++ b/pandas/tests/indexes/interval/test_interval_tree.py @@ -159,7 +159,7 @@ def test_is_overlapping_endpoints(self, closed, order): left, right = np.arange(3), np.arange(1, 4) tree = IntervalTree(left[order], right[order], closed=closed) result = tree.is_overlapping - expected = closed is 'both' + expected = closed == 'both' assert result is expected @pytest.mark.parametrize('left, right', [ diff --git a/pandas/tests/io/test_pytables.py b/pandas/tests/io/test_pytables.py index 01bf697509c04..77a6a386bbb14 100644 --- a/pandas/tests/io/test_pytables.py +++ b/pandas/tests/io/test_pytables.py @@ -2387,8 +2387,8 @@ def test_empty_series_frame(self): @pytest.mark.parametrize( 'dtype', [np.int64, np.float64, np.object, 'm8[ns]', 'M8[ns]']) def test_empty_series(self, dtype): - s = Series(dtype=dtype) - self._check_roundtrip(s, tm.assert_series_equal) + s = Series(dtype=dtype) + self._check_roundtrip(s, tm.assert_series_equal) def test_can_serialize_dates(self): diff --git a/pandas/tests/series/test_rank.py b/pandas/tests/series/test_rank.py index 373083c077e28..f92a5490ebcb5 100644 --- a/pandas/tests/series/test_rank.py +++ b/pandas/tests/series/test_rank.py @@ -421,10 +421,10 @@ def test_rank_modify_inplace(self): ([1, 1, 3, 3, 5, 5], [1. / 3, 1. / 3, 2. / 3, 2. / 3, 3. / 3, 3. / 3]), ([-5, -4, -3, -2, -1], [1. / 5, 2. / 5, 3. / 5, 4. / 5, 5. / 5])]) def test_rank_dense_pct(dtype, ser, exp): - s = Series(ser).astype(dtype) - result = s.rank(method='dense', pct=True) - expected = Series(exp).astype(result.dtype) - assert_series_equal(result, expected) + s = Series(ser).astype(dtype) + result = s.rank(method='dense', pct=True) + expected = Series(exp).astype(result.dtype) + assert_series_equal(result, expected) @pytest.mark.parametrize('dtype', ['O', 'f8', 'i8']) @@ -439,10 +439,10 @@ def test_rank_dense_pct(dtype, ser, exp): ([1, 1, 3, 3, 5, 5], [1. / 6, 1. / 6, 3. / 6, 3. / 6, 5. / 6, 5. / 6]), ([-5, -4, -3, -2, -1], [1. / 5, 2. / 5, 3. / 5, 4. / 5, 5. / 5])]) def test_rank_min_pct(dtype, ser, exp): - s = Series(ser).astype(dtype) - result = s.rank(method='min', pct=True) - expected = Series(exp).astype(result.dtype) - assert_series_equal(result, expected) + s = Series(ser).astype(dtype) + result = s.rank(method='min', pct=True) + expected = Series(exp).astype(result.dtype) + assert_series_equal(result, expected) @pytest.mark.parametrize('dtype', ['O', 'f8', 'i8']) @@ -457,10 +457,10 @@ def test_rank_min_pct(dtype, ser, exp): ([1, 1, 3, 3, 5, 5], [2. / 6, 2. / 6, 4. / 6, 4. / 6, 6. / 6, 6. / 6]), ([-5, -4, -3, -2, -1], [1. / 5, 2. / 5, 3. / 5, 4. / 5, 5. / 5])]) def test_rank_max_pct(dtype, ser, exp): - s = Series(ser).astype(dtype) - result = s.rank(method='max', pct=True) - expected = Series(exp).astype(result.dtype) - assert_series_equal(result, expected) + s = Series(ser).astype(dtype) + result = s.rank(method='max', pct=True) + expected = Series(exp).astype(result.dtype) + assert_series_equal(result, expected) @pytest.mark.parametrize('dtype', ['O', 'f8', 'i8']) @@ -476,10 +476,10 @@ def test_rank_max_pct(dtype, ser, exp): [1.5 / 6, 1.5 / 6, 3.5 / 6, 3.5 / 6, 5.5 / 6, 5.5 / 6]), ([-5, -4, -3, -2, -1], [1. / 5, 2. / 5, 3. / 5, 4. / 5, 5. / 5])]) def test_rank_average_pct(dtype, ser, exp): - s = Series(ser).astype(dtype) - result = s.rank(method='average', pct=True) - expected = Series(exp).astype(result.dtype) - assert_series_equal(result, expected) + s = Series(ser).astype(dtype) + result = s.rank(method='average', pct=True) + expected = Series(exp).astype(result.dtype) + assert_series_equal(result, expected) @pytest.mark.parametrize('dtype', ['f8', 'i8']) @@ -494,16 +494,16 @@ def test_rank_average_pct(dtype, ser, exp): ([1, 1, 3, 3, 5, 5], [1. / 6, 2. / 6, 3. / 6, 4. / 6, 5. / 6, 6. / 6]), ([-5, -4, -3, -2, -1], [1. / 5, 2. / 5, 3. / 5, 4. / 5, 5. / 5])]) def test_rank_first_pct(dtype, ser, exp): - s = Series(ser).astype(dtype) - result = s.rank(method='first', pct=True) - expected = Series(exp).astype(result.dtype) - assert_series_equal(result, expected) + s = Series(ser).astype(dtype) + result = s.rank(method='first', pct=True) + expected = Series(exp).astype(result.dtype) + assert_series_equal(result, expected) @pytest.mark.single @pytest.mark.high_memory def test_pct_max_many_rows(): - # GH 18271 - s = Series(np.arange(2**24 + 1)) - result = s.rank(pct=True).max() - assert result == 1 + # GH 18271 + s = Series(np.arange(2**24 + 1)) + result = s.rank(pct=True).max() + assert result == 1 diff --git a/pandas/tests/tslibs/test_api.py b/pandas/tests/tslibs/test_api.py index de937d1a4c526..b2beb93f4b64c 100644 --- a/pandas/tests/tslibs/test_api.py +++ b/pandas/tests/tslibs/test_api.py @@ -22,6 +22,7 @@ def test_namespace(): 'timezones'] api = ['NaT', + 'NaTType', 'iNaT', 'is_null_datetimelike', 'OutOfBoundsDatetime', diff --git a/requirements-dev.txt b/requirements-dev.txt index 02d8b0a70aab6..ccf2301dad66b 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -10,7 +10,7 @@ gitpython hypothesis>=3.82 isort moto -pycodestyle==2.4 +pycodestyle pytest>=4.0.2 pytest-mock sphinx