The following issues were found

pandas/tests/io/json/test_ujson.py
374 issues
Unable to import 'pytest'
Error

Line: 13 Column: 1

              
import dateutil
import numpy as np
import pytest
import pytz

import pandas._libs.json as ujson
from pandas.compat import (
    IS64,

            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 14 Column: 1

              import dateutil
import numpy as np
import pytest
import pytz

import pandas._libs.json as ujson
from pandas.compat import (
    IS64,
    PY310,

            

Reported by Pylint.

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

Line: 16 Column: 1

              import pytest
import pytz

import pandas._libs.json as ujson
from pandas.compat import (
    IS64,
    PY310,
    is_platform_windows,
)

            

Reported by Pylint.

Unable to import 'pandas._libs.json'
Error

Line: 16 Column: 1

              import pytest
import pytz

import pandas._libs.json as ujson
from pandas.compat import (
    IS64,
    PY310,
    is_platform_windows,
)

            

Reported by Pylint.

Redefining name 'numpy' from outer scope (line 60)
Error

Line: 64 Column: 28

                  return request.param


def get_int32_compat_dtype(numpy, orient):
    # See GH#32527
    dtype = np.int64
    if not ((numpy is None or orient == "index") or (numpy is True and orient is None)):
        if is_platform_windows():
            dtype = np.int32

            

Reported by Pylint.

Redefining name 'orient' from outer scope (line 54)
Error

Line: 64 Column: 35

                  return request.param


def get_int32_compat_dtype(numpy, orient):
    # See GH#32527
    dtype = np.int64
    if not ((numpy is None or orient == "index") or (numpy is True and orient is None)):
        if is_platform_windows():
            dtype = np.int32

            

Reported by Pylint.

Unnecessary pass statement
Error

Line: 469 Column: 13

              
        class O2:
            member = 0
            pass

        class O1:
            member = 0
            pass


            

Reported by Pylint.

Unnecessary pass statement
Error

Line: 473 Column: 13

              
        class O1:
            member = 0
            pass

        decoded_input = O1()
        decoded_input.member = O2()
        decoded_input.member.member = decoded_input


            

Reported by Pylint.

Redefining name 'orient' from outer scope (line 54)
Error

Line: 956 Column: 30

              

class TestPandasJSONTests:
    def test_dataframe(self, orient, numpy):
        if orient == "records" and numpy:
            pytest.skip("Not idiomatic pandas")

        dtype = get_int32_compat_dtype(numpy, orient)


            

Reported by Pylint.

Redefining name 'numpy' from outer scope (line 60)
Error

Line: 956 Column: 38

              

class TestPandasJSONTests:
    def test_dataframe(self, orient, numpy):
        if orient == "records" and numpy:
            pytest.skip("Not idiomatic pandas")

        dtype = get_int32_compat_dtype(numpy, orient)


            

Reported by Pylint.

pandas/tests/plotting/test_series.py
362 issues
Unable to import 'pytest'
Error

Line: 8 Column: 1

              from itertools import chain

import numpy as np
import pytest

import pandas.util._test_decorators as td

import pandas as pd
from pandas import (

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 83 Column: 17

              
    def test_plot_figsize_and_title(self):
        # figsize and title
        _, ax = self.plt.subplots()
        ax = self.series.plot(title="Test", figsize=(16, 8), ax=ax)
        self._check_text_labels(ax.title, "Test")
        self._check_axes_shape(ax, axes_num=1, layout=(1, 1), figsize=(16, 8))

    def test_dont_modify_rcParams(self):

            

Reported by Pylint.

Method 'plt' has no 'rcParams' member
Error

Line: 91 Column: 18

                  def test_dont_modify_rcParams(self):
        # GH 8242
        key = "axes.prop_cycle"
        colors = self.plt.rcParams[key]
        _, ax = self.plt.subplots()
        Series([1, 2, 3]).plot(ax=ax)
        assert colors == self.plt.rcParams[key]

    def test_ts_line_lim(self):

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 92 Column: 17

                      # GH 8242
        key = "axes.prop_cycle"
        colors = self.plt.rcParams[key]
        _, ax = self.plt.subplots()
        Series([1, 2, 3]).plot(ax=ax)
        assert colors == self.plt.rcParams[key]

    def test_ts_line_lim(self):
        fig, ax = self.plt.subplots()

            

Reported by Pylint.

Method 'plt' has no 'rcParams' member
Error

Line: 94 Column: 26

                      colors = self.plt.rcParams[key]
        _, ax = self.plt.subplots()
        Series([1, 2, 3]).plot(ax=ax)
        assert colors == self.plt.rcParams[key]

    def test_ts_line_lim(self):
        fig, ax = self.plt.subplots()
        ax = self.ts.plot(ax=ax)
        xmin, xmax = ax.get_xlim()

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 97 Column: 19

                      assert colors == self.plt.rcParams[key]

    def test_ts_line_lim(self):
        fig, ax = self.plt.subplots()
        ax = self.ts.plot(ax=ax)
        xmin, xmax = ax.get_xlim()
        lines = ax.get_lines()
        assert xmin <= lines[0].get_data(orig=False)[0][0]
        assert xmax >= lines[0].get_data(orig=False)[0][-1]

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 112 Column: 17

                      assert xmax >= lines[0].get_data(orig=False)[0][-1]

    def test_ts_area_lim(self):
        _, ax = self.plt.subplots()
        ax = self.ts.plot.area(stacked=False, ax=ax)
        xmin, xmax = ax.get_xlim()
        line = ax.get_lines()[0].get_data(orig=False)[0]
        assert xmin <= line[0]
        assert xmax >= line[-1]

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 122 Column: 17

                      tm.close()

        # GH 7471
        _, ax = self.plt.subplots()
        ax = self.ts.plot.area(stacked=False, x_compat=True, ax=ax)
        xmin, xmax = ax.get_xlim()
        line = ax.get_lines()[0].get_data(orig=False)[0]
        assert xmin <= line[0]
        assert xmax >= line[-1]

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 133 Column: 17

              
        tz_ts = self.ts.copy()
        tz_ts.index = tz_ts.tz_localize("GMT").tz_convert("CET")
        _, ax = self.plt.subplots()
        ax = tz_ts.plot.area(stacked=False, x_compat=True, ax=ax)
        xmin, xmax = ax.get_xlim()
        line = ax.get_lines()[0].get_data(orig=False)[0]
        assert xmin <= line[0]
        assert xmax >= line[-1]

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 142 Column: 17

                      self._check_ticks_props(ax, xrot=0)
        tm.close()

        _, ax = self.plt.subplots()
        ax = tz_ts.plot.area(stacked=False, secondary_y=True, ax=ax)
        xmin, xmax = ax.get_xlim()
        line = ax.get_lines()[0].get_data(orig=False)[0]
        assert xmin <= line[0]
        assert xmax >= line[-1]

            

Reported by Pylint.

pandas/tests/arrays/sparse/test_array.py
356 issues
Unable to import 'pytest'
Error

Line: 6 Column: 1

              import warnings

import numpy as np
import pytest

from pandas._libs.sparse import IntIndex
import pandas.util._test_decorators as td

import pandas as pd

            

Reported by Pylint.

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

Line: 8 Column: 1

              import numpy as np
import pytest

from pandas._libs.sparse import IntIndex
import pandas.util._test_decorators as td

import pandas as pd
from pandas import isna
import pandas._testing as tm

            

Reported by Pylint.

Unable to import 'pandas._libs.sparse'
Error

Line: 8 Column: 1

              import numpy as np
import pytest

from pandas._libs.sparse import IntIndex
import pandas.util._test_decorators as td

import pandas as pd
from pandas import isna
import pandas._testing as tm

            

Reported by Pylint.

Unable to import 'scipy.sparse'
Error

Line: 197 Column: 9

                  @pytest.mark.parametrize("size", [0, 10])
    @td.skip_if_no_scipy
    def test_from_spmatrix(self, size, format):
        import scipy.sparse

        mat = scipy.sparse.random(size, 1, density=0.5, format=format)
        result = SparseArray.from_spmatrix(mat)

        result = np.asarray(result)

            

Reported by Pylint.

Unable to import 'scipy.sparse'
Error

Line: 209 Column: 9

                  @pytest.mark.parametrize("format", ["coo", "csc", "csr"])
    @td.skip_if_no_scipy
    def test_from_spmatrix_including_explicit_zero(self, format):
        import scipy.sparse

        mat = scipy.sparse.random(10, 1, density=0.5, format=format)
        mat.data[0] = 0
        result = SparseArray.from_spmatrix(mat)


            

Reported by Pylint.

Unable to import 'scipy.sparse'
Error

Line: 221 Column: 9

              
    @td.skip_if_no_scipy
    def test_from_spmatrix_raises(self):
        import scipy.sparse

        mat = scipy.sparse.eye(5, 4, format="csc")

        with pytest.raises(ValueError, match="not '4'"):
            SparseArray.from_spmatrix(mat)

            

Reported by Pylint.

Instance of 'int' has no 'dtype' member
Error

Line: 720 Column: 16

                  def test_boolean_slice_empty(self):
        arr = SparseArray([0, 1, 2])
        res = arr[[False, False, False]]
        assert res.dtype == arr.dtype

    @pytest.mark.parametrize("op", ["add", "sub", "mul", "truediv", "floordiv", "pow"])
    def test_binary_operators(self, op):
        op = getattr(operator, op)
        data1 = np.random.randn(20)

            

Reported by Pylint.

Unable to import 'scipy.sparse'
Error

Line: 1183 Column: 9

              
    @td.skip_if_no_scipy
    def test_from_coo(self):
        import scipy.sparse

        row = [0, 3, 1, 0]
        col = [0, 3, 1, 2]
        data = [4, 5, 7, 9]
        # TODO: Remove dtype when scipy is fixed

            

Reported by Pylint.

Unable to import 'scipy.sparse'
Error

Line: 1199 Column: 9

              
    @td.skip_if_no_scipy
    def test_to_coo(self):
        import scipy.sparse

        ser = pd.Series(
            [1, 2, 3],
            index=pd.MultiIndex.from_product([[0], [1, 2, 3]], names=["a", "b"]),
            dtype="Sparse[int]",

            

Reported by Pylint.

Unused argument 'method'
Error

Line: 21 Column: 28

              

class TestSparseArray:
    def setup_method(self, method):
        self.arr_data = np.array([np.nan, np.nan, 1, 2, 3, np.nan, 4, 5, np.nan, 6])
        self.arr = SparseArray(self.arr_data)
        self.zarr = SparseArray([0, 0, 1, 2, 3, 0, 4, 5, 0, 6], fill_value=0)

    def test_constructor_dtype(self):

            

Reported by Pylint.

pandas/tests/arrays/test_datetimelike.py
350 issues
Unable to import 'pytest'
Error

Line: 6 Column: 1

              import re

import numpy as np
import pytest

from pandas._libs import (
    NaT,
    OutOfBoundsDatetime,
    Timestamp,

            

Reported by Pylint.

Instance of 'SharedTests' has no 'array_cls' member
Error

Line: 85 Column: 15

                  @pytest.fixture
    def arr1d(self):
        data = np.arange(10, dtype="i8") * 24 * 3600 * 10 ** 9
        arr = self.array_cls(data, freq="D")
        return arr

    def test_compare_len1_raises(self, arr1d):
        # make sure we raise when comparing with different lengths, specific
        #  to the case where one has length-1, which numpy would broadcast

            

Reported by Pylint.

Instance of 'SharedTests' has no 'array_cls' member
Error

Line: 154 Column: 24

                      data = np.arange(100, dtype="i8") * 24 * 3600 * 10 ** 9
        np.random.shuffle(data)

        freq = None if self.array_cls is not PeriodArray else "D"

        arr = self.array_cls(data, freq=freq)
        idx = self.index_cls._simple_new(arr)

        takers = [1, 4, 94]

            

Reported by Pylint.

Instance of 'SharedTests' has no 'array_cls' member
Error

Line: 156 Column: 15

              
        freq = None if self.array_cls is not PeriodArray else "D"

        arr = self.array_cls(data, freq=freq)
        idx = self.index_cls._simple_new(arr)

        takers = [1, 4, 94]
        result = arr.take(takers)
        expected = idx.take(takers)

            

Reported by Pylint.

Instance of 'SharedTests' has no 'array_cls' member
Error

Line: 175 Column: 15

                  def test_take_fill_raises(self, fill_value):
        data = np.arange(10, dtype="i8") * 24 * 3600 * 10 ** 9

        arr = self.array_cls(data, freq="D")

        msg = f"value should be a '{arr._scalar_type.__name__}' or 'NaT'. Got"
        with pytest.raises(TypeError, match=msg):
            arr.take([0, 1], allow_fill=True, fill_value=fill_value)


            

Reported by Pylint.

Instance of 'SharedTests' has no 'array_cls' member
Error

Line: 184 Column: 15

                  def test_take_fill(self):
        data = np.arange(10, dtype="i8") * 24 * 3600 * 10 ** 9

        arr = self.array_cls(data, freq="D")

        result = arr.take([-1, 1], allow_fill=True, fill_value=None)
        assert result[0] is NaT

        result = arr.take([-1, 1], allow_fill=True, fill_value=np.nan)

            

Reported by Pylint.

Instance of 'SharedTests' has no 'array_cls' member
Error

Line: 209 Column: 15

                      arr = arr1d
        idx = self.index_cls(arr)
        idx = idx.insert(0, NaT)
        arr = self.array_cls(idx)

        result = arr._concat_same_type([arr[:-1], arr[1:], arr])
        arr2 = arr.astype(object)
        expected = self.index_cls(np.concatenate([arr2[:-1], arr2[1:], arr2]), None)


            

Reported by Pylint.

Instance of 'SharedTests' has no 'array_cls' member
Error

Line: 219 Column: 15

              
    def test_unbox_scalar(self):
        data = np.arange(10, dtype="i8") * 24 * 3600 * 10 ** 9
        arr = self.array_cls(data, freq="D")
        result = arr._unbox_scalar(arr[0])
        expected = arr._data.dtype.type
        assert isinstance(result, expected)

        result = arr._unbox_scalar(NaT)

            

Reported by Pylint.

Instance of 'SharedTests' has no 'scalar_type' member
Error

Line: 227 Column: 38

                      result = arr._unbox_scalar(NaT)
        assert isinstance(result, expected)

        msg = f"'value' should be a {self.scalar_type.__name__}."
        with pytest.raises(ValueError, match=msg):
            arr._unbox_scalar("foo")

    def test_check_compatible_with(self):
        data = np.arange(10, dtype="i8") * 24 * 3600 * 10 ** 9

            

Reported by Pylint.

Instance of 'SharedTests' has no 'array_cls' member
Error

Line: 233 Column: 15

              
    def test_check_compatible_with(self):
        data = np.arange(10, dtype="i8") * 24 * 3600 * 10 ** 9
        arr = self.array_cls(data, freq="D")

        arr._check_compatible_with(arr[0])
        arr._check_compatible_with(arr[:1])
        arr._check_compatible_with(NaT)


            

Reported by Pylint.

pandas/tests/frame/indexing/test_indexing.py
346 issues
Unable to import 'pytest'
Error

Line: 8 Column: 1

              import re

import numpy as np
import pytest

from pandas._libs import iNaT
import pandas.util._test_decorators as td

from pandas.core.dtypes.common import is_integer

            

Reported by Pylint.

Access to a protected member _series of a client class
Error

Line: 46 Column: 23

                          assert len(series.index) == 20
            assert tm.equalContents(series.index, sl.index)

        for key, _ in float_frame._series.items():
            assert float_frame[key] is not None

        assert "random" not in float_frame
        with pytest.raises(KeyError, match="random"):
            float_frame["random"]

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 51 Column: 13

              
        assert "random" not in float_frame
        with pytest.raises(KeyError, match="random"):
            float_frame["random"]

    def test_getitem2(self, float_frame):

        df = float_frame.copy()
        df["$10"] = np.random.randn(len(df))

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 113 Column: 13

              
        tm.assert_index_equal(subindex, subframe.index)
        with pytest.raises(ValueError, match="Item wrong length"):
            datetime_frame[indexer[:-1]]

        subframe_obj = datetime_frame[indexer_obj]
        tm.assert_frame_equal(subframe_obj, subframe)

        with pytest.raises(ValueError, match="Boolean array expected"):

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 119 Column: 13

                      tm.assert_frame_equal(subframe_obj, subframe)

        with pytest.raises(ValueError, match="Boolean array expected"):
            datetime_frame[datetime_frame]

        # test that Series work
        indexer_obj = Series(indexer_obj, datetime_frame.index)

        subframe_obj = datetime_frame[indexer_obj]

            

Reported by Pylint.

Access to a protected member _get_numeric_data of a client class
Error

Line: 143 Column: 20

                          mixed_int_frame,
        ]:

            data = df._get_numeric_data()
            bif = df[df > 0]
            bifw = DataFrame(
                {c: np.where(data[c] > 0, data[c], np.nan) for c in data.columns},
                index=data.index,
                columns=data.columns,

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 226 Column: 9

                      # both of these should succeed trivially
        k = np.array([], bool)

        blah[k]
        blah[k] = 0

    def test_getitem_ix_mixed_integer(self):
        df = DataFrame(
            np.random.randn(4, 3), index=[1, 10, "C", "E"], columns=[1, 2, 3]

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 264 Column: 13

                      tm.assert_series_equal(float_frame.A, float_frame["A"])
        msg = "'DataFrame' object has no attribute 'NONEXISTENT_NAME'"
        with pytest.raises(AttributeError, match=msg):
            float_frame.NONEXISTENT_NAME

    def test_setattr_column(self):
        df = DataFrame({"foobar": 1}, index=range(10))

        df.foobar = 5

            

Reported by Pylint.

Unused variable 'result'
Error

Line: 507 Column: 9

                      df = DataFrame(np.random.randn(10, 5))

        # this is OK
        result = df.iloc[:8:2]  # noqa
        df.iloc[:8:2] = np.nan
        assert isna(df.iloc[:8:2]).values.all()

    def test_getitem_setitem_integer_slice_keyerrors(self):
        df = DataFrame(np.random.randn(10, 5), index=range(0, 20, 2))

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 534 Column: 13

                      # non-monotonic, raise KeyError
        df2 = df.iloc[list(range(5)) + list(range(5, 10))[::-1]]
        with pytest.raises(KeyError, match=r"^3$"):
            df2.loc[3:11]
        with pytest.raises(KeyError, match=r"^3$"):
            df2.loc[3:11] = 0

    @td.skip_array_manager_invalid_test  # already covered in test_iloc_col_slice_view
    def test_fancy_getitem_slice_mixed(self, float_frame, float_string_frame):

            

Reported by Pylint.

pandas/core/generic.py
344 issues
No name 'lib' in module 'pandas._libs'
Error

Line: 31 Column: 1

              
from pandas._config import config

from pandas._libs import lib
from pandas._libs.tslibs import (
    Period,
    Tick,
    Timestamp,
    to_offset,

            

Reported by Pylint.

Unused argument 'copy'
Error

Line: 238 Column: 9

                  def __init__(
        self,
        data: Manager,
        copy: bool_t = False,
        attrs: Mapping[Hashable, Any] | None = None,
    ):
        # copy kwarg is retained for mypy compat, is not used

        object.__setattr__(self, "_is_copy", None)

            

Reported by Pylint.

Consider explicitly re-raising using the 'from' keyword
Error

Line: 550 Column: 13

                      try:
            return cls._AXIS_TO_AXIS_NUMBER[axis]
        except KeyError:
            raise ValueError(f"No axis named {axis} for object type {cls.__name__}")

    @final
    @classmethod
    def _get_axis_name(cls, axis: Axis) -> str:
        axis_number = cls._get_axis_number(axis)

            

Reported by Pylint.

Access to a protected member _get_level_number of a client class
Error

Line: 1145 Column: 25

                          f = com.get_rename_function(replacements)

            if level is not None:
                level = ax._get_level_number(level)

            # GH 13473
            if not callable(replacements):
                indexer = ax.get_indexer_for(replacements)
                if errors == "raise" and len(indexer[indexer == -1]):

            

Reported by Pylint.

Access to a protected member _transform_index of a client class
Error

Line: 1158 Column: 25

                                  ]
                    raise KeyError(f"{missing_labels} not found in axis")

            new_index = ax._transform_index(f, level=level)
            result._set_axis_nocheck(new_index, axis=axis_no, inplace=True)
            result._clear_item_cache()

        if inplace:
            self._update_inplace(result)

            

Reported by Pylint.

Access to a protected member _set_axis_nocheck of a client class
Error

Line: 1159 Column: 13

                                  raise KeyError(f"{missing_labels} not found in axis")

            new_index = ax._transform_index(f, level=level)
            result._set_axis_nocheck(new_index, axis=axis_no, inplace=True)
            result._clear_item_cache()

        if inplace:
            self._update_inplace(result)
            return None

            

Reported by Pylint.

Access to a protected member _clear_item_cache of a client class
Error

Line: 1160 Column: 13

              
            new_index = ax._transform_index(f, level=level)
            result._set_axis_nocheck(new_index, axis=axis_no, inplace=True)
            result._clear_item_cache()

        if inplace:
            self._update_inplace(result)
            return None
        else:

            

Reported by Pylint.

Access to a protected member _set_axis_name of a client class
Error

Line: 1335 Column: 17

                                  f = com.get_rename_function(v)
                    curnames = self._get_axis(axis).names
                    newnames = [f(name) for name in curnames]
                result._set_axis_name(newnames, axis=axis, inplace=True)
            if not inplace:
                return result

    @final
    def _set_axis_name(self, name, axis=0, inplace=False):

            

Reported by Pylint.

Access to a protected member _get_axis of a client class
Error

Line: 1405 Column: 38

                  @final
    def _indexed_same(self, other) -> bool_t:
        return all(
            self._get_axis(a).equals(other._get_axis(a)) for a in self._AXIS_ORDERS
        )

    @final
    def equals(self, other: object) -> bool_t:
        """

            

Reported by Pylint.

Access to a protected member _mgr of a client class
Error

Line: 1490 Column: 33

                      if not (isinstance(other, type(self)) or isinstance(self, type(other))):
            return False
        other = cast(NDFrame, other)
        return self._mgr.equals(other._mgr)

    # -------------------------------------------------------------------------
    # Unary Methods

    @final

            

Reported by Pylint.

asv_bench/benchmarks/frame_methods.py
328 issues
Unable to import 'pandas'
Error

Line: 6 Column: 1

              
import numpy as np

from pandas import (
    DataFrame,
    MultiIndex,
    NaT,
    Series,
    date_range,

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 17 Column: 1

                  timedelta_range,
)

from .pandas_vb_common import tm


class GetNumericData:
    def setup(self):
        self.df = DataFrame(np.random.randn(10000, 25))

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 758 Column: 1

                      self.df2.memory_usage(deep=True)


from .pandas_vb_common import setup  # noqa: F401 isort:skip

            

Reported by Pylint.

Attribute 'df' defined outside __init__
Error

Line: 22 Column: 9

              
class GetNumericData:
    def setup(self):
        self.df = DataFrame(np.random.randn(10000, 25))
        self.df["foo"] = "bar"
        self.df["bar"] = "baz"
        self.df = self.df._consolidate()

    def time_frame_get_numeric_data(self):

            

Reported by Pylint.

Access to a protected member _consolidate of a client class
Error

Line: 25 Column: 19

                      self.df = DataFrame(np.random.randn(10000, 25))
        self.df["foo"] = "bar"
        self.df["bar"] = "baz"
        self.df = self.df._consolidate()

    def time_frame_get_numeric_data(self):
        self.df._get_numeric_data()



            

Reported by Pylint.

Attribute 'df' defined outside __init__
Error

Line: 25 Column: 9

                      self.df = DataFrame(np.random.randn(10000, 25))
        self.df["foo"] = "bar"
        self.df["bar"] = "baz"
        self.df = self.df._consolidate()

    def time_frame_get_numeric_data(self):
        self.df._get_numeric_data()



            

Reported by Pylint.

Access to a protected member _get_numeric_data of a client class
Error

Line: 28 Column: 9

                      self.df = self.df._consolidate()

    def time_frame_get_numeric_data(self):
        self.df._get_numeric_data()


class Lookup:
    def setup(self):
        self.df = DataFrame(np.random.randn(10000, 8), columns=list("abcdefgh"))

            

Reported by Pylint.

Attribute 'df' defined outside __init__
Error

Line: 33 Column: 9

              
class Lookup:
    def setup(self):
        self.df = DataFrame(np.random.randn(10000, 8), columns=list("abcdefgh"))
        self.df["foo"] = "bar"
        self.row_labels = list(self.df.index[::10])[:900]
        self.col_labels = list(self.df.columns) * 100
        self.row_labels_all = np.array(
            list(self.df.index) * len(self.df.columns), dtype="object"

            

Reported by Pylint.

Attribute 'row_labels' defined outside __init__
Error

Line: 35 Column: 9

                  def setup(self):
        self.df = DataFrame(np.random.randn(10000, 8), columns=list("abcdefgh"))
        self.df["foo"] = "bar"
        self.row_labels = list(self.df.index[::10])[:900]
        self.col_labels = list(self.df.columns) * 100
        self.row_labels_all = np.array(
            list(self.df.index) * len(self.df.columns), dtype="object"
        )
        self.col_labels_all = np.array(

            

Reported by Pylint.

Attribute 'col_labels' defined outside __init__
Error

Line: 36 Column: 9

                      self.df = DataFrame(np.random.randn(10000, 8), columns=list("abcdefgh"))
        self.df["foo"] = "bar"
        self.row_labels = list(self.df.index[::10])[:900]
        self.col_labels = list(self.df.columns) * 100
        self.row_labels_all = np.array(
            list(self.df.index) * len(self.df.columns), dtype="object"
        )
        self.col_labels_all = np.array(
            list(self.df.columns) * len(self.df.index), dtype="object"

            

Reported by Pylint.

pandas/tests/indexes/datetimes/test_date_range.py
328 issues
Unable to import 'pytest'
Error

Line: 12 Column: 1

              )

import numpy as np
import pytest
import pytz
from pytz import timezone

from pandas._libs.tslibs import timezones
from pandas._libs.tslibs.offsets import (

            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 13 Column: 1

              
import numpy as np
import pytest
import pytz
from pytz import timezone

from pandas._libs.tslibs import timezones
from pandas._libs.tslibs.offsets import (
    BDay,

            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 14 Column: 1

              import numpy as np
import pytest
import pytz
from pytz import timezone

from pandas._libs.tslibs import timezones
from pandas._libs.tslibs.offsets import (
    BDay,
    CDay,

            

Reported by Pylint.

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

Line: 16 Column: 1

              import pytz
from pytz import timezone

from pandas._libs.tslibs import timezones
from pandas._libs.tslibs.offsets import (
    BDay,
    CDay,
    DateOffset,
    MonthEnd,

            

Reported by Pylint.

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

Line: 17 Column: 1

              from pytz import timezone

from pandas._libs.tslibs import timezones
from pandas._libs.tslibs.offsets import (
    BDay,
    CDay,
    DateOffset,
    MonthEnd,
    prefix_mapping,

            

Reported by Pylint.

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

Line: 17 Column: 1

              from pytz import timezone

from pandas._libs.tslibs import timezones
from pandas._libs.tslibs.offsets import (
    BDay,
    CDay,
    DateOffset,
    MonthEnd,
    prefix_mapping,

            

Reported by Pylint.

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

Line: 71 Column: 9

              
    @td.skip_if_windows_python_3
    def test_date_range_timestamp_equiv_explicit_dateutil(self):
        from pandas._libs.tslibs.timezones import dateutil_gettz as gettz

        rng = date_range("20090415", "20090519", tz=gettz("US/Eastern"))
        stamp = rng[0]

        ts = Timestamp("20090415", tz=gettz("US/Eastern"))

            

Reported by Pylint.

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

Line: 71 Column: 9

              
    @td.skip_if_windows_python_3
    def test_date_range_timestamp_equiv_explicit_dateutil(self):
        from pandas._libs.tslibs.timezones import dateutil_gettz as gettz

        rng = date_range("20090415", "20090519", tz=gettz("US/Eastern"))
        stamp = rng[0]

        ts = Timestamp("20090415", tz=gettz("US/Eastern"))

            

Reported by Pylint.

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

Line: 218 Column: 16

                      rng = date_range("2011-12-31", freq="-2A", periods=3)
        exp = DatetimeIndex(["2011-12-31", "2009-12-31", "2007-12-31"], freq="-2A")
        tm.assert_index_equal(rng, exp)
        assert rng.freq == "-2A"

        rng = date_range("2011-01-31", freq="-2M", periods=3)
        exp = DatetimeIndex(["2011-01-31", "2010-11-30", "2010-09-30"], freq="-2M")
        tm.assert_index_equal(rng, exp)
        assert rng.freq == "-2M"

            

Reported by Pylint.

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

Line: 218 Column: 16

                      rng = date_range("2011-12-31", freq="-2A", periods=3)
        exp = DatetimeIndex(["2011-12-31", "2009-12-31", "2007-12-31"], freq="-2A")
        tm.assert_index_equal(rng, exp)
        assert rng.freq == "-2A"

        rng = date_range("2011-01-31", freq="-2M", periods=3)
        exp = DatetimeIndex(["2011-01-31", "2010-11-30", "2010-09-30"], freq="-2M")
        tm.assert_index_equal(rng, exp)
        assert rng.freq == "-2M"

            

Reported by Pylint.

pandas/tests/io/test_stata.py
328 issues
Unable to import 'pytest'
Error

Line: 13 Column: 1

              import zipfile

import numpy as np
import pytest

from pandas.core.dtypes.common import is_categorical_dtype

import pandas as pd
import pandas._testing as tm

            

Reported by Pylint.

Redefining name 'dirpath' from outer scope (line 50)
Error

Line: 55 Column: 16

              

@pytest.fixture
def parsed_114(dirpath):
    dta14_114 = os.path.join(dirpath, "stata5_114.dta")
    parsed_114 = read_stata(dta14_114, convert_dates=True)
    parsed_114.index.name = "index"
    return parsed_114


            

Reported by Pylint.

Redefining name 'parsed_114' from outer scope (line 55)
Error

Line: 57 Column: 5

              @pytest.fixture
def parsed_114(dirpath):
    dta14_114 = os.path.join(dirpath, "stata5_114.dta")
    parsed_114 = read_stata(dta14_114, convert_dates=True)
    parsed_114.index.name = "index"
    return parsed_114


class TestStata:

            

Reported by Pylint.

Attribute 'dirpath' defined outside __init__
Error

Line: 65 Column: 9

              class TestStata:
    @pytest.fixture(autouse=True)
    def setup_method(self, datapath):
        self.dirpath = datapath("io", "data", "stata")
        self.dta1_114 = os.path.join(self.dirpath, "stata1_114.dta")
        self.dta1_117 = os.path.join(self.dirpath, "stata1_117.dta")

        self.dta2_113 = os.path.join(self.dirpath, "stata2_113.dta")
        self.dta2_114 = os.path.join(self.dirpath, "stata2_114.dta")

            

Reported by Pylint.

Attribute 'dta1_114' defined outside __init__
Error

Line: 66 Column: 9

                  @pytest.fixture(autouse=True)
    def setup_method(self, datapath):
        self.dirpath = datapath("io", "data", "stata")
        self.dta1_114 = os.path.join(self.dirpath, "stata1_114.dta")
        self.dta1_117 = os.path.join(self.dirpath, "stata1_117.dta")

        self.dta2_113 = os.path.join(self.dirpath, "stata2_113.dta")
        self.dta2_114 = os.path.join(self.dirpath, "stata2_114.dta")
        self.dta2_115 = os.path.join(self.dirpath, "stata2_115.dta")

            

Reported by Pylint.

Attribute 'dta1_117' defined outside __init__
Error

Line: 67 Column: 9

                  def setup_method(self, datapath):
        self.dirpath = datapath("io", "data", "stata")
        self.dta1_114 = os.path.join(self.dirpath, "stata1_114.dta")
        self.dta1_117 = os.path.join(self.dirpath, "stata1_117.dta")

        self.dta2_113 = os.path.join(self.dirpath, "stata2_113.dta")
        self.dta2_114 = os.path.join(self.dirpath, "stata2_114.dta")
        self.dta2_115 = os.path.join(self.dirpath, "stata2_115.dta")
        self.dta2_117 = os.path.join(self.dirpath, "stata2_117.dta")

            

Reported by Pylint.

Attribute 'dta2_113' defined outside __init__
Error

Line: 69 Column: 9

                      self.dta1_114 = os.path.join(self.dirpath, "stata1_114.dta")
        self.dta1_117 = os.path.join(self.dirpath, "stata1_117.dta")

        self.dta2_113 = os.path.join(self.dirpath, "stata2_113.dta")
        self.dta2_114 = os.path.join(self.dirpath, "stata2_114.dta")
        self.dta2_115 = os.path.join(self.dirpath, "stata2_115.dta")
        self.dta2_117 = os.path.join(self.dirpath, "stata2_117.dta")

        self.dta3_113 = os.path.join(self.dirpath, "stata3_113.dta")

            

Reported by Pylint.

Attribute 'dta2_114' defined outside __init__
Error

Line: 70 Column: 9

                      self.dta1_117 = os.path.join(self.dirpath, "stata1_117.dta")

        self.dta2_113 = os.path.join(self.dirpath, "stata2_113.dta")
        self.dta2_114 = os.path.join(self.dirpath, "stata2_114.dta")
        self.dta2_115 = os.path.join(self.dirpath, "stata2_115.dta")
        self.dta2_117 = os.path.join(self.dirpath, "stata2_117.dta")

        self.dta3_113 = os.path.join(self.dirpath, "stata3_113.dta")
        self.dta3_114 = os.path.join(self.dirpath, "stata3_114.dta")

            

Reported by Pylint.

Attribute 'dta2_115' defined outside __init__
Error

Line: 71 Column: 9

              
        self.dta2_113 = os.path.join(self.dirpath, "stata2_113.dta")
        self.dta2_114 = os.path.join(self.dirpath, "stata2_114.dta")
        self.dta2_115 = os.path.join(self.dirpath, "stata2_115.dta")
        self.dta2_117 = os.path.join(self.dirpath, "stata2_117.dta")

        self.dta3_113 = os.path.join(self.dirpath, "stata3_113.dta")
        self.dta3_114 = os.path.join(self.dirpath, "stata3_114.dta")
        self.dta3_115 = os.path.join(self.dirpath, "stata3_115.dta")

            

Reported by Pylint.

Attribute 'dta2_117' defined outside __init__
Error

Line: 72 Column: 9

                      self.dta2_113 = os.path.join(self.dirpath, "stata2_113.dta")
        self.dta2_114 = os.path.join(self.dirpath, "stata2_114.dta")
        self.dta2_115 = os.path.join(self.dirpath, "stata2_115.dta")
        self.dta2_117 = os.path.join(self.dirpath, "stata2_117.dta")

        self.dta3_113 = os.path.join(self.dirpath, "stata3_113.dta")
        self.dta3_114 = os.path.join(self.dirpath, "stata3_114.dta")
        self.dta3_115 = os.path.join(self.dirpath, "stata3_115.dta")
        self.dta3_117 = os.path.join(self.dirpath, "stata3_117.dta")

            

Reported by Pylint.

pandas/core/frame.py
324 issues
No name 'algos' in module 'pandas._libs'
Error

Line: 42 Column: 1

              
from pandas._config import get_option

from pandas._libs import (
    algos as libalgos,
    lib,
    properties,
)
from pandas._libs.hashtable import duplicated

            

Reported by Pylint.

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

Line: 42 Column: 1

              
from pandas._config import get_option

from pandas._libs import (
    algos as libalgos,
    lib,
    properties,
)
from pandas._libs.hashtable import duplicated

            

Reported by Pylint.

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

Line: 42 Column: 1

              
from pandas._config import get_option

from pandas._libs import (
    algos as libalgos,
    lib,
    properties,
)
from pandas._libs.hashtable import duplicated

            

Reported by Pylint.

Unable to import 'pandas._libs.hashtable'
Error

Line: 47 Column: 1

                  lib,
    properties,
)
from pandas._libs.hashtable import duplicated
from pandas._libs.lib import no_default
from pandas._typing import (
    AggFuncType,
    AnyArrayLike,
    ArrayLike,

            

Reported by Pylint.

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

Line: 47 Column: 1

                  lib,
    properties,
)
from pandas._libs.hashtable import duplicated
from pandas._libs.lib import no_default
from pandas._typing import (
    AggFuncType,
    AnyArrayLike,
    ArrayLike,

            

Reported by Pylint.

Unable to import 'pandas._libs.lib'
Error

Line: 48 Column: 1

                  properties,
)
from pandas._libs.hashtable import duplicated
from pandas._libs.lib import no_default
from pandas._typing import (
    AggFuncType,
    AnyArrayLike,
    ArrayLike,
    Axes,

            

Reported by Pylint.

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

Line: 48 Column: 1

                  properties,
)
from pandas._libs.hashtable import duplicated
from pandas._libs.lib import no_default
from pandas._typing import (
    AggFuncType,
    AnyArrayLike,
    ArrayLike,
    Axes,

            

Reported by Pylint.

TODO(EA2D): special case not needed with 2D EAs
Error

Line: 748 Column: 3

              
            # For data is a scalar extension dtype
            if isinstance(dtype, ExtensionDtype):
                # TODO(EA2D): special case not needed with 2D EAs

                values = [
                    construct_1d_arraylike_from_scalar(data, len(index), dtype)
                    for _ in range(len(columns))
                ]

            

Reported by Pylint.

TODO(EA2D) special case would be unnecessary with 2D EAs
Error

Line: 869 Column: 3

                          return False

        dtype = blocks[0].dtype
        # TODO(EA2D) special case would be unnecessary with 2D EAs
        return not is_1d_only_ea_dtype(dtype)

    # error: Return type "Union[ndarray, DatetimeArray, TimedeltaArray]" of
    # "_values" incompatible with return type "ndarray" in supertype "NDFrame"
    @property

            

Reported by Pylint.

Unused variable 'height'
Error

Line: 926 Column: 16

                      users expect. display.max_columns remains in effect.
        GH3541, GH3573
        """
        width, height = console.get_console_size()
        max_columns = get_option("display.max_columns")
        nb_columns = len(self.columns)

        # exceed max columns
        if (max_columns and nb_columns > max_columns) or (

            

Reported by Pylint.