The following issues were found

pandas/tests/frame/methods/test_swapaxes.py
12 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

from pandas import DataFrame
import pandas._testing as tm


class TestSwapAxes:
    def test_swapaxes(self):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest

from pandas import DataFrame
import pandas._testing as tm


class TestSwapAxes:
    def test_swapaxes(self):

            

Reported by Pylint.

Missing class docstring
Error

Line: 8 Column: 1

              import pandas._testing as tm


class TestSwapAxes:
    def test_swapaxes(self):
        df = DataFrame(np.random.randn(10, 5))
        tm.assert_frame_equal(df.T, df.swapaxes(0, 1))
        tm.assert_frame_equal(df.T, df.swapaxes(1, 0))


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 9 Column: 5

              

class TestSwapAxes:
    def test_swapaxes(self):
        df = DataFrame(np.random.randn(10, 5))
        tm.assert_frame_equal(df.T, df.swapaxes(0, 1))
        tm.assert_frame_equal(df.T, df.swapaxes(1, 0))

    def test_swapaxes_noop(self):

            

Reported by Pylint.

Method could be a function
Error

Line: 9 Column: 5

              

class TestSwapAxes:
    def test_swapaxes(self):
        df = DataFrame(np.random.randn(10, 5))
        tm.assert_frame_equal(df.T, df.swapaxes(0, 1))
        tm.assert_frame_equal(df.T, df.swapaxes(1, 0))

    def test_swapaxes_noop(self):

            

Reported by Pylint.

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

Line: 10 Column: 9

              
class TestSwapAxes:
    def test_swapaxes(self):
        df = DataFrame(np.random.randn(10, 5))
        tm.assert_frame_equal(df.T, df.swapaxes(0, 1))
        tm.assert_frame_equal(df.T, df.swapaxes(1, 0))

    def test_swapaxes_noop(self):
        df = DataFrame(np.random.randn(10, 5))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 14 Column: 5

                      tm.assert_frame_equal(df.T, df.swapaxes(0, 1))
        tm.assert_frame_equal(df.T, df.swapaxes(1, 0))

    def test_swapaxes_noop(self):
        df = DataFrame(np.random.randn(10, 5))
        tm.assert_frame_equal(df, df.swapaxes(0, 0))

    def test_swapaxes_invalid_axis(self):
        df = DataFrame(np.random.randn(10, 5))

            

Reported by Pylint.

Method could be a function
Error

Line: 14 Column: 5

                      tm.assert_frame_equal(df.T, df.swapaxes(0, 1))
        tm.assert_frame_equal(df.T, df.swapaxes(1, 0))

    def test_swapaxes_noop(self):
        df = DataFrame(np.random.randn(10, 5))
        tm.assert_frame_equal(df, df.swapaxes(0, 0))

    def test_swapaxes_invalid_axis(self):
        df = DataFrame(np.random.randn(10, 5))

            

Reported by Pylint.

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

Line: 15 Column: 9

                      tm.assert_frame_equal(df.T, df.swapaxes(1, 0))

    def test_swapaxes_noop(self):
        df = DataFrame(np.random.randn(10, 5))
        tm.assert_frame_equal(df, df.swapaxes(0, 0))

    def test_swapaxes_invalid_axis(self):
        df = DataFrame(np.random.randn(10, 5))
        msg = "No axis named 2 for object type DataFrame"

            

Reported by Pylint.

Method could be a function
Error

Line: 18 Column: 5

                      df = DataFrame(np.random.randn(10, 5))
        tm.assert_frame_equal(df, df.swapaxes(0, 0))

    def test_swapaxes_invalid_axis(self):
        df = DataFrame(np.random.randn(10, 5))
        msg = "No axis named 2 for object type DataFrame"
        with pytest.raises(ValueError, match=msg):
            df.swapaxes(2, 5)

            

Reported by Pylint.

pandas/tests/frame/methods/test_pipe.py
12 issues
Unable to import 'pytest'
Error

Line: 1 Column: 1

              import pytest

from pandas import (
    DataFrame,
    Series,
)
import pandas._testing as tm



            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import pytest

from pandas import (
    DataFrame,
    Series,
)
import pandas._testing as tm



            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

              import pandas._testing as tm


class TestPipe:
    def test_pipe(self, frame_or_series):
        obj = DataFrame({"A": [1, 2, 3]})
        expected = DataFrame({"A": [1, 4, 9]})
        if frame_or_series is Series:
            obj = obj["A"]

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 5

              

class TestPipe:
    def test_pipe(self, frame_or_series):
        obj = DataFrame({"A": [1, 2, 3]})
        expected = DataFrame({"A": [1, 4, 9]})
        if frame_or_series is Series:
            obj = obj["A"]
            expected = expected["A"]

            

Reported by Pylint.

Method could be a function
Error

Line: 11 Column: 5

              

class TestPipe:
    def test_pipe(self, frame_or_series):
        obj = DataFrame({"A": [1, 2, 3]})
        expected = DataFrame({"A": [1, 4, 9]})
        if frame_or_series is Series:
            obj = obj["A"]
            expected = expected["A"]

            

Reported by Pylint.

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

Line: 18 Column: 9

                          obj = obj["A"]
            expected = expected["A"]

        f = lambda x, y: x ** y
        result = obj.pipe(f, 2)
        tm.assert_equal(result, expected)

    def test_pipe_tuple(self, frame_or_series):
        obj = DataFrame({"A": [1, 2, 3]})

            

Reported by Pylint.

Method could be a function
Error

Line: 22 Column: 5

                      result = obj.pipe(f, 2)
        tm.assert_equal(result, expected)

    def test_pipe_tuple(self, frame_or_series):
        obj = DataFrame({"A": [1, 2, 3]})
        if frame_or_series is Series:
            obj = obj["A"]

        f = lambda x, y: y

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 22 Column: 5

                      result = obj.pipe(f, 2)
        tm.assert_equal(result, expected)

    def test_pipe_tuple(self, frame_or_series):
        obj = DataFrame({"A": [1, 2, 3]})
        if frame_or_series is Series:
            obj = obj["A"]

        f = lambda x, y: y

            

Reported by Pylint.

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

Line: 27 Column: 9

                      if frame_or_series is Series:
            obj = obj["A"]

        f = lambda x, y: y
        result = obj.pipe((f, "y"), 0)
        tm.assert_equal(result, obj)

    def test_pipe_tuple_error(self, frame_or_series):
        obj = DataFrame({"A": [1, 2, 3]})

            

Reported by Pylint.

Method could be a function
Error

Line: 31 Column: 5

                      result = obj.pipe((f, "y"), 0)
        tm.assert_equal(result, obj)

    def test_pipe_tuple_error(self, frame_or_series):
        obj = DataFrame({"A": [1, 2, 3]})
        if frame_or_series is Series:
            obj = obj["A"]

        f = lambda x, y: y

            

Reported by Pylint.

pandas/tests/groupby/test_pipe.py
11 issues
Module 'numpy.random' has no 'RandomState' member
Error

Line: 15 Column: 20

                  # Test the pipe method of DataFrameGroupBy.
    # Issue #17871

    random_state = np.random.RandomState(1234567890)

    df = DataFrame(
        {
            "A": ["foo", "bar", "foo", "bar", "foo", "bar", "foo", "foo"],
            "B": random_state.randn(8),

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np

import pandas as pd
from pandas import (
    DataFrame,
    Index,
)
import pandas._testing as tm


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 1

              import pandas._testing as tm


def test_pipe():
    # Test the pipe method of DataFrameGroupBy.
    # Issue #17871

    random_state = np.random.RandomState(1234567890)


            

Reported by Pylint.

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

Line: 17 Column: 5

              
    random_state = np.random.RandomState(1234567890)

    df = DataFrame(
        {
            "A": ["foo", "bar", "foo", "bar", "foo", "bar", "foo", "foo"],
            "B": random_state.randn(8),
            "C": random_state.randn(8),
        }

            

Reported by Pylint.

Function name "f" doesn't conform to snake_case naming style
Error

Line: 25 Column: 5

                      }
    )

    def f(dfgb):
        return dfgb.B.max() - dfgb.C.min().min()

    def square(srs):
        return srs ** 2


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 44 Column: 1

                  tm.assert_series_equal(expected, result)


def test_pipe_args():
    # Test passing args to the pipe method of DataFrameGroupBy.
    # Issue #17871

    df = DataFrame(
        {

            

Reported by Pylint.

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

Line: 48 Column: 5

                  # Test passing args to the pipe method of DataFrameGroupBy.
    # Issue #17871

    df = DataFrame(
        {
            "group": ["A", "A", "B", "B", "C"],
            "x": [1.0, 2.0, 3.0, 2.0, 5.0],
            "y": [10.0, 100.0, 1000.0, -100.0, -1000.0],
        }

            

Reported by Pylint.

Function name "f" doesn't conform to snake_case naming style
Error

Line: 56 Column: 5

                      }
    )

    def f(dfgb, arg1):
        return dfgb.filter(lambda grp: grp.y.mean() > arg1, dropna=False).groupby(
            dfgb.grouper
        )

    def g(dfgb, arg2):

            

Reported by Pylint.

Function name "g" doesn't conform to snake_case naming style
Error

Line: 61 Column: 5

                          dfgb.grouper
        )

    def g(dfgb, arg2):
        return dfgb.sum() / dfgb.sum().sum() + arg2

    def h(df, arg3):
        return df.x + df.y - arg3


            

Reported by Pylint.

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

Line: 64 Column: 5

                  def g(dfgb, arg2):
        return dfgb.sum() / dfgb.sum().sum() + arg2

    def h(df, arg3):
        return df.x + df.y - arg3

    result = df.groupby("group").pipe(f, 0).pipe(g, 10).pipe(h, 100)

    # Assert the results here

            

Reported by Pylint.

pandas/io/formats/css.py
11 issues
TODO: support %
Error

Line: 198 Column: 3

              
            for prop in [f"margin-{side}", f"padding-{side}"]:
                if prop in props:
                    # TODO: support %
                    props[prop] = self.size_to_pt(
                        props[prop],
                        em_pt=font_size,
                        conversions=self.MARGIN_RATIOS,
                    )

            

Reported by Pylint.

Dangerous default value UNIT_RATIOS (builtins.dict) as argument
Error

Line: 206 Column: 5

                                  )
        return props

    def size_to_pt(self, in_val, em_pt=None, conversions=UNIT_RATIOS):
        def _error():
            warnings.warn(f"Unhandled size: {repr(in_val)}", CSSWarning)
            return self.size_to_pt("1!!default", conversions=conversions)

        match = re.match(r"^(\S*?)([a-zA-Z%!].*)", in_val)

            

Reported by Pylint.

Redefining name 'prop' from outer scope (line 248)
Error

Line: 255 Column: 17

                          except AttributeError:
                yield prop, value
            else:
                for prop, value in expand(prop, value):
                    yield prop, value

    expand_border_color = _side_expander("border-{:s}-color")
    expand_border_style = _side_expander("border-{:s}-style")
    expand_border_width = _side_expander("border-{:s}-width")

            

Reported by Pylint.

Redefining name 'value' from outer scope (line 248)
Error

Line: 255 Column: 17

                          except AttributeError:
                yield prop, value
            else:
                for prop, value in expand(prop, value):
                    yield prop, value

    expand_border_color = _side_expander("border-{:s}-color")
    expand_border_style = _side_expander("border-{:s}-style")
    expand_border_width = _side_expander("border-{:s}-width")

            

Reported by Pylint.

TODO: don't lowercase case sensitive parts of values (strings)
Error

Line: 279 Column: 3

                              continue
            prop, sep, val = decl.partition(":")
            prop = prop.strip().lower()
            # TODO: don't lowercase case sensitive parts of values (strings)
            val = val.strip().lower()
            if sep:
                yield prop, val
            else:
                warnings.warn(

            

Reported by Pylint.

Method could be a function
Error

Line: 138 Column: 5

                      props = self._update_font_size(props, inherited)
        return self._update_other_units(props)

    def _update_initial(
        self,
        props: dict[str, str],
        inherited: dict[str, str],
    ) -> dict[str, str]:
        # 1. resolve inherited, initial

            

Reported by Pylint.

Method could be a function
Error

Line: 180 Column: 5

                          return self._get_float_font_size_from_pt(font_size_string)
        return None

    def _get_float_font_size_from_pt(self, font_size_string: str) -> float:
        assert font_size_string.endswith("pt")
        return float(font_size_string.rstrip("pt"))

    def _update_other_units(self, props: dict[str, str]) -> dict[str, str]:
        font_size = self._get_font_size(props)

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 181
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                      return None

    def _get_float_font_size_from_pt(self, font_size_string: str) -> float:
        assert font_size_string.endswith("pt")
        return float(font_size_string.rstrip("pt"))

    def _update_other_units(self, props: dict[str, str]) -> dict[str, str]:
        font_size = self._get_font_size(props)
        # 3. TODO: resolve other font-relative units

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 206 Column: 5

                                  )
        return props

    def size_to_pt(self, in_val, em_pt=None, conversions=UNIT_RATIOS):
        def _error():
            warnings.warn(f"Unhandled size: {repr(in_val)}", CSSWarning)
            return self.size_to_pt("1!!default", conversions=conversions)

        match = re.match(r"^(\S*?)([a-zA-Z%!].*)", in_val)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 247 Column: 5

                          size_fmt = f"{val:f}pt"
        return size_fmt

    def atomize(self, declarations):
        for prop, value in declarations:
            attr = "expand_" + prop.replace("-", "_")
            try:
                expand = getattr(self, attr)
            except AttributeError:

            

Reported by Pylint.

pandas/tests/frame/conftest.py
11 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              from itertools import product

import numpy as np
import pytest

from pandas import (
    DataFrame,
    NaT,
    date_range,

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from itertools import product

import numpy as np
import pytest

from pandas import (
    DataFrame,
    NaT,
    date_range,

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 1

              

@pytest.fixture(params=product([True, False], [True, False]))
def close_open_fixture(request):
    return request.param


@pytest.fixture
def float_frame_with_na():

            

Reported by Pylint.

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

Line: 45 Column: 5

              
    [30 rows x 4 columns]
    """
    df = DataFrame(tm.getSeriesData())
    # set some NAs
    df.iloc[5:10] = np.nan
    df.iloc[15:20, -2:] = np.nan
    return df


            

Reported by Pylint.

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

Line: 78 Column: 5

              
    [30 rows x 4 columns]
    """
    df = DataFrame(tm.getSeriesData()) > 0
    df = df.astype(object)
    # set some NAs
    df.iloc[5:10] = np.nan
    df.iloc[15:20, -2:] = np.nan


            

Reported by Pylint.

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

Line: 79 Column: 5

                  [30 rows x 4 columns]
    """
    df = DataFrame(tm.getSeriesData()) > 0
    df = df.astype(object)
    # set some NAs
    df.iloc[5:10] = np.nan
    df.iloc[15:20, -2:] = np.nan

    # For `any` tests we need to have at least one True before the first NaN

            

Reported by Pylint.

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

Line: 117 Column: 5

              
    [30 rows x 5 columns]
    """
    df = DataFrame(tm.getSeriesData())
    df["foo"] = "bar"
    return df


@pytest.fixture

            

Reported by Pylint.

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

Line: 148 Column: 5

              
    [30 rows x 4 columns]
    """
    df = DataFrame(tm.getSeriesData())
    df.A = df.A.astype("float32")
    df.B = df.B.astype("float32")
    df.C = df.C.astype("float16")
    df.D = df.D.astype("float64")
    return df

            

Reported by Pylint.

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

Line: 182 Column: 5

              
    [30 rows x 4 columns]
    """
    df = DataFrame({k: v.astype(int) for k, v in tm.getSeriesData().items()})
    df.A = df.A.astype("int32")
    df.B = np.ones(len(df.B), dtype="uint64")
    df.C = df.C.astype("uint8")
    df.D = df.C.astype("int64")
    return df

            

Reported by Pylint.

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

Line: 202 Column: 5

                  1 2013-01-02                       NaT                       NaT
    2 2013-01-03 2013-01-03 00:00:00-05:00 2013-01-03 00:00:00+01:00
    """
    df = DataFrame(
        {
            "A": date_range("20130101", periods=3),
            "B": date_range("20130101", periods=3, tz="US/Eastern"),
            "C": date_range("20130101", periods=3, tz="CET"),
        }

            

Reported by Pylint.

pandas/tests/frame/methods/test_infer_objects.py
11 issues
Missing module docstring
Error

Line: 1 Column: 1

              from datetime import datetime

from pandas import DataFrame
import pandas._testing as tm


class TestInferObjects:
    def test_infer_objects(self):
        # GH#11221

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 7 Column: 1

              import pandas._testing as tm


class TestInferObjects:
    def test_infer_objects(self):
        # GH#11221
        df = DataFrame(
            {
                "a": ["a", 1, 2, 3],

            

Reported by Pylint.

Missing class docstring
Error

Line: 7 Column: 1

              import pandas._testing as tm


class TestInferObjects:
    def test_infer_objects(self):
        # GH#11221
        df = DataFrame(
            {
                "a": ["a", 1, 2, 3],

            

Reported by Pylint.

Method could be a function
Error

Line: 8 Column: 5

              

class TestInferObjects:
    def test_infer_objects(self):
        # GH#11221
        df = DataFrame(
            {
                "a": ["a", 1, 2, 3],
                "b": ["b", 2.0, 3.0, 4.1],

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 8 Column: 5

              

class TestInferObjects:
    def test_infer_objects(self):
        # GH#11221
        df = DataFrame(
            {
                "a": ["a", 1, 2, 3],
                "b": ["b", 2.0, 3.0, 4.1],

            

Reported by Pylint.

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

Line: 10 Column: 9

              class TestInferObjects:
    def test_infer_objects(self):
        # GH#11221
        df = DataFrame(
            {
                "a": ["a", 1, 2, 3],
                "b": ["b", 2.0, 3.0, 4.1],
                "c": [
                    "c",

            

Reported by Pylint.

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

Line: 24 Column: 9

                          },
            columns=["a", "b", "c", "d"],
        )
        df = df.iloc[1:].infer_objects()

        assert df["a"].dtype == "int64"
        assert df["b"].dtype == "float64"
        assert df["c"].dtype == "M8[ns]"
        assert df["d"].dtype == "object"

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 26
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                      )
        df = df.iloc[1:].infer_objects()

        assert df["a"].dtype == "int64"
        assert df["b"].dtype == "float64"
        assert df["c"].dtype == "M8[ns]"
        assert df["d"].dtype == "object"

        expected = DataFrame(

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 27
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                      df = df.iloc[1:].infer_objects()

        assert df["a"].dtype == "int64"
        assert df["b"].dtype == "float64"
        assert df["c"].dtype == "M8[ns]"
        assert df["d"].dtype == "object"

        expected = DataFrame(
            {

            

Reported by Bandit.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 28
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

              
        assert df["a"].dtype == "int64"
        assert df["b"].dtype == "float64"
        assert df["c"].dtype == "M8[ns]"
        assert df["d"].dtype == "object"

        expected = DataFrame(
            {
                "a": [1, 2, 3],

            

Reported by Bandit.

pandas/tests/indexes/base_class/test_reshape.py
11 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              """
Tests for ndarray-like method on the base Index class
"""
import pytest

from pandas import Index
import pandas._testing as tm



            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

              import pandas._testing as tm


class TestReshape:
    def test_repeat(self):
        repeats = 2
        index = Index([1, 2, 3])
        expected = Index([1, 1, 2, 2, 3, 3])


            

Reported by Pylint.

Method could be a function
Error

Line: 11 Column: 5

              

class TestReshape:
    def test_repeat(self):
        repeats = 2
        index = Index([1, 2, 3])
        expected = Index([1, 1, 2, 2, 3, 3])

        result = index.repeat(repeats)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 5

              

class TestReshape:
    def test_repeat(self):
        repeats = 2
        index = Index([1, 2, 3])
        expected = Index([1, 1, 2, 2, 3, 3])

        result = index.repeat(repeats)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 5

                      result = index.repeat(repeats)
        tm.assert_index_equal(result, expected)

    def test_insert(self):

        # GH 7256
        # validate neg/pos inserts
        result = Index(["b", "c", "d"])


            

Reported by Pylint.

Method could be a function
Error

Line: 19 Column: 5

                      result = index.repeat(repeats)
        tm.assert_index_equal(result, expected)

    def test_insert(self):

        # GH 7256
        # validate neg/pos inserts
        result = Index(["b", "c", "d"])


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 43 Column: 5

                      [
            (0, Index(["b", "c", "d"], name="index")),
            (-1, Index(["a", "b", "c"], name="index")),
        ],
    )
    def test_delete(self, pos, expected):
        index = Index(["a", "b", "c", "d"], name="index")
        result = index.delete(pos)
        tm.assert_index_equal(result, expected)

            

Reported by Pylint.

Method could be a function
Error

Line: 43 Column: 5

                      [
            (0, Index(["b", "c", "d"], name="index")),
            (-1, Index(["a", "b", "c"], name="index")),
        ],
    )
    def test_delete(self, pos, expected):
        index = Index(["a", "b", "c", "d"], name="index")
        result = index.delete(pos)
        tm.assert_index_equal(result, expected)

            

Reported by Pylint.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
Security

Line: 49
Suggestion: https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html

                      index = Index(["a", "b", "c", "d"], name="index")
        result = index.delete(pos)
        tm.assert_index_equal(result, expected)
        assert result.name == expected.name

    def test_append_multiple(self):
        index = Index(["a", "b", "c", "d", "e", "f"])

        foos = [index[:2], index[2:4], index[4:]]

            

Reported by Bandit.

Method could be a function
Error

Line: 51 Column: 5

                      tm.assert_index_equal(result, expected)
        assert result.name == expected.name

    def test_append_multiple(self):
        index = Index(["a", "b", "c", "d", "e", "f"])

        foos = [index[:2], index[2:4], index[4:]]
        result = foos[0].append(foos[1:])
        tm.assert_index_equal(result, index)

            

Reported by Pylint.

pandas/core/window/expanding.py
11 issues
Keyword argument before variable positional arguments list in the definition of std function
Error

Line: 376 Column: 5

                      window_method="expanding",
        aggregation_description="standard deviation",
        agg_method="std",
    )
    def std(self, ddof: int = 1, *args, **kwargs):
        nv.validate_expanding_func("std", args, kwargs)
        return super().std(ddof=ddof, **kwargs)

    @doc(

            

Reported by Pylint.

Keyword argument before variable positional arguments list in the definition of var function
Error

Line: 426 Column: 5

                      window_method="expanding",
        aggregation_description="variance",
        agg_method="var",
    )
    def var(self, ddof: int = 1, *args, **kwargs):
        nv.validate_expanding_func("var", args, kwargs)
        return super().var(ddof=ddof, **kwargs)

    @doc(

            

Reported by Pylint.

Keyword argument before variable positional arguments list in the definition of sem function
Error

Line: 465 Column: 5

                      window_method="expanding",
        aggregation_description="standard error of mean",
        agg_method="sem",
    )
    def sem(self, ddof: int = 1, *args, **kwargs):
        return super().sem(ddof=ddof, **kwargs)

    @doc(
        template_header,

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from __future__ import annotations

from textwrap import dedent
from typing import (
    TYPE_CHECKING,
    Any,
    Callable,
)


            

Reported by Pylint.

Import "from pandas.compat.numpy import function as nv" should be placed at the top of the module
Error

Line: 18 Column: 1

              if TYPE_CHECKING:
    from pandas import DataFrame, Series

from pandas.compat.numpy import function as nv
from pandas.util._decorators import doc

from pandas.core.indexers.objects import (
    BaseIndexer,
    ExpandingIndexer,

            

Reported by Pylint.

Import "from pandas.util._decorators import doc" should be placed at the top of the module
Error

Line: 19 Column: 1

                  from pandas import DataFrame, Series

from pandas.compat.numpy import function as nv
from pandas.util._decorators import doc

from pandas.core.indexers.objects import (
    BaseIndexer,
    ExpandingIndexer,
    GroupbyIndexer,

            

Reported by Pylint.

Import "from pandas.core.indexers.objects import BaseIndexer, ExpandingIndexer, GroupbyIndexer" should be placed at the top of the module
Error

Line: 21 Column: 1

              from pandas.compat.numpy import function as nv
from pandas.util._decorators import doc

from pandas.core.indexers.objects import (
    BaseIndexer,
    ExpandingIndexer,
    GroupbyIndexer,
)
from pandas.core.window.doc import (

            

Reported by Pylint.

Import "from pandas.core.window.doc import _shared_docs, args_compat, create_section_header, kwargs_compat, numba_notes, template_header, template_returns, template_see_also, window_agg_numba_parameters, window_apply_parameters" should be placed at the top of the module
Error

Line: 26 Column: 1

                  ExpandingIndexer,
    GroupbyIndexer,
)
from pandas.core.window.doc import (
    _shared_docs,
    args_compat,
    create_section_header,
    kwargs_compat,
    numba_notes,

            

Reported by Pylint.

Import "from pandas.core.window.rolling import BaseWindowGroupby, RollingAndExpandingMixin" should be placed at the top of the module
Error

Line: 38 Column: 1

                  window_agg_numba_parameters,
    window_apply_parameters,
)
from pandas.core.window.rolling import (
    BaseWindowGroupby,
    RollingAndExpandingMixin,
)



            

Reported by Pylint.

Too many arguments (7/5)
Error

Line: 101 Column: 5

              
    _attributes = ["min_periods", "center", "axis", "method"]

    def __init__(
        self,
        obj: FrameOrSeries,
        min_periods: int = 1,
        center=None,
        axis: Axis = 0,

            

Reported by Pylint.

pandas/tests/arrays/categorical/test_algos.py
11 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

import pandas as pd
import pandas._testing as tm


@pytest.mark.parametrize("ordered", [True, False])
@pytest.mark.parametrize("categories", [["b", "a", "c"], ["a", "b", "c", "d"]])

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest

import pandas as pd
import pandas._testing as tm


@pytest.mark.parametrize("ordered", [True, False])
@pytest.mark.parametrize("categories", [["b", "a", "c"], ["a", "b", "c", "d"]])

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 10 Column: 1

              
@pytest.mark.parametrize("ordered", [True, False])
@pytest.mark.parametrize("categories", [["b", "a", "c"], ["a", "b", "c", "d"]])
def test_factorize(categories, ordered):
    cat = pd.Categorical(
        ["b", "b", "a", "c", None], categories=categories, ordered=ordered
    )
    codes, uniques = pd.factorize(cat)
    expected_codes = np.array([0, 0, 1, 2, -1], dtype=np.intp)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 1

                  tm.assert_categorical_equal(uniques, expected_uniques)


def test_factorized_sort():
    cat = pd.Categorical(["b", "b", None, "a"])
    codes, uniques = pd.factorize(cat, sort=True)
    expected_codes = np.array([1, 1, -1, 0], dtype=np.intp)
    expected_uniques = pd.Categorical(["a", "b"])


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 34 Column: 1

                  tm.assert_categorical_equal(uniques, expected_uniques)


def test_factorized_sort_ordered():
    cat = pd.Categorical(
        ["b", "b", None, "a"], categories=["c", "b", "a"], ordered=True
    )

    codes, uniques = pd.factorize(cat, sort=True)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 49 Column: 1

                  tm.assert_categorical_equal(uniques, expected_uniques)


def test_isin_cats():
    # GH2003
    cat = pd.Categorical(["a", "b", np.nan])

    result = cat.isin(["a", np.nan])
    expected = np.array([True, False, True], dtype=bool)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 63 Column: 1

              

@pytest.mark.parametrize("empty", [[], pd.Series(dtype=object), np.array([])])
def test_isin_empty(empty):
    s = pd.Categorical(["a", "b"])
    expected = np.array([False, False], dtype=bool)

    result = s.isin(empty)
    tm.assert_numpy_array_equal(expected, result)

            

Reported by Pylint.

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

Line: 64 Column: 5

              
@pytest.mark.parametrize("empty", [[], pd.Series(dtype=object), np.array([])])
def test_isin_empty(empty):
    s = pd.Categorical(["a", "b"])
    expected = np.array([False, False], dtype=bool)

    result = s.isin(empty)
    tm.assert_numpy_array_equal(expected, result)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 71 Column: 1

                  tm.assert_numpy_array_equal(expected, result)


def test_diff():
    s = pd.Series([1, 2, 3], dtype="category")
    with tm.assert_produces_warning(FutureWarning):
        result = s.diff()
    expected = pd.Series([np.nan, 1, 1])
    tm.assert_series_equal(result, expected)

            

Reported by Pylint.

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

Line: 72 Column: 5

              

def test_diff():
    s = pd.Series([1, 2, 3], dtype="category")
    with tm.assert_produces_warning(FutureWarning):
        result = s.diff()
    expected = pd.Series([np.nan, 1, 1])
    tm.assert_series_equal(result, expected)


            

Reported by Pylint.

pandas/tests/arrays/floating/conftest.py
11 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

import pandas as pd
from pandas.core.arrays.floating import (
    Float32Dtype,
    Float64Dtype,
)


            

Reported by Pylint.

Redefining name 'dtype' from outer scope (line 12)
Error

Line: 17 Column: 10

              

@pytest.fixture
def data(dtype):
    return pd.array(
        list(np.arange(0.1, 0.9, 0.1))
        + [pd.NA]
        + list(np.arange(1, 9.8, 0.1))
        + [pd.NA]

            

Reported by Pylint.

Redefining name 'dtype' from outer scope (line 12)
Error

Line: 29 Column: 18

              

@pytest.fixture
def data_missing(dtype):
    return pd.array([np.nan, 0.1], dtype=dtype)


@pytest.fixture(params=["data", "data_missing"])
def all_data(request, data, data_missing):

            

Reported by Pylint.

Redefining name 'data' from outer scope (line 17)
Error

Line: 34 Column: 23

              

@pytest.fixture(params=["data", "data_missing"])
def all_data(request, data, data_missing):
    """Parametrized fixture giving 'data' and 'data_missing'"""
    if request.param == "data":
        return data
    elif request.param == "data_missing":
        return data_missing

            

Reported by Pylint.

Redefining name 'data_missing' from outer scope (line 29)
Error

Line: 34 Column: 29

              

@pytest.fixture(params=["data", "data_missing"])
def all_data(request, data, data_missing):
    """Parametrized fixture giving 'data' and 'data_missing'"""
    if request.param == "data":
        return data
    elif request.param == "data_missing":
        return data_missing

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest

import pandas as pd
from pandas.core.arrays.floating import (
    Float32Dtype,
    Float64Dtype,
)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 1

              

@pytest.fixture(params=[Float32Dtype, Float64Dtype])
def dtype(request):
    return request.param()


@pytest.fixture
def data(dtype):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 17 Column: 1

              

@pytest.fixture
def data(dtype):
    return pd.array(
        list(np.arange(0.1, 0.9, 0.1))
        + [pd.NA]
        + list(np.arange(1, 9.8, 0.1))
        + [pd.NA]

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 29 Column: 1

              

@pytest.fixture
def data_missing(dtype):
    return pd.array([np.nan, 0.1], dtype=dtype)


@pytest.fixture(params=["data", "data_missing"])
def all_data(request, data, data_missing):

            

Reported by Pylint.

Either all return statements in a function should return an expression, or none of them should.
Error

Line: 34 Column: 1

              

@pytest.fixture(params=["data", "data_missing"])
def all_data(request, data, data_missing):
    """Parametrized fixture giving 'data' and 'data_missing'"""
    if request.param == "data":
        return data
    elif request.param == "data_missing":
        return data_missing

            

Reported by Pylint.