The following issues were found

pandas/tests/indexes/timedeltas/test_indexing.py
100 issues
Unable to import 'pytest'
Error

Line: 8 Column: 1

              import re

import numpy as np
import pytest

from pandas import (
    Index,
    NaT,
    Timedelta,

            

Reported by Pylint.

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

Line: 47 Column: 35

                          result = idx[0:5]
            expected = timedelta_range("1 day", "5 day", freq="D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            result = idx[0:10:2]
            expected = timedelta_range("1 day", "9 day", freq="2D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            

Reported by Pylint.

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

Line: 47 Column: 35

                          result = idx[0:5]
            expected = timedelta_range("1 day", "5 day", freq="D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            result = idx[0:10:2]
            expected = timedelta_range("1 day", "9 day", freq="2D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            

Reported by Pylint.

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

Line: 52 Column: 35

                          result = idx[0:10:2]
            expected = timedelta_range("1 day", "9 day", freq="2D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            result = idx[-20:-5:3]
            expected = timedelta_range("12 day", "24 day", freq="3D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            

Reported by Pylint.

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

Line: 52 Column: 35

                          result = idx[0:10:2]
            expected = timedelta_range("1 day", "9 day", freq="2D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            result = idx[-20:-5:3]
            expected = timedelta_range("12 day", "24 day", freq="3D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            

Reported by Pylint.

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

Line: 57 Column: 35

                          result = idx[-20:-5:3]
            expected = timedelta_range("12 day", "24 day", freq="3D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            result = idx[4::-1]
            expected = TimedeltaIndex(
                ["5 day", "4 day", "3 day", "2 day", "1 day"], freq="-1D", name="idx"
            )

            

Reported by Pylint.

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

Line: 57 Column: 35

                          result = idx[-20:-5:3]
            expected = timedelta_range("12 day", "24 day", freq="3D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            result = idx[4::-1]
            expected = TimedeltaIndex(
                ["5 day", "4 day", "3 day", "2 day", "1 day"], freq="-1D", name="idx"
            )

            

Reported by Pylint.

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

Line: 64 Column: 35

                              ["5 day", "4 day", "3 day", "2 day", "1 day"], freq="-1D", name="idx"
            )
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

    @pytest.mark.parametrize(
        "key",
        [
            Timestamp("1970-01-01"),

            

Reported by Pylint.

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

Line: 213 Column: 35

                          result = idx.take([0, 1, 2])
            expected = timedelta_range("1 day", "3 day", freq="D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            result = idx.take([0, 2, 4])
            expected = timedelta_range("1 day", "5 day", freq="2D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            

Reported by Pylint.

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

Line: 213 Column: 35

                          result = idx.take([0, 1, 2])
            expected = timedelta_range("1 day", "3 day", freq="D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            result = idx.take([0, 2, 4])
            expected = timedelta_range("1 day", "5 day", freq="2D", name="idx")
            tm.assert_index_equal(result, expected)
            assert result.freq == expected.freq

            

Reported by Pylint.

pandas/tests/arrays/categorical/test_operators.py
99 issues
Unable to import 'pytest'
Error

Line: 5 Column: 1

              import warnings

import numpy as np
import pytest

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

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 83 Column: 13

                      # Only categories with same categories can be compared
        msg = "Categoricals can only be compared if 'categories' are the same"
        with pytest.raises(TypeError, match=msg):
            cat > cat_rev

        cat_rev_base2 = Categorical(["b", "b", "b"], categories=["c", "b", "a", "d"])

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

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 88 Column: 13

                      cat_rev_base2 = Categorical(["b", "b", "b"], categories=["c", "b", "a", "d"])

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

        # Only categories with same ordering information can be compared
        cat_unorderd = cat.set_ordered(False)
        assert not (cat > cat).any()


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 95 Column: 13

                      assert not (cat > cat).any()

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

        # comparison (in both directions) with Series will raise
        s = Series(["b", "b", "b"])
        msg = (
            "Cannot compare a Categorical for op __gt__ with type "

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 104 Column: 13

                          r"<class 'numpy\.ndarray'>"
        )
        with pytest.raises(TypeError, match=msg):
            cat > s
        with pytest.raises(TypeError, match=msg):
            cat_rev > s
        with pytest.raises(TypeError, match=msg):
            s < cat
        with pytest.raises(TypeError, match=msg):

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 106 Column: 13

                      with pytest.raises(TypeError, match=msg):
            cat > s
        with pytest.raises(TypeError, match=msg):
            cat_rev > s
        with pytest.raises(TypeError, match=msg):
            s < cat
        with pytest.raises(TypeError, match=msg):
            s < cat_rev


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 108 Column: 13

                      with pytest.raises(TypeError, match=msg):
            cat_rev > s
        with pytest.raises(TypeError, match=msg):
            s < cat
        with pytest.raises(TypeError, match=msg):
            s < cat_rev

        # comparison with numpy.array will raise in both direction, but only on
        # newer numpy versions

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 110 Column: 13

                      with pytest.raises(TypeError, match=msg):
            s < cat
        with pytest.raises(TypeError, match=msg):
            s < cat_rev

        # comparison with numpy.array will raise in both direction, but only on
        # newer numpy versions
        a = np.array(["b", "b", "b"])
        with pytest.raises(TypeError, match=msg):

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 116 Column: 13

                      # newer numpy versions
        a = np.array(["b", "b", "b"])
        with pytest.raises(TypeError, match=msg):
            cat > a
        with pytest.raises(TypeError, match=msg):
            cat_rev > a

        # Make sure that unequal comparison take the categories order in
        # account

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 118 Column: 13

                      with pytest.raises(TypeError, match=msg):
            cat > a
        with pytest.raises(TypeError, match=msg):
            cat_rev > a

        # Make sure that unequal comparison take the categories order in
        # account
        cat_rev = Categorical(list("abc"), categories=list("cba"), ordered=True)
        exp = np.array([True, False, False])

            

Reported by Pylint.

pandas/tests/indexing/multiindex/test_slice.py
99 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

from pandas.errors import UnsortedIndexError

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

            

Reported by Pylint.

Expression "df.loc[(slice(None), np.array([True, False])), :]" is assigned to nothing
Error

Line: 139 Column: 13

                          "that is not the same length as the index"
        )
        with pytest.raises(ValueError, match=msg):
            df.loc[(slice(None), np.array([True, False])), :]

        with pytest.raises(KeyError, match=r"\[1\] not in index"):
            # slice(None) is on the index, [1] is on the columns, but 1 is
            #  not in the columns, so we raise
            #  This used to treat [1] as positional GH#16396

            

Reported by Pylint.

Expression "df.loc[slice(None), [1]]" is assigned to nothing
Error

Line: 145 Column: 13

                          # slice(None) is on the index, [1] is on the columns, but 1 is
            #  not in the columns, so we raise
            #  This used to treat [1] as positional GH#16396
            df.loc[slice(None), [1]]

        # not lexsorted
        assert df.index._lexsort_depth == 2
        df = df.sort_index(level=1, axis=0)
        assert df.index._lexsort_depth == 0

            

Reported by Pylint.

Access to a protected member _lexsort_depth of a client class
Error

Line: 148 Column: 16

                          df.loc[slice(None), [1]]

        # not lexsorted
        assert df.index._lexsort_depth == 2
        df = df.sort_index(level=1, axis=0)
        assert df.index._lexsort_depth == 0

        msg = (
            "MultiIndex slicing requires the index to be "

            

Reported by Pylint.

Access to a protected member _lexsort_depth of a client class
Error

Line: 150 Column: 16

                      # not lexsorted
        assert df.index._lexsort_depth == 2
        df = df.sort_index(level=1, axis=0)
        assert df.index._lexsort_depth == 0

        msg = (
            "MultiIndex slicing requires the index to be "
            r"lexsorted: slicing on levels \[1\], lexsort depth 0"
        )

            

Reported by Pylint.

Expression "df.loc[(slice(None), slice('bar')), :]" is assigned to nothing
Error

Line: 157 Column: 13

                          r"lexsorted: slicing on levels \[1\], lexsort depth 0"
        )
        with pytest.raises(UnsortedIndexError, match=msg):
            df.loc[(slice(None), slice("bar")), :]

        # GH 16734: not sorted, but no real slicing
        result = df.loc[(slice(None), df.loc[:, ("a", "bar")] > 5), :]
        tm.assert_frame_equal(result, df.iloc[[1, 3], :])


            

Reported by Pylint.

Expression "df.loc['A1', ('a', slice('foo'))]" is assigned to nothing
Error

Line: 449 Column: 13

                          r"slicing on levels \[1\], lexsort depth 1"
        )
        with pytest.raises(UnsortedIndexError, match=msg):
            df.loc["A1", ("a", slice("foo"))]

        # GH 16734: not sorted, but no real slicing
        tm.assert_frame_equal(
            df.loc["A1", (slice(None), "foo")], df.loc["A1"].iloc[:, [0, 2]]
        )

            

Reported by Pylint.

Expression "df.loc['A1', (slice(None), 'foo')]" is assigned to nothing
Error

Line: 459 Column: 9

                      df = df.sort_index(axis=1)

        # slicing
        df.loc["A1", (slice(None), "foo")]
        df.loc[(slice(None), slice(None), ["C1", "C3"]), (slice(None), "foo")]

        # setitem
        df.loc(axis=0)[:, :, ["C1", "C3"]] = -10


            

Reported by Pylint.

Expression "df.loc[(slice(None), slice(None), ['C1', 'C3']), (slice(None), 'foo')]" is assigned to nothing
Error

Line: 460 Column: 9

              
        # slicing
        df.loc["A1", (slice(None), "foo")]
        df.loc[(slice(None), slice(None), ["C1", "C3"]), (slice(None), "foo")]

        # setitem
        df.loc(axis=0)[:, :, ["C1", "C3"]] = -10

    def test_loc_axis_arguments(self):

            

Reported by Pylint.

Expression "df.loc(axis=i)[:, :, ['C1', 'C3']]" is assigned to nothing
Error

Line: 530 Column: 17

                      for i in [-1, 2, "foo"]:
            msg = f"No axis named {i} for object type DataFrame"
            with pytest.raises(ValueError, match=msg):
                df.loc(axis=i)[:, :, ["C1", "C3"]]

    def test_loc_axis_single_level_multi_col_indexing_multiindex_col_df(self):

        # GH29519
        df = DataFrame(

            

Reported by Pylint.

pandas/tests/groupby/aggregate/test_other.py
99 issues
Unable to import 'pytest'
Error

Line: 9 Column: 1

              from functools import partial

import numpy as np
import pytest

import pandas.util._test_decorators as td

import pandas as pd
from pandas import (

            

Reported by Pylint.

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

Line: 459 Column: 15

                  #  with function that is not dtype-preserving
    dti = date_range("2012-01-01", periods=4, tz="UTC")
    if as_period:
        dti = dti.tz_localize(None).to_period("D")

    df = DataFrame({"a": [0, 0, 1, 1], "b": dti})
    gb = df.groupby("a")

    # Case that _does_ preserve the dtype

            

Reported by Pylint.

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

Line: 459 Column: 15

                  #  with function that is not dtype-preserving
    dti = date_range("2012-01-01", periods=4, tz="UTC")
    if as_period:
        dti = dti.tz_localize(None).to_period("D")

    df = DataFrame({"a": [0, 0, 1, 1], "b": dti})
    gb = df.groupby("a")

    # Case that _does_ preserve the dtype

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 413 Column: 9

                  equiv_callables = [
        sum,
        np.sum,
        lambda x: sum(x),
        lambda x: x.sum(),
        partial(sum),
        fn_class(),
    ]


            

Reported by Pylint.

TODO(ArrayManager) columns with ndarrays
Error

Line: 425 Column: 3

                      tm.assert_frame_equal(result, expected)


@td.skip_array_manager_not_yet_implemented  # TODO(ArrayManager) columns with ndarrays
def test_agg_over_numpy_arrays():
    # GH 3788
    df = DataFrame(
        [
            [1, np.array([10, 20, 30])],

            

Reported by Pylint.

FIXME: the original version of this test called `gb.agg(sum)`
Error

Line: 449 Column: 3

                  result = gb.agg("sum", numeric_only=False)
    tm.assert_frame_equal(result, expected)

    # FIXME: the original version of this test called `gb.agg(sum)`
    #  and that raises TypeError if `numeric_only=False` is passed


@pytest.mark.parametrize("as_period", [True, False])
def test_agg_tzaware_non_datetime_result(as_period):

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 491 Column: 40

                  df = DataFrame({"a": 1, "b": [ts + dt.timedelta(minutes=nn) for nn in range(10)]})

    result1 = df.groupby("a")["b"].agg(np.min).iloc[0]
    result2 = df.groupby("a")["b"].agg(lambda x: np.min(x)).iloc[0]
    result3 = df.groupby("a")["b"].min().iloc[0]

    assert result1 == ts
    assert result2 == ts
    assert result3 == ts

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 549 Column: 13

                      (tuple, DataFrame({"C": {(1, 1): (1, 1, 1), (3, 4): (3, 4, 4)}})),
        (list, DataFrame({"C": {(1, 1): [1, 1, 1], (3, 4): [3, 4, 4]}})),
        (
            lambda x: tuple(x),
            DataFrame({"C": {(1, 1): (1, 1, 1), (3, 4): (3, 4, 4)}}),
        ),
        (
            lambda x: list(x),
            DataFrame({"C": {(1, 1): [1, 1, 1], (3, 4): [3, 4, 4]}}),

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 553 Column: 13

                          DataFrame({"C": {(1, 1): (1, 1, 1), (3, 4): (3, 4, 4)}}),
        ),
        (
            lambda x: list(x),
            DataFrame({"C": {(1, 1): [1, 1, 1], (3, 4): [3, 4, 4]}}),
        ),
    ],
)
def test_agg_structs_dataframe(structure, expected):

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 573 Column: 10

                  [
        (tuple, Series([(1, 1, 1), (3, 4, 4)], index=[1, 3], name="C")),
        (list, Series([[1, 1, 1], [3, 4, 4]], index=[1, 3], name="C")),
        (lambda x: tuple(x), Series([(1, 1, 1), (3, 4, 4)], index=[1, 3], name="C")),
        (lambda x: list(x), Series([[1, 1, 1], [3, 4, 4]], index=[1, 3], name="C")),
    ],
)
def test_agg_structs_series(structure, expected):
    # Issue #18079

            

Reported by Pylint.

pandas/tests/frame/methods/test_align.py
99 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest
import pytz

import pandas as pd
from pandas import (
    DataFrame,
    Index,
    Series,

            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 3 Column: 1

              import numpy as np
import pytest
import pytz

import pandas as pd
from pandas import (
    DataFrame,
    Index,
    Series,

            

Reported by Pylint.

Access to a protected member _mgr of a client class
Error

Line: 44 Column: 31

              
    def test_align_float(self, float_frame):
        af, bf = float_frame.align(float_frame)
        assert af._mgr is not float_frame._mgr

        af, bf = float_frame.align(float_frame, copy=False)
        assert af._mgr is float_frame._mgr

        # axis = 0

            

Reported by Pylint.

Access to a protected member _mgr of a client class
Error

Line: 44 Column: 16

              
    def test_align_float(self, float_frame):
        af, bf = float_frame.align(float_frame)
        assert af._mgr is not float_frame._mgr

        af, bf = float_frame.align(float_frame, copy=False)
        assert af._mgr is float_frame._mgr

        # axis = 0

            

Reported by Pylint.

Access to a protected member _mgr of a client class
Error

Line: 47 Column: 27

                      assert af._mgr is not float_frame._mgr

        af, bf = float_frame.align(float_frame, copy=False)
        assert af._mgr is float_frame._mgr

        # axis = 0
        other = float_frame.iloc[:-5, :3]
        af, bf = float_frame.align(other, axis=0, fill_value=-1)


            

Reported by Pylint.

Access to a protected member _mgr of a client class
Error

Line: 47 Column: 16

                      assert af._mgr is not float_frame._mgr

        af, bf = float_frame.align(float_frame, copy=False)
        assert af._mgr is float_frame._mgr

        # axis = 0
        other = float_frame.iloc[:-5, :3]
        af, bf = float_frame.align(other, axis=0, fill_value=-1)


            

Reported by Pylint.

Unused variable 'diff_b_vals'
Error

Line: 60 Column: 9

                      diff_a = float_frame.index.difference(join_idx)
        diff_b = other.index.difference(join_idx)
        diff_a_vals = af.reindex(diff_a).values
        diff_b_vals = bf.reindex(diff_b).values
        assert (diff_a_vals == -1).all()

        af, bf = float_frame.align(other, join="right", axis=0)
        tm.assert_index_equal(bf.columns, other.columns)
        tm.assert_index_equal(bf.index, other.index)

            

Reported by Pylint.

TODO(wesm): unused?
Error

Line: 80 Column: 3

                      diff_b = other.index.difference(join_idx)
        diff_a_vals = af.reindex(diff_a).values

        # TODO(wesm): unused?
        diff_b_vals = bf.reindex(diff_b).values  # noqa

        assert (diff_a_vals == -1).all()

        af, bf = float_frame.align(other, join="inner", axis=1)

            

Reported by Pylint.

Unused variable 'af'
Error

Line: 137 Column: 9

                      # test other non-float types
        other = DataFrame(index=range(5), columns=["A", "B", "C"])

        af, bf = int_frame.align(other, join="inner", axis=1, method="pad")
        tm.assert_index_equal(bf.columns, other.columns)

    def test_align_mixed_type(self, float_string_frame):

        af, bf = float_string_frame.align(

            

Reported by Pylint.

Unused variable 'af'
Error

Line: 142 Column: 9

              
    def test_align_mixed_type(self, float_string_frame):

        af, bf = float_string_frame.align(
            float_string_frame, join="inner", axis=1, method="pad"
        )
        tm.assert_index_equal(bf.columns, float_string_frame.columns)

    def test_align_mixed_float(self, mixed_float_frame):

            

Reported by Pylint.

pandas/core/computation/expr.py
99 issues
TODO: Python 3.6.2: replace Callable[..., None] with Callable[..., NoReturn]
Error

Line: 256 Column: 3

              assert not intersection, _msg


# TODO: Python 3.6.2: replace Callable[..., None] with Callable[..., NoReturn]
def _node_not_implemented(node_name: str) -> Callable[..., None]:
    """
    Return a function that raises a NotImplementedError with a passed node name.
    """


            

Reported by Pylint.

Unused argument 'self'
Error

Line: 302 Column: 11

                  callable
    """

    def f(self, node, *args, **kwargs):
        """
        Return a partial function with an Op subclass with an operator already passed.

        Returns
        -------

            

Reported by Pylint.

Unused argument 'node'
Error

Line: 302 Column: 17

                  callable
    """

    def f(self, node, *args, **kwargs):
        """
        Return a partial function with an Op subclass with an operator already passed.

        Returns
        -------

            

Reported by Pylint.

Unused argument 'op_class'
Error

Line: 495 Column: 9

                  def _maybe_evaluate_binop(
        self,
        op,
        op_class,
        lhs,
        rhs,
        eval_in_python=("in", "not in"),
        maybe_eval_in_python=("==", "!=", "<", ">", "<=", ">="),
    ):

            

Reported by Pylint.

Unused argument 'kwargs'
Error

Line: 531 Column: 1

                              return self._maybe_eval(res, eval_in_python + maybe_eval_in_python)
        return res

    def visit_BinOp(self, node, **kwargs):
        op, op_class, left, right = self._maybe_transform_eq_ne(node)
        left, right = self._maybe_downcast_constants(left, right)
        return self._maybe_evaluate_binop(op, op_class, left, right)

    def visit_Div(self, node, **kwargs):

            

Reported by Pylint.

Unused argument 'kwargs'
Error

Line: 536 Column: 1

                      left, right = self._maybe_downcast_constants(left, right)
        return self._maybe_evaluate_binop(op, op_class, left, right)

    def visit_Div(self, node, **kwargs):
        return lambda lhs, rhs: Div(lhs, rhs)

    def visit_UnaryOp(self, node, **kwargs):
        op = self.visit(node.op)
        operand = self.visit(node.operand)

            

Reported by Pylint.

Unused argument 'node'
Error

Line: 536 Column: 25

                      left, right = self._maybe_downcast_constants(left, right)
        return self._maybe_evaluate_binop(op, op_class, left, right)

    def visit_Div(self, node, **kwargs):
        return lambda lhs, rhs: Div(lhs, rhs)

    def visit_UnaryOp(self, node, **kwargs):
        op = self.visit(node.op)
        operand = self.visit(node.operand)

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 537 Column: 16

                      return self._maybe_evaluate_binop(op, op_class, left, right)

    def visit_Div(self, node, **kwargs):
        return lambda lhs, rhs: Div(lhs, rhs)

    def visit_UnaryOp(self, node, **kwargs):
        op = self.visit(node.op)
        operand = self.visit(node.operand)
        return op(operand)

            

Reported by Pylint.

Unused argument 'kwargs'
Error

Line: 539 Column: 1

                  def visit_Div(self, node, **kwargs):
        return lambda lhs, rhs: Div(lhs, rhs)

    def visit_UnaryOp(self, node, **kwargs):
        op = self.visit(node.op)
        operand = self.visit(node.operand)
        return op(operand)

    def visit_Name(self, node, **kwargs):

            

Reported by Pylint.

Unused argument 'kwargs'
Error

Line: 547 Column: 1

                  def visit_Name(self, node, **kwargs):
        return self.term_type(node.id, self.env, **kwargs)

    def visit_NameConstant(self, node, **kwargs):
        return self.const_type(node.value, self.env)

    def visit_Num(self, node, **kwargs):
        return self.const_type(node.n, self.env)


            

Reported by Pylint.

pandas/tests/window/moments/test_moments_consistency_expanding.py
99 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

from pandas import (
    DataFrame,
    Index,
    MultiIndex,
    Series,
    isna,

            

Reported by Pylint.

Unused variable 'is_constant'
Error

Line: 172 Column: 8

              @pytest.mark.parametrize("min_periods", [0, 1, 2, 3, 4])
@pytest.mark.parametrize("f", [lambda v: Series(v).sum(), np.nansum])
def test_expanding_apply_consistency_sum_nans(consistency_data, min_periods, f):
    x, is_constant, no_nans = consistency_data

    if f is np.nansum and min_periods == 0:
        pass
    else:
        expanding_f_result = x.expanding(min_periods=min_periods).sum()

            

Reported by Pylint.

Unused variable 'no_nans'
Error

Line: 172 Column: 21

              @pytest.mark.parametrize("min_periods", [0, 1, 2, 3, 4])
@pytest.mark.parametrize("f", [lambda v: Series(v).sum(), np.nansum])
def test_expanding_apply_consistency_sum_nans(consistency_data, min_periods, f):
    x, is_constant, no_nans = consistency_data

    if f is np.nansum and min_periods == 0:
        pass
    else:
        expanding_f_result = x.expanding(min_periods=min_periods).sum()

            

Reported by Pylint.

Unused variable 'is_constant'
Error

Line: 188 Column: 8

              @pytest.mark.parametrize("f", [lambda v: Series(v).sum(), np.nansum, np.sum])
def test_expanding_apply_consistency_sum_no_nans(consistency_data, min_periods, f):

    x, is_constant, no_nans = consistency_data

    if no_nans:
        if f is np.nansum and min_periods == 0:
            pass
        else:

            

Reported by Pylint.

Unused variable 'no_nans'
Error

Line: 204 Column: 21

              @pytest.mark.parametrize("min_periods", [0, 1, 2, 3, 4])
@pytest.mark.parametrize("ddof", [0, 1])
def test_moments_consistency_var(consistency_data, min_periods, ddof):
    x, is_constant, no_nans = consistency_data

    mean_x = x.expanding(min_periods=min_periods).mean()
    var_x = x.expanding(min_periods=min_periods).var(ddof=ddof)
    assert not (var_x < 0).any().any()


            

Reported by Pylint.

Unused variable 'is_constant'
Error

Line: 204 Column: 8

              @pytest.mark.parametrize("min_periods", [0, 1, 2, 3, 4])
@pytest.mark.parametrize("ddof", [0, 1])
def test_moments_consistency_var(consistency_data, min_periods, ddof):
    x, is_constant, no_nans = consistency_data

    mean_x = x.expanding(min_periods=min_periods).mean()
    var_x = x.expanding(min_periods=min_periods).var(ddof=ddof)
    assert not (var_x < 0).any().any()


            

Reported by Pylint.

Unused variable 'no_nans'
Error

Line: 219 Column: 21

              @pytest.mark.parametrize("min_periods", [0, 1, 2, 3, 4])
@pytest.mark.parametrize("ddof", [0, 1])
def test_moments_consistency_var_constant(consistency_data, min_periods, ddof):
    x, is_constant, no_nans = consistency_data

    if is_constant:
        count_x = x.expanding(min_periods=min_periods).count()
        var_x = x.expanding(min_periods=min_periods).var(ddof=ddof)


            

Reported by Pylint.

Unused variable 'is_constant'
Error

Line: 237 Column: 8

              @pytest.mark.parametrize("min_periods", [0, 1, 2, 3, 4])
@pytest.mark.parametrize("ddof", [0, 1])
def test_expanding_consistency_std(consistency_data, min_periods, ddof):
    x, is_constant, no_nans = consistency_data

    var_x = x.expanding(min_periods=min_periods).var(ddof=ddof)
    std_x = x.expanding(min_periods=min_periods).std(ddof=ddof)
    assert not (var_x < 0).any().any()
    assert not (std_x < 0).any().any()

            

Reported by Pylint.

Unused variable 'no_nans'
Error

Line: 237 Column: 21

              @pytest.mark.parametrize("min_periods", [0, 1, 2, 3, 4])
@pytest.mark.parametrize("ddof", [0, 1])
def test_expanding_consistency_std(consistency_data, min_periods, ddof):
    x, is_constant, no_nans = consistency_data

    var_x = x.expanding(min_periods=min_periods).var(ddof=ddof)
    std_x = x.expanding(min_periods=min_periods).std(ddof=ddof)
    assert not (var_x < 0).any().any()
    assert not (std_x < 0).any().any()

            

Reported by Pylint.

Unused variable 'is_constant'
Error

Line: 251 Column: 8

              @pytest.mark.parametrize("min_periods", [0, 1, 2, 3, 4])
@pytest.mark.parametrize("ddof", [0, 1])
def test_expanding_consistency_cov(consistency_data, min_periods, ddof):
    x, is_constant, no_nans = consistency_data
    var_x = x.expanding(min_periods=min_periods).var(ddof=ddof)
    assert not (var_x < 0).any().any()

    cov_x_x = x.expanding(min_periods=min_periods).cov(x, ddof=ddof)
    assert not (cov_x_x < 0).any().any()

            

Reported by Pylint.

pandas/tests/frame/test_repr_info.py
98 issues
Unable to import 'pytest'
Error

Line: 9 Column: 1

              import warnings

import numpy as np
import pytest

from pandas import (
    Categorical,
    DataFrame,
    MultiIndex,

            

Reported by Pylint.

TODO(Arraymanager) astype("U1") actually gives this dtype instead of object
Error

Line: 36 Column: 3

                      nseqs = 1000
        words = [[np.random.choice(lets) for x in range(slen)] for _ in range(nseqs)]
        df = DataFrame(words).astype("U1")
        # TODO(Arraymanager) astype("U1") actually gives this dtype instead of object
        if not using_array_manager:
            assert (df.dtypes == object).all()

        # smoke tests; at one point this raised with 61 but not 60
        repr(df)

            

Reported by Pylint.

Unused argument 'float_string_frame'
Error

Line: 68 Column: 37

                      df.index = index
        repr(df)

    def test_repr_with_mi_nat(self, float_string_frame):
        df = DataFrame({"X": [1, 2]}, index=[[NaT, Timestamp("20130101")], ["a", "b"]])
        result = repr(df)
        expected = "              X\nNaT        a  1\n2013-01-01 b  2"
        assert result == expected


            

Reported by Pylint.

Access to a protected member _repr_latex_ of a client class
Error

Line: 282 Column: 30

              """
        with option_context("display.latex.escape", False, "display.latex.repr", True):
            df = DataFrame([[r"$\alpha$", "b", "c"], [1, 2, 3]])
            assert result == df._repr_latex_()

        # GH 12182
        assert df._repr_latex_() is None

    def test_repr_categorical_dates_periods(self):

            

Reported by Pylint.

Access to a protected member _repr_latex_ of a client class
Error

Line: 285 Column: 16

                          assert result == df._repr_latex_()

        # GH 12182
        assert df._repr_latex_() is None

    def test_repr_categorical_dates_periods(self):
        # normal DataFrame
        dt = date_range("2011-01-01 09:00", freq="H", periods=5, tz="US/Eastern")
        p = period_range("2011-01", freq="M", periods=5)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from datetime import (
    datetime,
    timedelta,
)
from io import StringIO
import warnings

import numpy as np
import pytest

            

Reported by Pylint.

Too many public methods (26/20)
Error

Line: 28 Column: 1

              import pandas.io.formats.format as fmt


class TestDataFrameReprInfoEtc:
    def test_repr_bytes_61_lines(self, using_array_manager):
        # GH#12857
        lets = list("ACDEFGHIJKLMNOP")
        slen = 50
        nseqs = 1000

            

Reported by Pylint.

Missing class docstring
Error

Line: 28 Column: 1

              import pandas.io.formats.format as fmt


class TestDataFrameReprInfoEtc:
    def test_repr_bytes_61_lines(self, using_array_manager):
        # GH#12857
        lets = list("ACDEFGHIJKLMNOP")
        slen = 50
        nseqs = 1000

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 29 Column: 5

              

class TestDataFrameReprInfoEtc:
    def test_repr_bytes_61_lines(self, using_array_manager):
        # GH#12857
        lets = list("ACDEFGHIJKLMNOP")
        slen = 50
        nseqs = 1000
        words = [[np.random.choice(lets) for x in range(slen)] for _ in range(nseqs)]

            

Reported by Pylint.

Method could be a function
Error

Line: 29 Column: 5

              

class TestDataFrameReprInfoEtc:
    def test_repr_bytes_61_lines(self, using_array_manager):
        # GH#12857
        lets = list("ACDEFGHIJKLMNOP")
        slen = 50
        nseqs = 1000
        words = [[np.random.choice(lets) for x in range(slen)] for _ in range(nseqs)]

            

Reported by Pylint.

pandas/tests/frame/methods/test_drop.py
98 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              import re

import numpy as np
import pytest

from pandas.errors import PerformanceWarning

import pandas as pd
from pandas import (

            

Reported by Pylint.

Access to a protected member _is_lexsorted of a client class
Error

Line: 176 Column: 16

                          [("a", ""), ("b1", "c1"), ("b2", "c2")], names=["b", "c"]
        )
        lexsorted_df = DataFrame([[1, 3, 4]], columns=lexsorted_mi)
        assert lexsorted_df.columns._is_lexsorted()

        # define the non-lexsorted version
        not_lexsorted_df = DataFrame(
            columns=["a", "b", "c", "d"], data=[[1, "b1", "c1", 3], [1, "b2", "c2", 4]]
        )

            

Reported by Pylint.

Access to a protected member _is_lexsorted of a client class
Error

Line: 186 Column: 20

                          index="a", columns=["b", "c"], values="d"
        )
        not_lexsorted_df = not_lexsorted_df.reset_index()
        assert not not_lexsorted_df.columns._is_lexsorted()

        # compare the results
        tm.assert_frame_equal(lexsorted_df, not_lexsorted_df)

        expected = lexsorted_df.drop("a", axis=1)

            

Reported by Pylint.

Unused argument 'indexer'
Error

Line: 487 Column: 58

                      tm.assert_frame_equal(result, expected)

    @pytest.mark.parametrize("indexer", [("a", "a"), [("a", "a")]])
    def test_drop_tuple_with_non_unique_multiindex(self, indexer):
        # GH#42771
        idx = MultiIndex.from_product([["a", "b"], ["a", "a"]])
        df = DataFrame({"x": range(len(idx))}, index=idx)
        result = df.drop(index=[("a", "a")])
        expected = DataFrame(

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import re

import numpy as np
import pytest

from pandas.errors import PerformanceWarning

import pandas as pd
from pandas import (

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 25 Column: 1

                  [
        (r"labels \[4\] not found in level", 4, "a"),
        (r"labels \[7\] not found in level", 7, "b"),
    ],
)
def test_drop_raise_exception_if_labels_not_in_level(msg, labels, level):
    # GH 8594
    mi = MultiIndex.from_arrays([[1, 2, 3], [4, 5, 6]], names=["a", "b"])
    s = Series([10, 20, 30], index=mi)

            

Reported by Pylint.

Variable name "mi" doesn't conform to snake_case naming style
Error

Line: 29 Column: 5

              )
def test_drop_raise_exception_if_labels_not_in_level(msg, labels, level):
    # GH 8594
    mi = MultiIndex.from_arrays([[1, 2, 3], [4, 5, 6]], names=["a", "b"])
    s = Series([10, 20, 30], index=mi)
    df = DataFrame([10, 20, 30], index=mi)

    with pytest.raises(KeyError, match=msg):
        s.drop(labels, level=level)

            

Reported by Pylint.

Variable name "s" doesn't conform to snake_case naming style
Error

Line: 30 Column: 5

              def test_drop_raise_exception_if_labels_not_in_level(msg, labels, level):
    # GH 8594
    mi = MultiIndex.from_arrays([[1, 2, 3], [4, 5, 6]], names=["a", "b"])
    s = Series([10, 20, 30], index=mi)
    df = DataFrame([10, 20, 30], index=mi)

    with pytest.raises(KeyError, match=msg):
        s.drop(labels, level=level)
    with pytest.raises(KeyError, match=msg):

            

Reported by Pylint.

Variable name "df" doesn't conform to snake_case naming style
Error

Line: 31 Column: 5

                  # GH 8594
    mi = MultiIndex.from_arrays([[1, 2, 3], [4, 5, 6]], names=["a", "b"])
    s = Series([10, 20, 30], index=mi)
    df = DataFrame([10, 20, 30], index=mi)

    with pytest.raises(KeyError, match=msg):
        s.drop(labels, level=level)
    with pytest.raises(KeyError, match=msg):
        df.drop(labels, level=level)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 40 Column: 1

              

@pytest.mark.parametrize("labels,level", [(4, "a"), (7, "b")])
def test_drop_errors_ignore(labels, level):
    # GH 8594
    mi = MultiIndex.from_arrays([[1, 2, 3], [4, 5, 6]], names=["a", "b"])
    s = Series([10, 20, 30], index=mi)
    df = DataFrame([10, 20, 30], index=mi)


            

Reported by Pylint.

pandas/tests/series/methods/test_fillna.py
98 issues
Unable to import 'pytest'
Error

Line: 8 Column: 1

              )

import numpy as np
import pytest
import pytz

from pandas import (
    Categorical,
    DataFrame,

            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 9 Column: 1

              
import numpy as np
import pytest
import pytz

from pandas import (
    Categorical,
    DataFrame,
    DatetimeIndex,

            

Reported by Pylint.

Access to a protected member _values of a client class
Error

Line: 677 Column: 15

                  def test_fillna_categorical_raises(self):
        data = ["a", np.nan, "b", np.nan, np.nan]
        ser = Series(Categorical(data, categories=["a", "b"]))
        cat = ser._values

        msg = "Cannot setitem on a Categorical with a new category"
        with pytest.raises(TypeError, match=msg):
            ser.fillna("d")


            

Reported by Pylint.

Access to a protected member _values of a client class
Error

Line: 749 Column: 23

              
        # but we dont (yet) consider distinct tzinfos for non-UTC tz equivalent
        ts = Timestamp("2000-01-01", tz="US/Pacific")
        ser2 = Series(ser._values.tz_convert("dateutil/US/Pacific"))
        result = ser2.fillna(ts)
        expected = Series([ser[0], ts, ser[2]], dtype=object)
        tm.assert_series_equal(result, expected)

    def test_fillna_pos_args_deprecation(self):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from datetime import (
    datetime,
    timedelta,
    timezone,
)

import numpy as np
import pytest
import pytz

            

Reported by Pylint.

Too many public methods (21/20)
Error

Line: 26 Column: 1

              import pandas._testing as tm


class TestSeriesFillNA:
    def test_fillna_nat(self):
        series = Series([0, 1, 2, NaT.value], dtype="M8[ns]")

        filled = series.fillna(method="pad")
        filled2 = series.fillna(value=series.values[2])

            

Reported by Pylint.

Missing class docstring
Error

Line: 26 Column: 1

              import pandas._testing as tm


class TestSeriesFillNA:
    def test_fillna_nat(self):
        series = Series([0, 1, 2, NaT.value], dtype="M8[ns]")

        filled = series.fillna(method="pad")
        filled2 = series.fillna(value=series.values[2])

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 27 Column: 5

              

class TestSeriesFillNA:
    def test_fillna_nat(self):
        series = Series([0, 1, 2, NaT.value], dtype="M8[ns]")

        filled = series.fillna(method="pad")
        filled2 = series.fillna(value=series.values[2])


            

Reported by Pylint.

Method could be a function
Error

Line: 27 Column: 5

              

class TestSeriesFillNA:
    def test_fillna_nat(self):
        series = Series([0, 1, 2, NaT.value], dtype="M8[ns]")

        filled = series.fillna(method="pad")
        filled2 = series.fillna(value=series.values[2])


            

Reported by Pylint.

Variable name "df" doesn't conform to snake_case naming style
Error

Line: 39 Column: 9

                      tm.assert_series_equal(filled, expected)
        tm.assert_series_equal(filled2, expected)

        df = DataFrame({"A": series})
        filled = df.fillna(method="pad")
        filled2 = df.fillna(value=series.values[2])
        expected = DataFrame({"A": expected})
        tm.assert_frame_equal(filled, expected)
        tm.assert_frame_equal(filled2, expected)

            

Reported by Pylint.