The following issues were found

pandas/tests/dtypes/test_dtypes.py
559 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              import re

import numpy as np
import pytest
import pytz

from pandas.core.dtypes.base import _registry as registry
from pandas.core.dtypes.common import (
    is_bool_dtype,

            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 5 Column: 1

              
import numpy as np
import pytest
import pytz

from pandas.core.dtypes.base import _registry as registry
from pandas.core.dtypes.common import (
    is_bool_dtype,
    is_categorical,

            

Reported by Pylint.

Instance of 'ExtensionIndex' has no 'tz' member
Error

Line: 378 Column: 39

                      # GH 24713
        tz = pytz.timezone("US/Eastern")
        dr = date_range("2013-01-01", periods=3, tz="US/Eastern")
        dtype = DatetimeTZDtype("ns", dr.tz)
        assert dtype.tz == tz
        dtype = DatetimeTZDtype("ns", dr[0].tz)
        assert dtype.tz == tz



            

Reported by Pylint.

Instance of 'Index' has no 'tz' member
Error

Line: 378 Column: 39

                      # GH 24713
        tz = pytz.timezone("US/Eastern")
        dr = date_range("2013-01-01", periods=3, tz="US/Eastern")
        dtype = DatetimeTZDtype("ns", dr.tz)
        assert dtype.tz == tz
        dtype = DatetimeTZDtype("ns", dr[0].tz)
        assert dtype.tz == tz



            

Reported by Pylint.

Access to a protected member _cache_dtypes of a client class
Error

Line: 69 Column: 24

              
        # clear the cache
        type(dtype).reset_cache()
        assert not len(dtype._cache_dtypes)

        # force back to the cache
        result = tm.round_trip_pickle(dtype)
        if not isinstance(dtype, PeriodDtype):
            # Because PeriodDtype has a cython class as a base class,

            

Reported by Pylint.

Access to a protected member _cache_dtypes of a client class
Error

Line: 77 Column: 28

                          # Because PeriodDtype has a cython class as a base class,
            #  it has different pickle semantics, and its cache is re-populated
            #  on un-pickling.
            assert not len(dtype._cache_dtypes)
        assert result == dtype


class TestCategoricalDtype(Base):
    @pytest.fixture

            

Reported by Pylint.

Access to a protected member _from_values_or_dtype of a client class
Error

Line: 137 Column: 18

                      ],
    )
    def test_from_values_or_dtype(self, values, categories, ordered, dtype, expected):
        result = CategoricalDtype._from_values_or_dtype(
            values, categories, ordered, dtype
        )
        assert result == expected

    @pytest.mark.parametrize(

            

Reported by Pylint.

Access to a protected member _from_values_or_dtype of a client class
Error

Line: 153 Column: 13

                  def test_from_values_or_dtype_raises(self, values, categories, ordered, dtype):
        msg = "Cannot specify `categories` or `ordered` together with `dtype`."
        with pytest.raises(ValueError, match=msg):
            CategoricalDtype._from_values_or_dtype(values, categories, ordered, dtype)

    def test_from_values_or_dtype_invalid_dtype(self):
        msg = "Cannot not construct CategoricalDtype from <class 'object'>"
        with pytest.raises(ValueError, match=msg):
            CategoricalDtype._from_values_or_dtype(None, None, None, object)

            

Reported by Pylint.

Access to a protected member _from_values_or_dtype of a client class
Error

Line: 158 Column: 13

                  def test_from_values_or_dtype_invalid_dtype(self):
        msg = "Cannot not construct CategoricalDtype from <class 'object'>"
        with pytest.raises(ValueError, match=msg):
            CategoricalDtype._from_values_or_dtype(None, None, None, object)

    def test_is_dtype(self, dtype):
        assert CategoricalDtype.is_dtype(dtype)
        assert CategoricalDtype.is_dtype("category")
        assert CategoricalDtype.is_dtype(CategoricalDtype())

            

Reported by Pylint.

Access to a protected member _is_boolean of a client class
Error

Line: 203 Column: 16

                  )
    def test_is_boolean(self, categories, expected):
        cat = Categorical(categories)
        assert cat.dtype._is_boolean is expected
        assert is_bool_dtype(cat) is expected
        assert is_bool_dtype(cat.dtype) is expected

    def test_dtype_specific_categorical_dtype(self):
        expected = "datetime64[ns]"

            

Reported by Pylint.

pandas/tests/scalar/period/test_asfreq.py
505 issues
Unable to import 'pytest'
Error

Line: 1 Column: 1

              import pytest

from pandas._libs.tslibs.dtypes import _period_code_map
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
from pandas.errors import OutOfBoundsDatetime

from pandas import (
    Period,
    Timestamp,

            

Reported by Pylint.

Unable to import 'pandas._libs.tslibs.dtypes'
Error

Line: 3 Column: 1

              import pytest

from pandas._libs.tslibs.dtypes import _period_code_map
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
from pandas.errors import OutOfBoundsDatetime

from pandas import (
    Period,
    Timestamp,

            

Reported by Pylint.

Unable to import 'pandas._libs.tslibs.period'
Error

Line: 4 Column: 1

              import pytest

from pandas._libs.tslibs.dtypes import _period_code_map
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
from pandas.errors import OutOfBoundsDatetime

from pandas import (
    Period,
    Timestamp,

            

Reported by Pylint.

No name 'period' in module 'pandas._libs.tslibs'
Error

Line: 4 Column: 1

              import pytest

from pandas._libs.tslibs.dtypes import _period_code_map
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
from pandas.errors import OutOfBoundsDatetime

from pandas import (
    Period,
    Timestamp,

            

Reported by Pylint.

TODO: unused?
Error

Line: 431 Column: 3

                      ival_D_saturday = Period(freq="D", year=2007, month=1, day=6)
        ival_D_sunday = Period(freq="D", year=2007, month=1, day=7)

        # TODO: unused?
        # ival_D_monday = Period(freq='D', year=2007, month=1, day=8)

        ival_B_friday = Period(freq="B", year=2007, month=1, day=5)
        ival_B_monday = Period(freq="B", year=2007, month=1, day=8)


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 679 Column: 13

                      per2 = Period("2300-01-01", "us")
        msg = "2300-01-01"
        with pytest.raises(OutOfBoundsDatetime, match=msg):
            per2.start_time
        with pytest.raises(OutOfBoundsDatetime, match=msg):
            per2.end_time

    def test_asfreq_mult(self):
        # normal freq to mult freq

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 681 Column: 13

                      with pytest.raises(OutOfBoundsDatetime, match=msg):
            per2.start_time
        with pytest.raises(OutOfBoundsDatetime, match=msg):
            per2.end_time

    def test_asfreq_mult(self):
        # normal freq to mult freq
        p = Period(freq="A", year=2007)
        # ordinal will not change

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import pytest

from pandas._libs.tslibs.dtypes import _period_code_map
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
from pandas.errors import OutOfBoundsDatetime

from pandas import (
    Period,
    Timestamp,

            

Reported by Pylint.

Method could be a function
Error

Line: 18 Column: 5

                  """Test frequency conversion of date objects"""

    @pytest.mark.parametrize("freq", ["A", "Q", "M", "W", "B", "D"])
    def test_asfreq_near_zero(self, freq):
        # GH#19643, GH#19650
        per = Period("0001-01-01", freq=freq)
        tup1 = (per.year, per.hour, per.day)

        prev = per - 1

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 18 Column: 5

                  """Test frequency conversion of date objects"""

    @pytest.mark.parametrize("freq", ["A", "Q", "M", "W", "B", "D"])
    def test_asfreq_near_zero(self, freq):
        # GH#19643, GH#19650
        per = Period("0001-01-01", freq=freq)
        tup1 = (per.year, per.hour, per.day)

        prev = per - 1

            

Reported by Pylint.

pandas/tests/io/formats/style/test_style.py
496 issues
Unable to import 'pytest'
Error

Line: 5 Column: 1

              import re

import numpy as np
import pytest

import pandas as pd
from pandas import (
    DataFrame,
    MultiIndex,

            

Reported by Pylint.

Redefining name 'mi_df' from outer scope (line 27)
Error

Line: 37 Column: 15

              

@pytest.fixture
def mi_styler(mi_df):
    return Styler(mi_df, uuid_len=0)


@pytest.fixture
def mi_styler_comp(mi_styler):

            

Reported by Pylint.

Redefining name 'mi_styler' from outer scope (line 37)
Error

Line: 42 Column: 20

              

@pytest.fixture
def mi_styler_comp(mi_styler):
    # comprehensively add features to mi_styler
    mi_styler.uuid_len = 5
    mi_styler.uuid = "abcde"
    mi_styler.set_caption("capt")
    mi_styler.set_table_styles([{"selector": "a", "props": "a:v;"}])

            

Reported by Pylint.

Redefining name 'mi_styler' from outer scope (line 37)
Error

Line: 91 Column: 37

                      ),
    ],
)
def test_mi_styler_sparsify_columns(mi_styler, sparse_columns, exp_cols):
    exp_l1_c0 = {"is_visible": True, "attributes": "", "display_value": "c1_a"}
    exp_l1_c1 = {"is_visible": True, "attributes": "", "display_value": "c1_b"}

    ctx = mi_styler._translate(True, sparse_columns)


            

Reported by Pylint.

Access to a protected member _translate of a client class
Error

Line: 95 Column: 11

                  exp_l1_c0 = {"is_visible": True, "attributes": "", "display_value": "c1_a"}
    exp_l1_c1 = {"is_visible": True, "attributes": "", "display_value": "c1_b"}

    ctx = mi_styler._translate(True, sparse_columns)

    assert exp_cols[0].items() <= ctx["head"][0][2].items()
    assert exp_cols[1].items() <= ctx["head"][0][3].items()
    assert exp_l1_c0.items() <= ctx["head"][1][2].items()
    assert exp_l1_c1.items() <= ctx["head"][1][3].items()

            

Reported by Pylint.

Redefining name 'mi_styler' from outer scope (line 37)
Error

Line: 122 Column: 35

                      ),
    ],
)
def test_mi_styler_sparsify_index(mi_styler, sparse_index, exp_rows):
    exp_l1_r0 = {"is_visible": True, "attributes": "", "display_value": "i1_a"}
    exp_l1_r1 = {"is_visible": True, "attributes": "", "display_value": "i1_b"}

    ctx = mi_styler._translate(sparse_index, True)


            

Reported by Pylint.

Access to a protected member _translate of a client class
Error

Line: 126 Column: 11

                  exp_l1_r0 = {"is_visible": True, "attributes": "", "display_value": "i1_a"}
    exp_l1_r1 = {"is_visible": True, "attributes": "", "display_value": "i1_b"}

    ctx = mi_styler._translate(sparse_index, True)

    assert exp_rows[0].items() <= ctx["body"][0][0].items()
    assert exp_rows[1].items() <= ctx["body"][1][0].items()
    assert exp_l1_r0.items() <= ctx["body"][0][1].items()
    assert exp_l1_r1.items() <= ctx["body"][1][1].items()

            

Reported by Pylint.

Redefining name 'mi_styler' from outer scope (line 37)
Error

Line: 134 Column: 37

                  assert exp_l1_r1.items() <= ctx["body"][1][1].items()


def test_mi_styler_sparsify_options(mi_styler):
    with pd.option_context("styler.sparse.index", False):
        html1 = mi_styler.to_html()
    with pd.option_context("styler.sparse.index", True):
        html2 = mi_styler.to_html()


            

Reported by Pylint.

Access to a protected member _translate of a client class
Error

Line: 161 Column: 15

              def test_render_trimming():
    df = DataFrame(np.arange(120).reshape(60, 2))
    with pd.option_context("styler.render.max_elements", 6):
        ctx = df.style._translate(True, True)
    assert len(ctx["head"][0]) == 3  # index + 2 data cols
    assert len(ctx["body"]) == 4  # 3 data rows + trimming row
    assert len(ctx["body"][0]) == 3  # index + 2 data cols

    df = DataFrame(np.arange(120).reshape(12, 10))

            

Reported by Pylint.

Access to a protected member _translate of a client class
Error

Line: 168 Column: 15

              
    df = DataFrame(np.arange(120).reshape(12, 10))
    with pd.option_context("styler.render.max_elements", 6):
        ctx = df.style._translate(True, True)
    assert len(ctx["head"][0]) == 4  # index + 2 data cols + trimming row
    assert len(ctx["body"]) == 4  # 3 data rows + trimming row
    assert len(ctx["body"][0]) == 4  # index + 2 data cols + trimming row



            

Reported by Pylint.

pandas/tests/arithmetic/test_datetime64.py
465 issues
Unable to import 'pytest'
Error

Line: 17 Column: 1

              import warnings

import numpy as np
import pytest
import pytz

from pandas._libs.tslibs.conversion import localize_pydatetime
from pandas._libs.tslibs.offsets import shift_months
from pandas.compat import np_datetime64_compat

            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 18 Column: 1

              
import numpy as np
import pytest
import pytz

from pandas._libs.tslibs.conversion import localize_pydatetime
from pandas._libs.tslibs.offsets import shift_months
from pandas.compat import np_datetime64_compat
from pandas.errors import PerformanceWarning

            

Reported by Pylint.

No name 'conversion' in module 'pandas._libs.tslibs'
Error

Line: 20 Column: 1

              import pytest
import pytz

from pandas._libs.tslibs.conversion import localize_pydatetime
from pandas._libs.tslibs.offsets import shift_months
from pandas.compat import np_datetime64_compat
from pandas.errors import PerformanceWarning

import pandas as pd

            

Reported by Pylint.

Unable to import 'pandas._libs.tslibs.conversion'
Error

Line: 20 Column: 1

              import pytest
import pytz

from pandas._libs.tslibs.conversion import localize_pydatetime
from pandas._libs.tslibs.offsets import shift_months
from pandas.compat import np_datetime64_compat
from pandas.errors import PerformanceWarning

import pandas as pd

            

Reported by Pylint.

Unable to import 'pandas._libs.tslibs.offsets'
Error

Line: 21 Column: 1

              import pytz

from pandas._libs.tslibs.conversion import localize_pydatetime
from pandas._libs.tslibs.offsets import shift_months
from pandas.compat import np_datetime64_compat
from pandas.errors import PerformanceWarning

import pandas as pd
from pandas import (

            

Reported by Pylint.

No name 'offsets' in module 'pandas._libs.tslibs'
Error

Line: 21 Column: 1

              import pytz

from pandas._libs.tslibs.conversion import localize_pydatetime
from pandas._libs.tslibs.offsets import shift_months
from pandas.compat import np_datetime64_compat
from pandas.errors import PerformanceWarning

import pandas as pd
from pandas import (

            

Reported by Pylint.

Instance of 'Index' has no 'tzinfo' member
Error

Line: 398 Column: 48

                          if isinstance(other, np.datetime64):
                # no tzaware version available
                return
            other = localize_pydatetime(other, dti.tzinfo)

        result = dti == other
        expected = np.array([True, False])
        tm.assert_numpy_array_equal(result, expected)


            

Reported by Pylint.

Instance of 'ExtensionIndex' has no 'tzinfo' member
Error

Line: 398 Column: 48

                          if isinstance(other, np.datetime64):
                # no tzaware version available
                return
            other = localize_pydatetime(other, dti.tzinfo)

        result = dti == other
        expected = np.array([True, False])
        tm.assert_numpy_array_equal(result, expected)


            

Reported by Pylint.

Instance of 'ExtensionIndex' has no 'tz_localize' member
Error

Line: 571 Column: 14

                      box = box_with_array

        dr = date_range("2016-01-01", periods=6)
        dz = dr.tz_localize("US/Pacific")

        dr = tm.box_expected(dr, box)
        dz = tm.box_expected(dz, box)

        if box is pd.DataFrame:

            

Reported by Pylint.

Instance of 'Index' has no 'tz_localize' member
Error

Line: 571 Column: 14

                      box = box_with_array

        dr = date_range("2016-01-01", periods=6)
        dz = dr.tz_localize("US/Pacific")

        dr = tm.box_expected(dr, box)
        dz = tm.box_expected(dz, box)

        if box is pd.DataFrame:

            

Reported by Pylint.

pandas/tests/reductions/test_reductions.py
456 issues
Unable to import 'pytest'
Error

Line: 7 Column: 1

              )

import numpy as np
import pytest

import pandas as pd
from pandas import (
    Categorical,
    DataFrame,

            

Reported by Pylint.

Method '_cached_int64index' has no 'max' member
Error

Line: 224 Column: 20

                  def test_max_min_range(self, start, stop, step):
        # GH#17607
        idx = RangeIndex(start, stop, step)
        expected = idx._int64index.max()
        result = idx.max()
        assert result == expected

        # skipna should be irrelevant since RangeIndex should never have NAs
        result2 = idx.max(skipna=False)

            

Reported by Pylint.

Method '_cached_int64index' has no 'min' member
Error

Line: 232 Column: 20

                      result2 = idx.max(skipna=False)
        assert result2 == expected

        expected = idx._int64index.min()
        result = idx.min()
        assert result == expected

        # skipna should be irrelevant since RangeIndex should never have NAs
        result2 = idx.min(skipna=False)

            

Reported by Pylint.

Method '_cached_int64index' has no 'max' member
Error

Line: 434 Column: 20

                      # GH#26125
        idx = RangeIndex(0, 10, 3)

        expected = idx._int64index.max()
        result = np.max(idx)
        assert result == expected

        expected = idx._int64index.min()
        result = np.min(idx)

            

Reported by Pylint.

Method '_cached_int64index' has no 'min' member
Error

Line: 438 Column: 20

                      result = np.max(idx)
        assert result == expected

        expected = idx._int64index.min()
        result = np.min(idx)
        assert result == expected

        errmsg = "the 'out' parameter is not supported"
        with pytest.raises(ValueError, match=errmsg):

            

Reported by Pylint.

Redefining name 'objs' from outer scope (line 51)
Error

Line: 47 Column: 5

                  arr = np.random.randn(10)
    series = [Series(arr, index=idx, name="a") for idx in indexes]

    objs = indexes + series
    return objs


objs = get_objs()


            

Reported by Pylint.

Access to a protected member _int64index of a client class
Error

Line: 224 Column: 20

                  def test_max_min_range(self, start, stop, step):
        # GH#17607
        idx = RangeIndex(start, stop, step)
        expected = idx._int64index.max()
        result = idx.max()
        assert result == expected

        # skipna should be irrelevant since RangeIndex should never have NAs
        result2 = idx.max(skipna=False)

            

Reported by Pylint.

Access to a protected member _int64index of a client class
Error

Line: 232 Column: 20

                      result2 = idx.max(skipna=False)
        assert result2 == expected

        expected = idx._int64index.min()
        result = idx.min()
        assert result == expected

        # skipna should be irrelevant since RangeIndex should never have NAs
        result2 = idx.min(skipna=False)

            

Reported by Pylint.

Access to a protected member _int64index of a client class
Error

Line: 434 Column: 20

                      # GH#26125
        idx = RangeIndex(0, 10, 3)

        expected = idx._int64index.max()
        result = np.max(idx)
        assert result == expected

        expected = idx._int64index.min()
        result = np.min(idx)

            

Reported by Pylint.

Access to a protected member _int64index of a client class
Error

Line: 438 Column: 20

                      result = np.max(idx)
        assert result == expected

        expected = idx._int64index.min()
        result = np.min(idx)
        assert result == expected

        errmsg = "the 'out' parameter is not supported"
        with pytest.raises(ValueError, match=errmsg):

            

Reported by Pylint.

pandas/io/pytables.py
453 issues
No name 'lib' in module 'pandas._libs'
Error

Line: 34 Column: 1

                  get_option,
)

from pandas._libs import (
    lib,
    writers as libwriters,
)
from pandas._libs.tslibs import timezones
from pandas._typing import (

            

Reported by Pylint.

No name 'writers' in module 'pandas._libs'
Error

Line: 34 Column: 1

                  get_option,
)

from pandas._libs import (
    lib,
    writers as libwriters,
)
from pandas._libs.tslibs import timezones
from pandas._typing import (

            

Reported by Pylint.

No name 'timezones' in module 'pandas._libs.tslibs'
Error

Line: 38 Column: 1

                  lib,
    writers as libwriters,
)
from pandas._libs.tslibs import timezones
from pandas._typing import (
    ArrayLike,
    DtypeArg,
    FrameOrSeries,
    Shape,

            

Reported by Pylint.

Unable to import 'tables'
Error

Line: 100 Column: 5

              )

if TYPE_CHECKING:
    from tables import (
        Col,
        File,
        Node,
    )


            

Reported by Pylint.

Unable to import 'tables'
Error

Line: 244 Column: 9

                  global _table_mod
    global _table_file_open_policy_is_strict
    if _table_mod is None:
        import tables

        _table_mod = tables

        # set the file open policy
        # return the file open policy; this changes as of pytables 3.1

            

Reported by Pylint.

Instance of 'ExtensionIndex' has no 'tz_localize' member
Error

Line: 2787 Column: 30

                              dta = DatetimeArray._simple_new(values.values, freq=freq)
                result = DatetimeIndex._simple_new(dta, name=None)
                if tz is not None:
                    result = result.tz_localize("UTC").tz_convert(tz)
                return result

            factory = f
        elif index_class == PeriodIndex:


            

Reported by Pylint.

Instance of 'Index' has no 'tz_localize' member
Error

Line: 2787 Column: 30

                              dta = DatetimeArray._simple_new(values.values, freq=freq)
                result = DatetimeIndex._simple_new(dta, name=None)
                if tz is not None:
                    result = result.tz_localize("UTC").tz_convert(tz)
                return result

            factory = f
        elif index_class == PeriodIndex:


            

Reported by Pylint.

Unable to import 'tables'
Error

Line: 2855 Column: 9

              
    def read_array(self, key: str, start: int | None = None, stop: int | None = None):
        """read an array for the specified node (off of group"""
        import tables

        node = getattr(self.group, key)
        attrs = node._v_attrs

        transposed = getattr(attrs, "transposed", False)

            

Reported by Pylint.

Instance of 'BlockManagerFixed' has no 'obj_type' member
Error

Line: 3181 Column: 23

                  ):
        # start, stop applied to rows, so 0th axis only
        self.validate_read(columns, where)
        select_axis = self.obj_type()._get_block_manager_axis(0)

        axes = []
        for i in range(self.ndim):

            _start, _stop = (start, stop) if i == select_axis else (None, None)

            

Reported by Pylint.

Instance of 'BlockManagerFixed' has no 'ndim' member
Error

Line: 3184 Column: 24

                      select_axis = self.obj_type()._get_block_manager_axis(0)

        axes = []
        for i in range(self.ndim):

            _start, _stop = (start, stop) if i == select_axis else (None, None)
            ax = self.read_index(f"axis{i}", start=_start, stop=_stop)
            axes.append(ax)


            

Reported by Pylint.

pandas/tests/test_algos.py
446 issues
Unable to import 'pytest'
Error

Line: 6 Column: 1

              import struct

import numpy as np
import pytest

from pandas._libs import (
    algos as libalgos,
    hashtable as ht,
)

            

Reported by Pylint.

No name 'algos' in module 'pandas._libs'
Error

Line: 8 Column: 1

              import numpy as np
import pytest

from pandas._libs import (
    algos as libalgos,
    hashtable as ht,
)
from pandas.compat import np_array_datetime64_compat
import pandas.util._test_decorators as td

            

Reported by Pylint.

No name 'hashtable' in module 'pandas._libs'
Error

Line: 8 Column: 1

              import numpy as np
import pytest

from pandas._libs import (
    algos as libalgos,
    hashtable as ht,
)
from pandas.compat import np_array_datetime64_compat
import pandas.util._test_decorators as td

            

Reported by Pylint.

Unexpected keyword argument 'order' in function call
Error

Line: 364 Column: 13

                      # Test not valid once order keyword is removed.
        data = np.array([2 ** 63, 1, 2 ** 63], dtype=np.uint64)
        with pytest.raises(TypeError, match="got an unexpected keyword"):
            algos.factorize(data, order=True)
        with tm.assert_produces_warning(False):
            algos.factorize(data)

    @pytest.mark.parametrize(
        "data",

            

Reported by Pylint.

Method '_values' has no 'sort' member
Error

Line: 504 Column: 9

                          [np.arange(5).repeat(5), np.tile(np.arange(5), 5)]
        )
        expected = mindex.values
        expected.sort()

        mindex = mindex.repeat(2)

        result = pd.unique(mindex)
        result.sort()

            

Reported by Pylint.

Unable to import 'scipy.stats'
Error

Line: 1745 Column: 9

              class TestRank:
    @td.skip_if_no_scipy
    def test_scipy_compat(self):
        from scipy.stats import rankdata

        def _check(arr):
            mask = ~np.isfinite(arr)
            arr = arr.copy()
            result = libalgos.rank_1d(arr)

            

Reported by Pylint.

Unused variable 'ids'
Error

Line: 199 Column: 13

                      key = np.array([1, 2, 1, np.nan], dtype="O")
        rizer = ht.ObjectFactorizer(len(key))
        for na_sentinel in (-1, 20):
            ids = rizer.factorize(key, sort=True, na_sentinel=na_sentinel)
            expected = np.array([0, 1, 0, na_sentinel], dtype="int32")
            assert len(set(key)) == len(set(expected))
            tm.assert_numpy_array_equal(pd.isna(key), expected == na_sentinel)

        # nan still maps to na_sentinel when sort=False

            

Reported by Pylint.

TODO(wesm): unused?
Error

Line: 208 Column: 3

                      key = np.array([0, np.nan, 1], dtype="O")
        na_sentinel = -1

        # TODO(wesm): unused?
        ids = rizer.factorize(key, sort=False, na_sentinel=na_sentinel)  # noqa

        expected = np.array([2, -1, 0], dtype="int32")
        assert len(set(key)) == len(set(expected))
        tm.assert_numpy_array_equal(pd.isna(key), expected == na_sentinel)

            

Reported by Pylint.

Unused variable 'i'
Error

Line: 495 Column: 13

              
    def test_object_refcount_bug(self):
        lst = ["A", "B", "C", "D", "E"]
        for i in range(1000):
            len(algos.unique(lst))

    def test_on_index_object(self):

        mindex = MultiIndex.from_arrays(

            

Reported by Pylint.

Access to a protected member _from_sequence of a client class
Error

Line: 668 Column: 20

                              ]
            )
        ).unique()
        expected = DatetimeArray._from_sequence(
            np.array([Timestamp("2016-01-01 00:00:00-0500", tz="US/Eastern")])
        )
        tm.assert_extension_array_equal(result, expected)

        result = Index(

            

Reported by Pylint.

pandas/tests/indexes/test_base.py
442 issues
Unable to import 'pytest'
Error

Line: 11 Column: 1

              import re

import numpy as np
import pytest

from pandas.compat import (
    IS64,
    np_datetime64_compat,
)

            

Reported by Pylint.

Instance of 'TestIndex' has no '_index_cls' member
Error

Line: 54 Column: 16

              
    @pytest.fixture
    def simple_index(self) -> Index:
        return self._index_cls(list("abcde"))

    def test_can_hold_identifiers(self, simple_index):
        index = simple_index
        key = index[0]
        assert index._can_hold_identifiers_and_holds_name(key) is True

            

Reported by Pylint.

Instance of 'Index' has no 'tz' member
Error

Line: 146 Column: 20

                      tm.assert_index_equal(result, index)

        if has_tz:
            assert result.tz == index.tz

    def test_constructor_from_series_freq(self):
        # GH 6273
        # create from a series, passing a freq
        dts = ["1-1-1990", "2-1-1990", "3-1-1990", "4-1-1990", "5-1-1990"]

            

Reported by Pylint.

Instance of 'Index' has no 'tz_localize' member
Error

Line: 353 Column: 17

                      # the i8 values as NS_DTYPE, effectively treating them as wall times.
        index = date_range("2011-01-01", periods=5)
        arg = getattr(index, attr)
        index = index.tz_localize(tz_naive_fixture)
        dtype = index.dtype

        warn = None if tz_naive_fixture is None else FutureWarning
        # astype dt64 -> dt64tz deprecated


            

Reported by Pylint.

Instance of 'ExtensionIndex' has no 'tz_localize' member
Error

Line: 353 Column: 17

                      # the i8 values as NS_DTYPE, effectively treating them as wall times.
        index = date_range("2011-01-01", periods=5)
        arg = getattr(index, attr)
        index = index.tz_localize(tz_naive_fixture)
        dtype = index.dtype

        warn = None if tz_naive_fixture is None else FutureWarning
        # astype dt64 -> dt64tz deprecated


            

Reported by Pylint.

Instance of 'Index' has no '_with_freq' member
Error

Line: 389 Column: 17

                  @pytest.mark.parametrize("klass", [Index, TimedeltaIndex])
    def test_constructor_dtypes_timedelta(self, attr, klass):
        index = pd.timedelta_range("1 days", periods=5)
        index = index._with_freq(None)  # won't be preserved by constructors
        dtype = index.dtype

        values = getattr(index, attr)

        result = klass(values, dtype=dtype)

            

Reported by Pylint.

Instance of 'ExtensionIndex' has no '_with_freq' member
Error

Line: 389 Column: 17

                  @pytest.mark.parametrize("klass", [Index, TimedeltaIndex])
    def test_constructor_dtypes_timedelta(self, attr, klass):
        index = pd.timedelta_range("1 days", periods=5)
        index = index._with_freq(None)  # won't be preserved by constructors
        dtype = index.dtype

        values = getattr(index, attr)

        result = klass(values, dtype=dtype)

            

Reported by Pylint.

Unable to import 'IPython.core.completer'
Error

Line: 1374 Column: 9

                  async def test_tab_complete_warning(self, ip):
        # https://github.com/pandas-dev/pandas/issues/16409
        pytest.importorskip("IPython", minversion="6.0.0")
        from IPython.core.completer import provisionalcompleter

        code = "import pandas as pd; idx = pd.Index([1, 2])"
        await ip.run_code(code)

        # GH 31324 newer jedi version raises Deprecation warning;

            

Reported by Pylint.

Instance of 'TestMixedIntIndex' has no '_index_cls' member
Error

Line: 1428 Column: 16

              
    @pytest.fixture
    def simple_index(self) -> Index:
        return self._index_cls([0, "a", 1, "b", 2, "c"])

    @pytest.fixture(params=[[0, "a", 1, "b", 2, "c"]], ids=["mixedIndex"])
    def index(self, request):
        return Index(request.param)


            

Reported by Pylint.

Unexpected keyword argument 'fastpath' in constructor call
Error

Line: 1695 Column: 9

                      Index(np.array(["a", "b"], dtype=object), name="test", fastpath=True)

    with pytest.raises(TypeError, match=msg):
        Int64Index(np.array([1, 2, 3], dtype="int64"), name="test", fastpath=True)

    with pytest.raises(TypeError, match=msg):
        RangeIndex(0, 5, 2, name="test", fastpath=True)

    with pytest.raises(TypeError, match=msg):

            

Reported by Pylint.

pandas/tests/tools/test_to_datetime.py
440 issues
Unable to import 'pytest'
Error

Line: 15 Column: 1

              from dateutil.parser import parse
from dateutil.tz.tz import tzoffset
import numpy as np
import pytest
import pytz

from pandas._libs import tslib
from pandas._libs.tslibs import (
    iNaT,

            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 16 Column: 1

              from dateutil.tz.tz import tzoffset
import numpy as np
import pytest
import pytz

from pandas._libs import tslib
from pandas._libs.tslibs import (
    iNaT,
    parsing,

            

Reported by Pylint.

No name 'tslib' in module 'pandas._libs'
Error

Line: 18 Column: 1

              import pytest
import pytz

from pandas._libs import tslib
from pandas._libs.tslibs import (
    iNaT,
    parsing,
)
from pandas.errors import (

            

Reported by Pylint.

No name 'parsing' in module 'pandas._libs.tslibs'
Error

Line: 19 Column: 1

              import pytz

from pandas._libs import tslib
from pandas._libs.tslibs import (
    iNaT,
    parsing,
)
from pandas.errors import (
    OutOfBoundsDatetime,

            

Reported by Pylint.

Instance of 'ExtensionIndex' has no 'to_julian_date' member
Error

Line: 2321 Column: 12

              
@pytest.fixture
def julian_dates():
    return date_range("2014-1-1", periods=10).to_julian_date().values


class TestOrigin:
    def test_to_basic(self, julian_dates):
        # gh-11276, gh-11745

            

Reported by Pylint.

Instance of 'Index' has no 'to_julian_date' member
Error

Line: 2321 Column: 12

              
@pytest.fixture
def julian_dates():
    return date_range("2014-1-1", periods=10).to_julian_date().values


class TestOrigin:
    def test_to_basic(self, julian_dates):
        # gh-11276, gh-11745

            

Reported by Pylint.

Unused variable 'lang'
Error

Line: 221 Column: 9

                  def test_to_datetime_format_microsecond(self, cache):

        # these are locale dependent
        lang, _ = locale.getlocale()
        month_abbr = calendar.month_abbr[4]
        val = f"01-{month_abbr}-2011 00:00:01.978"

        format = "%d-%b-%Y %H:%M:%S.%f"
        result = to_datetime(val, format=format, cache=cache)

            

Reported by Pylint.

Redefining built-in 'format'
Error

Line: 225 Column: 9

                      month_abbr = calendar.month_abbr[4]
        val = f"01-{month_abbr}-2011 00:00:01.978"

        format = "%d-%b-%Y %H:%M:%S.%f"
        result = to_datetime(val, format=format, cache=cache)
        exp = datetime.strptime(val, format)
        assert result == exp

    @pytest.mark.parametrize("cache", [True, False])

            

Reported by Pylint.

Redefining built-in 'format'
Error

Line: 247 Column: 16

                          # ['01/10/2010 09:12:56 AM', '%m/%d/%Y %I:%M:%S %p',
            #  Timestamp('2010-01-10 09:12:56')]
        ]
        for s, format, dt in data:
            assert to_datetime(s, format=format, cache=cache) == dt

    @td.skip_if_has_locale
    @pytest.mark.parametrize("cache", [True, False])
    def test_to_datetime_with_non_exact(self, cache):

            

Reported by Pylint.

Redefining built-in 'format'
Error

Line: 287 Column: 16

                          ["2009324", "%Y%W%w", Timestamp("2009-08-13")],
            ["2013020", "%Y%U%w", Timestamp("2013-01-13")],
        ]
        for s, format, dt in data:
            assert to_datetime(s, format=format, cache=cache) == dt

    @pytest.mark.parametrize(
        "fmt,dates,expected_dates",
        [

            

Reported by Pylint.

pandas/tests/indexes/datetimes/test_timezones.py
434 issues
Unable to import 'pytest'
Error

Line: 18 Column: 1

                  tzlocal,
)
import numpy as np
import pytest
import pytz

from pandas._libs.tslibs import (
    conversion,
    timezones,

            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 19 Column: 1

              )
import numpy as np
import pytest
import pytz

from pandas._libs.tslibs import (
    conversion,
    timezones,
)

            

Reported by Pylint.

No name 'conversion' in module 'pandas._libs.tslibs'
Error

Line: 21 Column: 1

              import pytest
import pytz

from pandas._libs.tslibs import (
    conversion,
    timezones,
)
import pandas.util._test_decorators as td


            

Reported by Pylint.

No name 'timezones' in module 'pandas._libs.tslibs'
Error

Line: 21 Column: 1

              import pytest
import pytz

from pandas._libs.tslibs import (
    conversion,
    timezones,
)
import pandas.util._test_decorators as td


            

Reported by Pylint.

Instance of 'ExtensionIndex' has no 'tz_localize' member
Error

Line: 193 Column: 15

                      # Regression test for tslib.tz_convert(vals, tz1, tz2).
        # See https://github.com/pandas-dev/pandas/issues/4496 for details.
        idx = date_range(datetime(2011, 3, 26, 23), datetime(2011, 3, 27, 1), freq=freq)
        idx = idx.tz_localize("UTC")
        idx = idx.tz_convert("Europe/Moscow")

        expected = np.repeat(np.array([3, 4, 5]), np.array([n, n, 1]))
        tm.assert_index_equal(idx.hour, Index(expected))


            

Reported by Pylint.

Instance of 'Index' has no 'tz_localize' member
Error

Line: 193 Column: 15

                      # Regression test for tslib.tz_convert(vals, tz1, tz2).
        # See https://github.com/pandas-dev/pandas/issues/4496 for details.
        idx = date_range(datetime(2011, 3, 26, 23), datetime(2011, 3, 27, 1), freq=freq)
        idx = idx.tz_localize("UTC")
        idx = idx.tz_convert("Europe/Moscow")

        expected = np.repeat(np.array([3, 4, 5]), np.array([n, n, 1]))
        tm.assert_index_equal(idx.hour, Index(expected))


            

Reported by Pylint.

Instance of 'ExtensionIndex' has no 'tz_convert' member
Error

Line: 205 Column: 19

                          idx = date_range(
                "2014-03-08 23:00", "2014-03-09 09:00", freq=freq, tz="UTC"
            )
            idx = idx.tz_convert("US/Eastern")
            expected = np.repeat(
                np.array([18, 19, 20, 21, 22, 23, 0, 1, 3, 4, 5]),
                np.array([n, n, n, n, n, n, n, n, n, n, 1]),
            )
            tm.assert_index_equal(idx.hour, Index(expected))

            

Reported by Pylint.

Instance of 'Index' has no 'tz_convert' member
Error

Line: 205 Column: 19

                          idx = date_range(
                "2014-03-08 23:00", "2014-03-09 09:00", freq=freq, tz="UTC"
            )
            idx = idx.tz_convert("US/Eastern")
            expected = np.repeat(
                np.array([18, 19, 20, 21, 22, 23, 0, 1, 3, 4, 5]),
                np.array([n, n, n, n, n, n, n, n, n, n, 1]),
            )
            tm.assert_index_equal(idx.hour, Index(expected))

            

Reported by Pylint.

Instance of 'ExtensionIndex' has no 'tz_convert' member
Error

Line: 215 Column: 19

                          idx = date_range(
                "2014-03-08 18:00", "2014-03-09 05:00", freq=freq, tz="US/Eastern"
            )
            idx = idx.tz_convert("UTC")
            expected = np.repeat(
                np.array([23, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]),
                np.array([n, n, n, n, n, n, n, n, n, n, 1]),
            )
            tm.assert_index_equal(idx.hour, Index(expected))

            

Reported by Pylint.

Instance of 'Index' has no 'tz_convert' member
Error

Line: 215 Column: 19

                          idx = date_range(
                "2014-03-08 18:00", "2014-03-09 05:00", freq=freq, tz="US/Eastern"
            )
            idx = idx.tz_convert("UTC")
            expected = np.repeat(
                np.array([23, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9]),
                np.array([n, n, n, n, n, n, n, n, n, n, 1]),
            )
            tm.assert_index_equal(idx.hour, Index(expected))

            

Reported by Pylint.