diff --git a/.github/workflows/code-checks.yml b/.github/workflows/code-checks.yml index 87b80204d0c19..eaf9fafbff993 100644 --- a/.github/workflows/code-checks.yml +++ b/.github/workflows/code-checks.yml @@ -166,3 +166,32 @@ jobs: - name: Build image run: docker build --pull --no-cache --tag pandas-dev-env . + + requirements-dev-text-installable: + name: Test install requirements-dev.txt + runs-on: ubuntu-latest + + concurrency: + # https://github.community/t/concurrecy-not-work-for-push/183068/7 + group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-requirements-dev-text-installable + cancel-in-progress: true + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Setup Python + id: setup_python + uses: actions/setup-python@v3 + with: + python-version: '3.8' + cache: 'pip' + cache-dependency-path: 'requirements-dev.txt' + + - name: Install requirements-dev.txt + run: pip install -r requirements-dev.txt + + - name: Check Pip Cache Hit + run: echo ${{ steps.setup_python.outputs.cache-hit }} diff --git a/.github/workflows/posix.yml b/.github/workflows/ubuntu.yml similarity index 98% rename from .github/workflows/posix.yml rename to .github/workflows/ubuntu.yml index 35c40f2a4aa54..1a57f021e6c4c 100644 --- a/.github/workflows/posix.yml +++ b/.github/workflows/ubuntu.yml @@ -1,4 +1,4 @@ -name: Posix +name: Ubuntu on: push: @@ -145,7 +145,7 @@ jobs: - name: Extra installs # xsel for clipboard tests - run: sudo apt-get update && sudo apt-get install -y libc6-dev-i386 xsel ${{ env.EXTRA_APT }} + run: sudo apt-get update && sudo apt-get install -y xsel ${{ env.EXTRA_APT }} - uses: conda-incubator/setup-miniconda@v2.1.1 with: diff --git a/ci/deps/actions-310.yaml b/ci/deps/actions-310.yaml index 7a879b5ac9648..27a2715c20e86 100644 --- a/ci/deps/actions-310.yaml +++ b/ci/deps/actions-310.yaml @@ -31,8 +31,7 @@ dependencies: - jinja2 - lxml - matplotlib - # TODO: uncomment after numba supports py310 - #- numba + - numba - numexpr - openpyxl - odfpy diff --git a/environment.yml b/environment.yml index 83b00c0dd6421..c5382811a8467 100644 --- a/environment.yml +++ b/environment.yml @@ -1,21 +1,85 @@ +# Local development dependencies including docs building, website upload, ASV benchmark name: pandas-dev channels: - conda-forge dependencies: - # required - - numpy>=1.18.5 - python=3.8 - - python-dateutil>=2.8.1 + + # test dependencies + - cython=0.29.30 + - pytest>=6.0 + - pytest-cov + - pytest-xdist>=1.31 + - psutil + - pytest-asyncio>=0.17 + - boto3 + + # required dependencies + - python-dateutil + - numpy - pytz + # optional dependencies + - beautifulsoup4 + - blosc + - brotlipy + - bottleneck + - fastparquet + - fsspec + - html5lib + - hypothesis + - gcsfs + - jinja2 + - lxml + - matplotlib + - numba>=0.53.1 + - numexpr>=2.8.0 # pin for "Run checks on imported code" job + - openpyxl + - odfpy + - pandas-gbq + - psycopg2 + - pyarrow + - pymysql + - pyreadstat + - pytables + - python-snappy + - pyxlsb + - s3fs + - scipy + - sqlalchemy + - tabulate + - xarray + - xlrd + - xlsxwriter + - xlwt + - zstandard + + # downstream packages + - aiobotocore<2.0.0 # GH#44311 pinned to fix docbuild + - botocore + - cftime + - dask + - ipython + - geopandas-base + - seaborn + - scikit-learn + - statsmodels + - coverage + - pandas-datareader + - pyyaml + - py + - pytorch + + # local testing dependencies + - moto + - flask + # benchmarks - asv - # building # The compiler packages are meta-packages and install the correct compiler (activation) packages on the respective platforms. - c-compiler - cxx-compiler - - cython>=0.29.30 # code checks - black=22.3.0 @@ -24,18 +88,19 @@ dependencies: - flake8-bugbear=21.3.2 # used by flake8, find likely bugs - flake8-comprehensions=3.7.0 # used by flake8, linting of unnecessary comprehensions - isort>=5.2.1 # check that imports are in the right order - - mypy=0.930 - - pre-commit>=2.9.2 + - mypy=0.960 + - pre-commit>=2.15.0 - pycodestyle # used by flake8 - pyupgrade # documentation - gitpython # obtain contributors from git for whatsnew - gitdb - - numpydoc < 1.2 # 2021-02-09 1.2dev breaking CI + - natsort # DataFrame.sort_values doctest + - numpydoc - pandas-dev-flaker=0.4.0 - pydata-sphinx-theme=0.8.0 - - pytest-cython + - pytest-cython # doctest - sphinx - sphinx-panels - types-python-dateutil @@ -47,77 +112,14 @@ dependencies: - nbconvert>=6.4.5 - nbsphinx - pandoc - - # Dask and its dependencies (that dont install with dask) - - dask-core - - toolz>=0.7.3 - - partd>=0.3.10 - - cloudpickle>=0.2.1 - - # web (jinja2 is also needed, but it's also an optional pandas dependency) - - markdown - - feedparser - - pyyaml - - requests - - # testing - - boto3 - - botocore>=1.11 - - hypothesis>=5.5.3 - - moto # mock S3 - - flask - - pytest>=6.0 - - pytest-cov - - pytest-xdist>=1.31 - - pytest-asyncio>=0.17 - - pytest-instafail - - # downstream tests - - seaborn - - statsmodels - - # unused (required indirectly may be?) - ipywidgets - nbformat - notebook>=6.0.3 - - # optional - - blosc - - bottleneck>=1.3.1 - ipykernel - - ipython>=7.11.1 - - jinja2 # pandas.Styler - - matplotlib>=3.3.2 # pandas.plotting, Series.plot, DataFrame.plot - - numexpr>=2.7.1 - - scipy>=1.4.1 - - numba>=0.50.1 - - # optional for io - # --------------- - # pd.read_html - - beautifulsoup4>=4.8.2 - - html5lib - - lxml - - # pd.read_excel, DataFrame.to_excel, pd.ExcelWriter, pd.ExcelFile - - openpyxl - - xlrd - - xlsxwriter - - xlwt - - odfpy - - - fastparquet>=0.4.0 # pandas.read_parquet, DataFrame.to_parquet - - pyarrow>2.0.1 # pandas.read_parquet, DataFrame.to_parquet, pandas.read_feather, DataFrame.to_feather - - python-snappy # required by pyarrow - - pytables>=3.6.1 # pandas.read_hdf, DataFrame.to_hdf - - s3fs>=0.4.0 # file IO when using 's3://...' path - - aiobotocore<2.0.0 # GH#44311 pinned to fix docbuild - - fsspec>=0.7.4 # for generic remote file operations - - gcsfs>=0.6.0 # file IO when using 'gcs://...' path - - sqlalchemy # pandas.read_sql, DataFrame.to_sql - - xarray<0.19 # DataFrame.to_xarray - - cftime # Needed for downstream xarray.CFTimeIndex test - - pyreadstat # pandas.read_spss - - tabulate>=0.8.3 # DataFrame.to_markdown - - natsort # DataFrame.sort_values + # web + - jinja2 # in optional dependencies, but documented here as needed + - markdown + - feedparser + - pyyaml + - requests diff --git a/pandas/core/algorithms.py b/pandas/core/algorithms.py index 32e3e19688a63..5493f84fb0be1 100644 --- a/pandas/core/algorithms.py +++ b/pandas/core/algorithms.py @@ -1078,12 +1078,7 @@ def checked_add_with_arr( elif arr_mask is not None: not_nan = np.logical_not(arr_mask) elif b_mask is not None: - # Argument 1 to "__call__" of "_UFunc_Nin1_Nout1" has incompatible type - # "Optional[ndarray[Any, dtype[bool_]]]"; expected - # "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[An - # y]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, - # int, float, complex, str, bytes]]]" [arg-type] - not_nan = np.logical_not(b2_mask) # type: ignore[arg-type] + not_nan = np.logical_not(b2_mask) else: not_nan = np.empty(arr.shape, dtype=bool) not_nan.fill(True) diff --git a/pandas/core/array_algos/quantile.py b/pandas/core/array_algos/quantile.py index 64cd43a3e77cb..4b0db5eccb6f1 100644 --- a/pandas/core/array_algos/quantile.py +++ b/pandas/core/array_algos/quantile.py @@ -184,5 +184,8 @@ def _nanpercentile( return result else: return np.percentile( - values, qs, axis=1, **{np_percentile_argname: interpolation} + values, + qs, + axis=1, + **{np_percentile_argname: interpolation}, ) diff --git a/pandas/core/arraylike.py b/pandas/core/arraylike.py index b6e9bf1420b21..e241fc119ae02 100644 --- a/pandas/core/arraylike.py +++ b/pandas/core/arraylike.py @@ -265,7 +265,11 @@ def array_ufunc(self, ufunc: np.ufunc, method: str, *inputs: Any, **kwargs: Any) return result # Determine if we should defer. - no_defer = (np.ndarray.__array_ufunc__, cls.__array_ufunc__) + # error: "Type[ndarray[Any, Any]]" has no attribute "__array_ufunc__" + no_defer = ( + np.ndarray.__array_ufunc__, # type: ignore[attr-defined] + cls.__array_ufunc__, + ) for item in inputs: higher_priority = ( diff --git a/pandas/core/arrays/interval.py b/pandas/core/arrays/interval.py index 9a1435c3f033d..eb2c6927f56d1 100644 --- a/pandas/core/arrays/interval.py +++ b/pandas/core/arrays/interval.py @@ -661,10 +661,20 @@ def __getitem__( if is_scalar(left) and isna(left): return self._fill_value return Interval(left, right, self.closed) - # error: Argument 1 to "ndim" has incompatible type "Union[ndarray, - # ExtensionArray]"; expected "Union[Union[int, float, complex, str, bytes, - # generic], Sequence[Union[int, float, complex, str, bytes, generic]], - # Sequence[Sequence[Any]], _SupportsArray]" + # error: Argument 1 to "ndim" has incompatible type + # "Union[ndarray[Any, Any], ExtensionArray]"; expected + # "Union[Sequence[Sequence[Sequence[Sequence[Sequence[Any]]]]], + # Union[Union[_SupportsArray[dtype[Any]], + # Sequence[_SupportsArray[dtype[Any]]], + # Sequence[Sequence[_SupportsArray[dtype[Any]]]], + # Sequence[Sequence[Sequence[_SupportsArray[dtype[Any]]]]], + # Sequence[Sequence[Sequence[Sequence[_SupportsArray[dtype[Any]]]]]]], + # Union[bool, int, float, complex, str, bytes, + # Sequence[Union[bool, int, float, complex, str, bytes]], + # Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]], + # Sequence[Sequence[Sequence[Union[bool, int, float, complex, str, bytes]]]], + # Sequence[Sequence[Sequence[Sequence[Union[bool, int, float, + # complex, str, bytes]]]]]]]]" if np.ndim(left) > 1: # type: ignore[arg-type] # GH#30588 multi-dimensional indexer disallowed raise ValueError("multi-dimensional indexing not allowed") @@ -1639,13 +1649,7 @@ def isin(self, values) -> np.ndarray: # complex128 ndarray is much more performant. left = self._combined.view("complex128") right = values._combined.view("complex128") - # Argument 1 to "in1d" has incompatible type "Union[ExtensionArray, - # ndarray[Any, Any], ndarray[Any, dtype[Any]]]"; expected - # "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[ - # dtype[Any]]], bool, int, float, complex, str, bytes, - # _NestedSequence[Union[bool, int, float, complex, str, bytes]]]" - # [arg-type] - return np.in1d(left, right) # type: ignore[arg-type] + return np.in1d(left, right) elif needs_i8_conversion(self.left.dtype) ^ needs_i8_conversion( values.left.dtype diff --git a/pandas/core/arrays/masked.py b/pandas/core/arrays/masked.py index 7d232654e121e..f271e6c47222e 100644 --- a/pandas/core/arrays/masked.py +++ b/pandas/core/arrays/masked.py @@ -140,7 +140,13 @@ class BaseMaskedArray(OpsMixin, ExtensionArray): def __init__(self, values: np.ndarray, mask: np.ndarray, copy: bool = False): # values is supposed to already be validated in the subclass - if not (isinstance(mask, np.ndarray) and mask.dtype == np.bool_): + if not ( + isinstance(mask, np.ndarray) + and + # error: Non-overlapping equality check + # (left operand type: "dtype[bool_]", right operand type: "Type[bool_]") + mask.dtype == np.bool_ # type: ignore[comparison-overlap] + ): raise TypeError( "mask should be boolean numpy array. Use " "the 'pd.array' function instead" @@ -943,11 +949,7 @@ def any(self, *, skipna: bool = True, **kwargs): nv.validate_any((), kwargs) values = self._data.copy() - # Argument 3 to "putmask" has incompatible type "object"; expected - # "Union[_SupportsArray[dtype[Any]], _NestedSequence[ - # _SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _Nested - # Sequence[Union[bool, int, float, complex, str, bytes]]]" [arg-type] - np.putmask(values, self._mask, self._falsey_value) # type: ignore[arg-type] + np.putmask(values, self._mask, self._falsey_value) result = values.any() if skipna: return result @@ -1023,11 +1025,7 @@ def all(self, *, skipna: bool = True, **kwargs): nv.validate_all((), kwargs) values = self._data.copy() - # Argument 3 to "putmask" has incompatible type "object"; expected - # "Union[_SupportsArray[dtype[Any]], _NestedSequence[ - # _SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _Neste - # dSequence[Union[bool, int, float, complex, str, bytes]]]" [arg-type] - np.putmask(values, self._mask, self._truthy_value) # type: ignore[arg-type] + np.putmask(values, self._mask, self._truthy_value) result = values.all() if skipna: diff --git a/pandas/core/arrays/sparse/array.py b/pandas/core/arrays/sparse/array.py index ebfa769eb559d..28501b53a4d02 100644 --- a/pandas/core/arrays/sparse/array.py +++ b/pandas/core/arrays/sparse/array.py @@ -925,15 +925,7 @@ def __getitem__( if is_integer(key): return self._get_val_at(key) elif isinstance(key, tuple): - # Invalid index type "Tuple[Union[int, ellipsis], ...]" for - # "ndarray[Any, Any]"; expected type "Union[SupportsIndex, - # _SupportsArray[dtype[Union[bool_, integer[Any]]]], _NestedSequence[_Su - # pportsArray[dtype[Union[bool_, integer[Any]]]]], - # _NestedSequence[Union[bool, int]], Tuple[Union[SupportsIndex, - # _SupportsArray[dtype[Union[bool_, integer[Any]]]], - # _NestedSequence[_SupportsArray[dtype[Union[bool_, integer[Any]]]]], _N - # estedSequence[Union[bool, int]]], ...]]" [index] - data_slice = self.to_dense()[key] # type: ignore[index] + data_slice = self.to_dense()[key] elif isinstance(key, slice): # Avoid densifying when handling contiguous slices @@ -1173,9 +1165,7 @@ def _concat_same_type( data = np.concatenate(values) indices_arr = np.concatenate(indices) - # Argument 2 to "IntIndex" has incompatible type "ndarray[Any, - # dtype[signedinteger[_32Bit]]]"; expected "Sequence[int]" - sp_index = IntIndex(length, indices_arr) # type: ignore[arg-type] + sp_index = IntIndex(length, indices_arr) else: # when concatenating block indices, we don't claim that you'll @@ -1353,8 +1343,7 @@ def __setstate__(self, state): if isinstance(state, tuple): # Compat for pandas < 0.24.0 nd_state, (fill_value, sp_index) = state - # Need type annotation for "sparse_values" [var-annotated] - sparse_values = np.array([]) # type: ignore[var-annotated] + sparse_values = np.array([]) sparse_values.__setstate__(nd_state) self._sparse_values = sparse_values diff --git a/pandas/core/dtypes/common.py b/pandas/core/dtypes/common.py index 6776064342db0..8c3a032d93a2d 100644 --- a/pandas/core/dtypes/common.py +++ b/pandas/core/dtypes/common.py @@ -534,7 +534,9 @@ def is_string_or_object_np_dtype(dtype: np.dtype) -> bool: """ Faster alternative to is_string_dtype, assumes we have a np.dtype object. """ - return dtype == object or dtype.kind in "SU" + # error: Non-overlapping equality check (left operand type: + # "dtype[Any]", right operand type: "Type[object]") + return dtype == object or dtype.kind in "SU" # type: ignore[comparison-overlap] def is_string_dtype(arr_or_dtype) -> bool: diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 391c12905adae..61be23fcfb0f2 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2427,9 +2427,7 @@ def to_records( if dtype_mapping is None: formats.append(v.dtype) elif isinstance(dtype_mapping, (type, np.dtype, str)): - # Argument 1 to "append" of "list" has incompatible type - # "Union[type, dtype[Any], str]"; expected "dtype[_SCT]" [arg-type] - formats.append(dtype_mapping) # type: ignore[arg-type] + formats.append(dtype_mapping) else: element = "row" if i < index_len else "column" msg = f"Invalid dtype {dtype_mapping} specified for {element} {name}" diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 7175b85e966d7..de83fe12007a2 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -4552,12 +4552,7 @@ def _join_non_unique( right = other._values.take(right_idx) if isinstance(join_array, np.ndarray): - # Argument 3 to "putmask" has incompatible type "Union[ExtensionArray, - # ndarray[Any, Any]]"; expected "Union[_SupportsArray[dtype[Any]], - # _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, f - # loat, complex, str, bytes, _NestedSequence[Union[bool, int, float, - # complex, str, bytes]]]" [arg-type] - np.putmask(join_array, mask, right) # type: ignore[arg-type] + np.putmask(join_array, mask, right) else: join_array._putmask(mask, right) @@ -5057,11 +5052,9 @@ def __getitem__(self, key): if result.ndim > 1: deprecate_ndim_indexing(result) if hasattr(result, "_ndarray"): - # error: Item "ndarray[Any, Any]" of "Union[ExtensionArray, - # ndarray[Any, Any]]" has no attribute "_ndarray" [union-attr] # i.e. NDArrayBackedExtensionArray # Unpack to ndarray for MPL compat - return result._ndarray # type: ignore[union-attr] + return result._ndarray return result # NB: Using _constructor._simple_new would break if MultiIndex @@ -6602,9 +6595,7 @@ def insert(self, loc: int, item) -> Index: new_values = np.insert(arr, loc, casted) else: - # No overload variant of "insert" matches argument types - # "ndarray[Any, Any]", "int", "None" [call-overload] - new_values = np.insert(arr, loc, None) # type: ignore[call-overload] + new_values = np.insert(arr, loc, None) loc = loc if loc >= 0 else loc - 1 new_values[loc] = item diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index 68db372ff4e51..4c65f50a444d7 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -365,9 +365,7 @@ def _validate_codes(self, level: list, code: list): """ null_mask = isna(level) if np.any(null_mask): - # Incompatible types in assignment (expression has type - # "ndarray[Any, dtype[Any]]", variable has type "List[Any]") - code = np.where(null_mask[code], -1, code) # type: ignore[assignment] + code = np.where(null_mask[code], -1, code) return code def _verify_integrity(self, codes: list | None = None, levels: list | None = None): diff --git a/pandas/core/internals/ops.py b/pandas/core/internals/ops.py index 1160d3b2a8e3a..c938a018574f9 100644 --- a/pandas/core/internals/ops.py +++ b/pandas/core/internals/ops.py @@ -125,7 +125,9 @@ def _get_same_shape_values( # argument type "Tuple[Union[ndarray, slice], slice]" lvals = lvals[rblk.mgr_locs.indexer, :] # type: ignore[call-overload] assert lvals.shape[0] == 1, lvals.shape - lvals = lvals[0, :] + # error: No overload variant of "__getitem__" of "ExtensionArray" matches + # argument type "Tuple[int, slice]" + lvals = lvals[0, :] # type: ignore[call-overload] else: # lvals are 1D, rvals are 2D assert rvals.shape[0] == 1, rvals.shape diff --git a/pandas/core/missing.py b/pandas/core/missing.py index e09701e69c62c..d589a8fbbca70 100644 --- a/pandas/core/missing.py +++ b/pandas/core/missing.py @@ -333,15 +333,7 @@ def func(yvalues: np.ndarray) -> None: **kwargs, ) - # Argument 1 to "apply_along_axis" has incompatible type - # "Callable[[ndarray[Any, Any]], None]"; expected - # "Callable[..., Union[_SupportsArray[dtype[]], - # Sequence[_SupportsArray[dtype[ - # ]]], Sequence[Sequence[_SupportsArray[dtype[]]]], - # Sequence[Sequence[Sequence[_SupportsArray[dtype[]]]]], - # Sequence[Sequence[Sequence[Sequence[_SupportsArray[dtype[]]]]]]]]" - # interp each column independently - np.apply_along_axis(func, axis, data) # type: ignore[arg-type] + np.apply_along_axis(func, axis, data) return @@ -779,23 +771,14 @@ def interpolate_2d( Modifies values in-place. """ if limit_area is not None: - # Argument 1 to "apply_along_axis" has incompatible type "partial[None]"; - # expected "Callable[..., Union[_SupportsArray[dtype[]], - # Sequence[_SupportsArray[dtype[]]], Sequence[Sequence - # [_SupportsArray[dtype[]]]], - # Sequence[Sequence[Sequence[_SupportsArray[dtype[]]]]], - # Sequence[Sequence[Sequence[Sequence[_SupportsArray[dtype[]]]]]]]]" - - # Argument 2 to "apply_along_axis" has incompatible type "Union[str, int]"; - # expected "SupportsIndex" [arg-type] np.apply_along_axis( partial( _interpolate_with_limit_area, method=method, limit=limit, limit_area=limit_area, - ), # type: ignore[arg-type] - axis, # type: ignore[arg-type] + ), + axis, values, ) return diff --git a/pandas/core/reshape/melt.py b/pandas/core/reshape/melt.py index 262cd9774f694..aa426d24db75d 100644 --- a/pandas/core/reshape/melt.py +++ b/pandas/core/reshape/melt.py @@ -133,9 +133,7 @@ def melt( if is_extension_array_dtype(id_data): id_data = concat([id_data] * K, ignore_index=True) else: - # Incompatible types in assignment (expression has type - # "ndarray[Any, dtype[Any]]", variable has type "Series") [assignment] - id_data = np.tile(id_data._values, K) # type: ignore[assignment] + id_data = np.tile(id_data._values, K) mdata[col] = id_data mcolumns = id_vars + var_name + [value_name] diff --git a/pandas/core/series.py b/pandas/core/series.py index 43ad67d36ad4b..b957e3a238c2e 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -1990,9 +1990,7 @@ def count(self, level=None): lev = lev.insert(cnt, lev._na_value) obs = level_codes[notna(self._values)] - # Argument "minlength" to "bincount" has incompatible type "Optional[int]"; - # expected "SupportsIndex" [arg-type] - out = np.bincount(obs, minlength=len(lev) or None) # type: ignore[arg-type] + out = np.bincount(obs, minlength=len(lev) or None) return self._constructor(out, index=lev, dtype="int64").__finalize__( self, method="count" ) diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index 6d74c6db1f7ed..712495aadde56 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -354,7 +354,10 @@ def _prep_values(self, values: ArrayLike) -> np.ndarray: if inf.any(): values = np.where(inf, np.nan, values) - return values + # error: Incompatible return value type + # (got "Union[ExtensionArray, ndarray[Any, Any], + # ndarray[Any, dtype[floating[_64Bit]]]]", expected "ndarray[Any, Any]") + return values # type: ignore[return-value] def _insert_on_column(self, result: DataFrame, obj: DataFrame) -> None: # if we have an 'on' column we want to put it back into diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index 4a8169c0609fd..5c0c4518bc2fb 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -3612,11 +3612,21 @@ def _highlight_between( Return an array of css props based on condition of data values within given range. """ if np.iterable(left) and not isinstance(left, str): + # error: Argument 1 to "_validate_apply_axis_arg" + # has incompatible type "Union[str, float, Period, + # Timedelta, Interval[Any], datetime64, timedelta64, + # datetime, Sequence[Any], ndarray[Any, Any], NDFrame, None]"; + # expected "Union[NDFrame, Sequence[Any], ndarray[Any, Any]]" left = _validate_apply_axis_arg( left, "left", None, data # type: ignore[arg-type] ) if np.iterable(right) and not isinstance(right, str): + # error: Argument 1 to "_validate_apply_axis_arg" + # has incompatible type "Union[str, float, Period, + # Timedelta, Interval[Any], datetime64, timedelta64, + # datetime, Sequence[Any], ndarray[Any, Any], NDFrame, None]"; + # expected "Union[NDFrame, Sequence[Any], ndarray[Any, Any]]" right = _validate_apply_axis_arg( right, "right", None, data # type: ignore[arg-type] ) diff --git a/pandas/io/parsers/c_parser_wrapper.py b/pandas/io/parsers/c_parser_wrapper.py index fc0f572c79e6b..b0e9c81132ee4 100644 --- a/pandas/io/parsers/c_parser_wrapper.py +++ b/pandas/io/parsers/c_parser_wrapper.py @@ -367,7 +367,7 @@ def _concatenate_chunks(chunks: list[dict[int, ArrayLike]]) -> dict: numpy_dtypes, # type: ignore[arg-type] [], ) - if common_type == object: + if common_type == np.dtype(object): warning_columns.append(str(name)) dtype = dtypes.pop() @@ -384,14 +384,7 @@ def _concatenate_chunks(chunks: list[dict[int, ArrayLike]]) -> dict: arrs # type: ignore[arg-type] ) else: - # Argument 1 to "concatenate" has incompatible type - # "List[Union[ExtensionArray, ndarray[Any, Any]]]"; expected - # "Union[_SupportsArray[dtype[Any]], - # Sequence[_SupportsArray[dtype[Any]]], - # Sequence[Sequence[_SupportsArray[dtype[Any]]]], - # Sequence[Sequence[Sequence[_SupportsArray[dtype[Any]]]]], - # Sequence[Sequence[Sequence[Sequence[_SupportsArray[dtype[Any]]]]]]]" - result[name] = np.concatenate(arrs) # type: ignore[arg-type] + result[name] = np.concatenate(arrs) if warning_columns: warning_names = ",".join(warning_columns) diff --git a/pandas/tests/extension/date/array.py b/pandas/tests/extension/date/array.py index b14b9921be3d3..d29ed293e71ed 100644 --- a/pandas/tests/extension/date/array.py +++ b/pandas/tests/extension/date/array.py @@ -109,10 +109,7 @@ def __init__( self._month = np.zeros(ldates, dtype=np.uint8) # 255 (1, 31) self._day = np.zeros(ldates, dtype=np.uint8) # 255 (1, 12) - # "object_" object is not iterable [misc] - for (i,), (y, m, d) in np.ndenumerate( # type: ignore[misc] - np.char.split(dates, sep="-") - ): + for (i,), (y, m, d) in np.ndenumerate(np.char.split(dates, sep="-")): self._year[i] = int(y) self._month[i] = int(m) self._day[i] = int(d) diff --git a/requirements-dev.txt b/requirements-dev.txt index 05a9f0426440d..041b35e0ef2b2 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,24 +1,80 @@ # This file is auto-generated from environment.yml, do not modify. # See that file for comments about the need/usage of each dependency. -numpy>=1.18.5 -python-dateutil>=2.8.1 +cython==0.29.30 +pytest>=6.0 +pytest-cov +pytest-xdist>=1.31 +psutil +pytest-asyncio>=0.17 +boto3 +python-dateutil +numpy pytz +beautifulsoup4 +blosc +brotlipy +bottleneck +fastparquet +fsspec +html5lib +hypothesis +gcsfs +jinja2 +lxml +matplotlib +numba>=0.53.1 +numexpr>=2.8.0 +openpyxl +odfpy +pandas-gbq +psycopg2 +pyarrow +pymysql +pyreadstat +tables +python-snappy +pyxlsb +s3fs +scipy +sqlalchemy +tabulate +xarray +xlrd +xlsxwriter +xlwt +zstandard +aiobotocore<2.0.0 +botocore +cftime +dask +ipython +geopandas +seaborn +scikit-learn +statsmodels +coverage +pandas-datareader +pyyaml +py +torch +moto +flask asv -cython>=0.29.30 black==22.3.0 cpplint flake8==4.0.1 flake8-bugbear==21.3.2 flake8-comprehensions==3.7.0 isort>=5.2.1 -mypy==0.930 -pre-commit>=2.9.2 +mypy==0.960 +pre-commit>=2.15.0 pycodestyle pyupgrade gitpython gitdb -numpydoc < 1.2 +natsort +numpydoc pandas-dev-flaker==0.4.0 pydata-sphinx-theme==0.8.0 pytest-cython @@ -31,58 +87,13 @@ types-setuptools nbconvert>=6.4.5 nbsphinx pandoc -dask -toolz>=0.7.3 -partd>=0.3.10 -cloudpickle>=0.2.1 -markdown -feedparser -pyyaml -requests -boto3 -botocore>=1.11 -hypothesis>=5.5.3 -moto -flask -pytest>=6.0 -pytest-cov -pytest-xdist>=1.31 -pytest-asyncio>=0.17 -pytest-instafail -seaborn -statsmodels ipywidgets nbformat notebook>=6.0.3 -blosc -bottleneck>=1.3.1 ipykernel -ipython>=7.11.1 jinja2 -matplotlib>=3.3.2 -numexpr>=2.7.1 -scipy>=1.4.1 -numba>=0.50.1 -beautifulsoup4>=4.8.2 -html5lib -lxml -openpyxl -xlrd -xlsxwriter -xlwt -odfpy -fastparquet>=0.4.0 -pyarrow>2.0.1 -python-snappy -tables>=3.6.1 -s3fs>=0.4.0 -aiobotocore<2.0.0 -fsspec>=0.7.4 -gcsfs>=0.6.0 -sqlalchemy -xarray<0.19 -cftime -pyreadstat -tabulate>=0.8.3 -natsort +markdown +feedparser +pyyaml +requests setuptools>=51.0.0 diff --git a/scripts/generate_pip_deps_from_conda.py b/scripts/generate_pip_deps_from_conda.py index 2ea50fa3ac8d4..8cb539d3b02c8 100755 --- a/scripts/generate_pip_deps_from_conda.py +++ b/scripts/generate_pip_deps_from_conda.py @@ -21,7 +21,7 @@ import yaml EXCLUDE = {"python", "c-compiler", "cxx-compiler"} -RENAME = {"pytables": "tables", "dask-core": "dask"} +RENAME = {"pytables": "tables", "geopandas-base": "geopandas", "pytorch": "torch"} def conda_package_to_pip(package: str):