The following issues were found

pandas/tests/indexing/multiindex/test_indexing_slow.py
20 issues
Unable to import 'pytest'
Error

Line: 8 Column: 1

              import warnings

import numpy as np
import pytest

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

            

Reported by Pylint.

Redefining name 'df' from outer scope (line 42)
Error

Line: 47 Column: 18

              b = df.drop_duplicates(subset=cols[:-1])


def validate(mi, df, key):
    # check indexing into a multi-index before & past the lexsort depth

    mask = np.ones(len(df)).astype("bool")

    # test for all partials of this key

            

Reported by Pylint.

Redefining name 'df' from outer scope (line 42)
Error

Line: 91 Column: 13

              
    with warnings.catch_warnings(record=True):
        if lexsort_depth == 0:
            df = frame.copy()
        else:
            df = frame.sort_values(by=cols[:lexsort_depth])

        mi = df.set_index(cols[:-1])
        assert not mi.index._lexsort_depth < lexsort_depth

            

Reported by Pylint.

Access to a protected member _lexsort_depth of a client class
Error

Line: 96 Column: 20

                          df = frame.sort_values(by=cols[:lexsort_depth])

        mi = df.set_index(cols[:-1])
        assert not mi.index._lexsort_depth < lexsort_depth
        validate(mi, df, key)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from typing import (
    Any,
    List,
)
import warnings

import numpy as np
import pytest


            

Reported by Pylint.

Constant name "m" doesn't conform to UPPER_CASE naming style
Error

Line: 17 Column: 1

              )
import pandas._testing as tm

m = 50
n = 1000
cols = ["jim", "joe", "jolie", "joline", "jolia"]

vals: List[Any] = [
    np.random.randint(0, 10, n),

            

Reported by Pylint.

Constant name "n" doesn't conform to UPPER_CASE naming style
Error

Line: 18 Column: 1

              import pandas._testing as tm

m = 50
n = 1000
cols = ["jim", "joe", "jolie", "joline", "jolia"]

vals: List[Any] = [
    np.random.randint(0, 10, n),
    np.random.choice(list("abcdefghij"), n),

            

Reported by Pylint.

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

Line: 47 Column: 1

              b = df.drop_duplicates(subset=cols[:-1])


def validate(mi, df, key):
    # check indexing into a multi-index before & past the lexsort depth

    mask = np.ones(len(df)).astype("bool")

    # test for all partials of this key

            

Reported by Pylint.

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

Line: 47 Column: 1

              b = df.drop_duplicates(subset=cols[:-1])


def validate(mi, df, key):
    # check indexing into a multi-index before & past the lexsort depth

    mask = np.ones(len(df)).astype("bool")

    # test for all partials of this key

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 47 Column: 1

              b = df.drop_duplicates(subset=cols[:-1])


def validate(mi, df, key):
    # check indexing into a multi-index before & past the lexsort depth

    mask = np.ones(len(df)).astype("bool")

    # test for all partials of this key

            

Reported by Pylint.

pandas/tests/series/test_reductions.py
20 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

import pandas as pd
from pandas import (
    MultiIndex,
    Series,
)
import pandas._testing as tm

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest

import pandas as pd
from pandas import (
    MultiIndex,
    Series,
)
import pandas._testing as tm

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 1

              import pandas._testing as tm


def test_reductions_td64_with_nat():
    # GH#8617
    ser = Series([0, pd.NaT], dtype="m8[ns]")
    exp = ser[0]
    assert ser.median() == exp
    assert ser.min() == exp

            

Reported by Pylint.

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

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

                  # GH#8617
    ser = Series([0, pd.NaT], dtype="m8[ns]")
    exp = ser[0]
    assert ser.median() == exp
    assert ser.min() == exp
    assert ser.max() == exp


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

            

Reported by Bandit.

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

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

                  ser = Series([0, pd.NaT], dtype="m8[ns]")
    exp = ser[0]
    assert ser.median() == exp
    assert ser.min() == exp
    assert ser.max() == exp


@pytest.mark.parametrize("skipna", [True, False])
def test_td64_sum_empty(skipna):

            

Reported by Bandit.

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

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

                  exp = ser[0]
    assert ser.median() == exp
    assert ser.min() == exp
    assert ser.max() == exp


@pytest.mark.parametrize("skipna", [True, False])
def test_td64_sum_empty(skipna):
    # GH#37151

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 22 Column: 1

              

@pytest.mark.parametrize("skipna", [True, False])
def test_td64_sum_empty(skipna):
    # GH#37151
    ser = Series([], dtype="timedelta64[ns]")

    result = ser.sum(skipna=skipna)
    assert isinstance(result, pd.Timedelta)

            

Reported by Pylint.

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

                  ser = Series([], dtype="timedelta64[ns]")

    result = ser.sum(skipna=skipna)
    assert isinstance(result, pd.Timedelta)
    assert result == pd.Timedelta(0)


def test_td64_summation_overflow():
    # GH#9442

            

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

              
    result = ser.sum(skipna=skipna)
    assert isinstance(result, pd.Timedelta)
    assert result == pd.Timedelta(0)


def test_td64_summation_overflow():
    # GH#9442
    ser = Series(pd.date_range("20130101", periods=100000, freq="H"))

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 31 Column: 1

                  assert result == pd.Timedelta(0)


def test_td64_summation_overflow():
    # GH#9442
    ser = Series(pd.date_range("20130101", periods=100000, freq="H"))
    ser[0] += pd.Timedelta("1s 1ms")

    # mean

            

Reported by Pylint.

pandas/tests/reshape/merge/test_merge_index_as_string.py
20 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


@pytest.fixture
def df1():

            

Reported by Pylint.

Redefining name 'df1' from outer scope (line 9)
Error

Line: 31 Column: 22

              

@pytest.fixture(params=[[], ["outer"], ["outer", "inner"]])
def left_df(request, df1):
    """Construct left test DataFrame with specified levels
    (any of 'outer', 'inner', and 'v1')
    """
    levels = request.param
    if levels:

            

Reported by Pylint.

Redefining name 'df2' from outer scope (line 20)
Error

Line: 43 Column: 23

              

@pytest.fixture(params=[[], ["outer"], ["outer", "inner"]])
def right_df(request, df2):
    """Construct right test DataFrame with specified levels
    (any of 'outer', 'inner', and 'v2')
    """
    levels = request.param


            

Reported by Pylint.

Redefining name 'left_df' from outer scope (line 31)
Error

Line: 133 Column: 39

                      (["inner", "outer"], "outer"),
    ],
)
def test_merge_indexes_and_columns_on(left_df, right_df, on, how):

    # Construct expected result
    expected = compute_expected(left_df, right_df, on=on, how=how)

    # Perform merge

            

Reported by Pylint.

Redefining name 'right_df' from outer scope (line 43)
Error

Line: 133 Column: 48

                      (["inner", "outer"], "outer"),
    ],
)
def test_merge_indexes_and_columns_on(left_df, right_df, on, how):

    # Construct expected result
    expected = compute_expected(left_df, right_df, on=on, how=how)

    # Perform merge

            

Reported by Pylint.

Redefining name 'left_df' from outer scope (line 31)
Error

Line: 153 Column: 5

                  ],
)
def test_merge_indexes_and_columns_lefton_righton(
    left_df, right_df, left_on, right_on, how
):

    # Construct expected result
    expected = compute_expected(
        left_df, right_df, left_on=left_on, right_on=right_on, how=how

            

Reported by Pylint.

Redefining name 'right_df' from outer scope (line 43)
Error

Line: 153 Column: 14

                  ],
)
def test_merge_indexes_and_columns_lefton_righton(
    left_df, right_df, left_on, right_on, how
):

    # Construct expected result
    expected = compute_expected(
        left_df, right_df, left_on=left_on, right_on=right_on, how=how

            

Reported by Pylint.

Redefining name 'df2' from outer scope (line 20)
Error

Line: 167 Column: 43

              

@pytest.mark.parametrize("left_index", ["inner", ["inner", "outer"]])
def test_join_indexes_and_columns_on(df1, df2, left_index, join_type):

    # Construct left_df
    left_df = df1.set_index(left_index)

    # Construct right_df

            

Reported by Pylint.

Redefining name 'df1' from outer scope (line 9)
Error

Line: 167 Column: 38

              

@pytest.mark.parametrize("left_index", ["inner", ["inner", "outer"]])
def test_join_indexes_and_columns_on(df1, df2, left_index, join_type):

    # Construct left_df
    left_df = df1.set_index(left_index)

    # Construct right_df

            

Reported by Pylint.

Redefining name 'left_df' from outer scope (line 31)
Error

Line: 170 Column: 5

              def test_join_indexes_and_columns_on(df1, df2, left_index, join_type):

    # Construct left_df
    left_df = df1.set_index(left_index)

    # Construct right_df
    right_df = df2.set_index(["outer", "inner"])

    # Result

            

Reported by Pylint.

pandas/tests/io/pytables/test_categorical.py
20 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

from pandas import (
    Categorical,
    DataFrame,
    Series,
    _testing as tm,
    concat,

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest

from pandas import (
    Categorical,
    DataFrame,
    Series,
    _testing as tm,
    concat,

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 27 Column: 1

              ]


def test_categorical(setup_path):

    with ensure_clean_store(setup_path) as store:

        # Basic
        _maybe_remove(store, "s")

            

Reported by Pylint.

Too many statements (70/50)
Error

Line: 27 Column: 1

              ]


def test_categorical(setup_path):

    with ensure_clean_store(setup_path) as store:

        # Basic
        _maybe_remove(store, "s")

            

Reported by Pylint.

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

Line: 33 Column: 9

              
        # Basic
        _maybe_remove(store, "s")
        s = Series(
            Categorical(
                ["a", "b", "b", "a", "a", "c"],
                categories=["a", "b", "c", "d"],
                ordered=False,
            )

            

Reported by Pylint.

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

Line: 45 Column: 9

                      tm.assert_series_equal(s, result)

        _maybe_remove(store, "s_ordered")
        s = Series(
            Categorical(
                ["a", "b", "b", "a", "a", "c"],
                categories=["a", "b", "c", "d"],
                ordered=True,
            )

            

Reported by Pylint.

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

Line: 57 Column: 9

                      tm.assert_series_equal(s, result)

        _maybe_remove(store, "df")
        df = DataFrame({"s": s, "vals": [1, 2, 3, 4, 5, 6]})
        store.append("df", df, format="table")
        result = store.select("df")
        tm.assert_frame_equal(result, df)

        # Dtypes

            

Reported by Pylint.

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

Line: 64 Column: 9

              
        # Dtypes
        _maybe_remove(store, "si")
        s = Series([1, 1, 2, 2, 3, 4, 5]).astype("category")
        store.append("si", s)
        result = store.select("si")
        tm.assert_series_equal(result, s)

        _maybe_remove(store, "si2")

            

Reported by Pylint.

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

Line: 70 Column: 9

                      tm.assert_series_equal(result, s)

        _maybe_remove(store, "si2")
        s = Series([1, 1, np.nan, 2, 3, 4, 5]).astype("category")
        store.append("si2", s)
        result = store.select("si2")
        tm.assert_series_equal(result, s)

        # Multiple

            

Reported by Pylint.

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

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

              
        # Make sure the metadata is OK
        info = store.info()
        assert "/df2   " in info
        # assert '/df2/meta/values_block_0/meta' in info
        assert "/df2/meta/values_block_1/meta" in info

        # unordered
        _maybe_remove(store, "s2")

            

Reported by Bandit.

pandas/tests/io/excel/test_xlsxwriter.py
20 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              import re
import warnings

import pytest

from pandas import DataFrame
import pandas._testing as tm

from pandas.io.excel import ExcelWriter

            

Reported by Pylint.

Abstract class 'ExcelWriter' with abstract methods instantiated
Error

Line: 27 Column: 14

                  with tm.ensure_clean(ext) as path:
        frame = DataFrame({"A": [123456, 123456], "B": [123456, 123456]})

        with ExcelWriter(path) as writer:
            frame.to_excel(writer)

            # Add a number format to col B and ensure it is applied to cells.
            num_format = "#,##0"
            write_workbook = writer.book

            

Reported by Pylint.

Instance of 'ExcelWriter' has no 'book' member
Error

Line: 32 Column: 30

              
            # Add a number format to col B and ensure it is applied to cells.
            num_format = "#,##0"
            write_workbook = writer.book
            write_worksheet = write_workbook.worksheets()[0]
            col_format = write_workbook.add_format({"num_format": num_format})
            write_worksheet.set_column("B:B", None, col_format)

        read_workbook = openpyxl.load_workbook(path)

            

Reported by Pylint.

Abstract class 'ExcelWriter' with abstract methods instantiated
Error

Line: 64 Column: 13

              
    with tm.ensure_clean(ext) as f:
        with pytest.raises(ValueError, match=msg):
            ExcelWriter(f, engine="xlsxwriter", mode="a")


@pytest.mark.parametrize("nan_inf_to_errors", [True, False])
def test_kwargs(ext, nan_inf_to_errors):
    # GH 42286

            

Reported by Pylint.

Abstract class 'ExcelWriter' with abstract methods instantiated
Error

Line: 74 Column: 18

                  with tm.ensure_clean(ext) as f:
        msg = re.escape("Use of **kwargs is deprecated")
        with tm.assert_produces_warning(FutureWarning, match=msg):
            with ExcelWriter(f, engine="xlsxwriter", **kwargs) as writer:
                assert writer.book.nan_inf_to_errors == nan_inf_to_errors


@pytest.mark.parametrize("nan_inf_to_errors", [True, False])
def test_engine_kwargs(ext, nan_inf_to_errors):

            

Reported by Pylint.

Instance of 'ExcelWriter' has no 'book' member
Error

Line: 75 Column: 24

                      msg = re.escape("Use of **kwargs is deprecated")
        with tm.assert_produces_warning(FutureWarning, match=msg):
            with ExcelWriter(f, engine="xlsxwriter", **kwargs) as writer:
                assert writer.book.nan_inf_to_errors == nan_inf_to_errors


@pytest.mark.parametrize("nan_inf_to_errors", [True, False])
def test_engine_kwargs(ext, nan_inf_to_errors):
    # GH 42286

            

Reported by Pylint.

Abstract class 'ExcelWriter' with abstract methods instantiated
Error

Line: 83 Column: 14

                  # GH 42286
    engine_kwargs = {"options": {"nan_inf_to_errors": nan_inf_to_errors}}
    with tm.ensure_clean(ext) as f:
        with ExcelWriter(f, engine="xlsxwriter", engine_kwargs=engine_kwargs) as writer:
            assert writer.book.nan_inf_to_errors == nan_inf_to_errors

            

Reported by Pylint.

Instance of 'ExcelWriter' has no 'book' member
Error

Line: 84 Column: 20

                  engine_kwargs = {"options": {"nan_inf_to_errors": nan_inf_to_errors}}
    with tm.ensure_clean(ext) as f:
        with ExcelWriter(f, engine="xlsxwriter", engine_kwargs=engine_kwargs) as writer:
            assert writer.book.nan_inf_to_errors == nan_inf_to_errors

            

Reported by Pylint.

Access to a protected member _format_code of a client class
Error

Line: 54 Column: 31

                      try:
            read_num_format = cell.number_format
        except AttributeError:
            read_num_format = cell.style.number_format._format_code

        assert read_num_format == num_format


def test_write_append_mode_raises(ext):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import re
import warnings

import pytest

from pandas import DataFrame
import pandas._testing as tm

from pandas.io.excel import ExcelWriter

            

Reported by Pylint.

pandas/tests/scalar/interval/test_ops.py
20 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              """Tests for Interval-Interval operations, such as overlaps, contains, etc."""
import pytest

from pandas import (
    Interval,
    Timedelta,
    Timestamp,
)


            

Reported by Pylint.

Redefining name 'start_shift' from outer scope (line 18)
Error

Line: 28 Column: 34

              

class TestOverlaps:
    def test_overlaps_self(self, start_shift, closed):
        start, shift = start_shift
        interval = Interval(start, start + shift, closed)
        assert interval.overlaps(interval)

    def test_overlaps_nested(self, start_shift, closed, other_closed):

            

Reported by Pylint.

Redefining name 'start_shift' from outer scope (line 18)
Error

Line: 33 Column: 36

                      interval = Interval(start, start + shift, closed)
        assert interval.overlaps(interval)

    def test_overlaps_nested(self, start_shift, closed, other_closed):
        start, shift = start_shift
        interval1 = Interval(start, start + 3 * shift, other_closed)
        interval2 = Interval(start + shift, start + 2 * shift, closed)

        # nested intervals should always overlap

            

Reported by Pylint.

Redefining name 'start_shift' from outer scope (line 18)
Error

Line: 41 Column: 38

                      # nested intervals should always overlap
        assert interval1.overlaps(interval2)

    def test_overlaps_disjoint(self, start_shift, closed, other_closed):
        start, shift = start_shift
        interval1 = Interval(start, start + shift, other_closed)
        interval2 = Interval(start + 2 * shift, start + 3 * shift, closed)

        # disjoint intervals should never overlap

            

Reported by Pylint.

Redefining name 'start_shift' from outer scope (line 18)
Error

Line: 49 Column: 38

                      # disjoint intervals should never overlap
        assert not interval1.overlaps(interval2)

    def test_overlaps_endpoint(self, start_shift, closed, other_closed):
        start, shift = start_shift
        interval1 = Interval(start, start + shift, other_closed)
        interval2 = Interval(start + shift, start + 2 * shift, closed)

        # overlap if shared endpoint is closed for both (overlap at a point)

            

Reported by Pylint.

Missing class docstring
Error

Line: 27 Column: 1

                  return request.param


class TestOverlaps:
    def test_overlaps_self(self, start_shift, closed):
        start, shift = start_shift
        interval = Interval(start, start + shift, closed)
        assert interval.overlaps(interval)


            

Reported by Pylint.

Method could be a function
Error

Line: 28 Column: 5

              

class TestOverlaps:
    def test_overlaps_self(self, start_shift, closed):
        start, shift = start_shift
        interval = Interval(start, start + shift, closed)
        assert interval.overlaps(interval)

    def test_overlaps_nested(self, start_shift, closed, other_closed):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 28 Column: 5

              

class TestOverlaps:
    def test_overlaps_self(self, start_shift, closed):
        start, shift = start_shift
        interval = Interval(start, start + shift, closed)
        assert interval.overlaps(interval)

    def test_overlaps_nested(self, start_shift, closed, other_closed):

            

Reported by Pylint.

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

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

                  def test_overlaps_self(self, start_shift, closed):
        start, shift = start_shift
        interval = Interval(start, start + shift, closed)
        assert interval.overlaps(interval)

    def test_overlaps_nested(self, start_shift, closed, other_closed):
        start, shift = start_shift
        interval1 = Interval(start, start + 3 * shift, other_closed)
        interval2 = Interval(start + shift, start + 2 * shift, closed)

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 33 Column: 5

                      interval = Interval(start, start + shift, closed)
        assert interval.overlaps(interval)

    def test_overlaps_nested(self, start_shift, closed, other_closed):
        start, shift = start_shift
        interval1 = Interval(start, start + 3 * shift, other_closed)
        interval2 = Interval(start + shift, start + 2 * shift, closed)

        # nested intervals should always overlap

            

Reported by Pylint.

pandas/tests/extension/test_common.py
20 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

from pandas.core.dtypes import dtypes
from pandas.core.dtypes.common import is_extension_array_dtype

import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import ExtensionArray

            

Reported by Pylint.

Method '__setitem__' is abstract in class 'ExtensionArray' but is not overridden
Error

Line: 16 Column: 1

                  pass


class DummyArray(ExtensionArray):
    def __init__(self, data):
        self.data = data

    def __array__(self, dtype):
        return self.data

            

Reported by Pylint.

Unused argument 'dtype'
Error

Line: 20 Column: 25

                  def __init__(self, data):
        self.data = data

    def __array__(self, dtype):
        return self.data

    @property
    def dtype(self):
        return DummyDtype()

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest

from pandas.core.dtypes import dtypes
from pandas.core.dtypes.common import is_extension_array_dtype

import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import ExtensionArray

            

Reported by Pylint.

Missing class docstring
Error

Line: 12 Column: 1

              from pandas.core.arrays import ExtensionArray


class DummyDtype(dtypes.ExtensionDtype):
    pass


class DummyArray(ExtensionArray):
    def __init__(self, data):

            

Reported by Pylint.

Missing class docstring
Error

Line: 16 Column: 1

                  pass


class DummyArray(ExtensionArray):
    def __init__(self, data):
        self.data = data

    def __array__(self, dtype):
        return self.data

            

Reported by Pylint.

Missing class docstring
Error

Line: 37 Column: 1

                      return np.array(self, dtype=dtype, copy=copy)


class TestExtensionArrayDtype:
    @pytest.mark.parametrize(
        "values",
        [
            pd.Categorical([]),
            pd.Categorical([]).dtype,

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 46 Column: 5

                          pd.Series(pd.Categorical([])),
            DummyDtype(),
            DummyArray(np.array([1, 2])),
        ],
    )
    def test_is_extension_array_dtype(self, values):
        assert is_extension_array_dtype(values)

    @pytest.mark.parametrize("values", [np.array([]), pd.Series(np.array([]))])

            

Reported by Pylint.

Method could be a function
Error

Line: 46 Column: 5

                          pd.Series(pd.Categorical([])),
            DummyDtype(),
            DummyArray(np.array([1, 2])),
        ],
    )
    def test_is_extension_array_dtype(self, values):
        assert is_extension_array_dtype(values)

    @pytest.mark.parametrize("values", [np.array([]), pd.Series(np.array([]))])

            

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

                      ],
    )
    def test_is_extension_array_dtype(self, values):
        assert is_extension_array_dtype(values)

    @pytest.mark.parametrize("values", [np.array([]), pd.Series(np.array([]))])
    def test_is_not_extension_array_dtype(self, values):
        assert not is_extension_array_dtype(values)


            

Reported by Bandit.

pandas/tests/frame/indexing/test_lookup.py
20 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

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


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest

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


            

Reported by Pylint.

Missing class docstring
Error

Line: 11 Column: 1

              import pandas._testing as tm


class TestLookup:
    def test_lookup_float(self, float_frame):
        df = float_frame
        rows = list(df.index) * len(df.columns)
        cols = list(df.columns) * len(df.index)
        with tm.assert_produces_warning(FutureWarning):

            

Reported by Pylint.

Method could be a function
Error

Line: 12 Column: 5

              

class TestLookup:
    def test_lookup_float(self, float_frame):
        df = float_frame
        rows = list(df.index) * len(df.columns)
        cols = list(df.columns) * len(df.index)
        with tm.assert_produces_warning(FutureWarning):
            result = df.lookup(rows, cols)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 12 Column: 5

              

class TestLookup:
    def test_lookup_float(self, float_frame):
        df = float_frame
        rows = list(df.index) * len(df.columns)
        cols = list(df.columns) * len(df.index)
        with tm.assert_produces_warning(FutureWarning):
            result = df.lookup(rows, cols)

            

Reported by Pylint.

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

Line: 13 Column: 9

              
class TestLookup:
    def test_lookup_float(self, float_frame):
        df = float_frame
        rows = list(df.index) * len(df.columns)
        cols = list(df.columns) * len(df.index)
        with tm.assert_produces_warning(FutureWarning):
            result = df.lookup(rows, cols)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 22 Column: 5

                      expected = np.array([df.loc[r, c] for r, c in zip(rows, cols)])
        tm.assert_numpy_array_equal(result, expected)

    def test_lookup_mixed(self, float_string_frame):
        df = float_string_frame
        rows = list(df.index) * len(df.columns)
        cols = list(df.columns) * len(df.index)
        with tm.assert_produces_warning(FutureWarning):
            result = df.lookup(rows, cols)

            

Reported by Pylint.

Method could be a function
Error

Line: 22 Column: 5

                      expected = np.array([df.loc[r, c] for r, c in zip(rows, cols)])
        tm.assert_numpy_array_equal(result, expected)

    def test_lookup_mixed(self, float_string_frame):
        df = float_string_frame
        rows = list(df.index) * len(df.columns)
        cols = list(df.columns) * len(df.index)
        with tm.assert_produces_warning(FutureWarning):
            result = df.lookup(rows, cols)

            

Reported by Pylint.

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

Line: 23 Column: 9

                      tm.assert_numpy_array_equal(result, expected)

    def test_lookup_mixed(self, float_string_frame):
        df = float_string_frame
        rows = list(df.index) * len(df.columns)
        cols = list(df.columns) * len(df.index)
        with tm.assert_produces_warning(FutureWarning):
            result = df.lookup(rows, cols)


            

Reported by Pylint.

Method could be a function
Error

Line: 34 Column: 5

                      )
        tm.assert_almost_equal(result, expected)

    def test_lookup_bool(self):
        df = DataFrame(
            {
                "label": ["a", "b", "a", "c"],
                "mask_a": [True, True, False, True],
                "mask_b": [True, False, False, False],

            

Reported by Pylint.

pandas/tests/frame/methods/test_to_period.py
20 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

from pandas import (
    DataFrame,
    DatetimeIndex,
    PeriodIndex,
    Series,
    date_range,

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest

from pandas import (
    DataFrame,
    DatetimeIndex,
    PeriodIndex,
    Series,
    date_range,

            

Reported by Pylint.

Missing class docstring
Error

Line: 15 Column: 1

              import pandas._testing as tm


class TestToPeriod:
    def test_to_period(self, frame_or_series):
        K = 5

        dr = date_range("1/1/2000", "1/1/2001", freq="D")
        obj = DataFrame(

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 16 Column: 5

              

class TestToPeriod:
    def test_to_period(self, frame_or_series):
        K = 5

        dr = date_range("1/1/2000", "1/1/2001", freq="D")
        obj = DataFrame(
            np.random.randn(len(dr), K), index=dr, columns=["A", "B", "C", "D", "E"]

            

Reported by Pylint.

Method could be a function
Error

Line: 16 Column: 5

              

class TestToPeriod:
    def test_to_period(self, frame_or_series):
        K = 5

        dr = date_range("1/1/2000", "1/1/2001", freq="D")
        obj = DataFrame(
            np.random.randn(len(dr), K), index=dr, columns=["A", "B", "C", "D", "E"]

            

Reported by Pylint.

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

Line: 17 Column: 9

              
class TestToPeriod:
    def test_to_period(self, frame_or_series):
        K = 5

        dr = date_range("1/1/2000", "1/1/2001", freq="D")
        obj = DataFrame(
            np.random.randn(len(dr), K), index=dr, columns=["A", "B", "C", "D", "E"]
        )

            

Reported by Pylint.

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

Line: 19 Column: 9

                  def test_to_period(self, frame_or_series):
        K = 5

        dr = date_range("1/1/2000", "1/1/2001", freq="D")
        obj = DataFrame(
            np.random.randn(len(dr), K), index=dr, columns=["A", "B", "C", "D", "E"]
        )
        obj["mix"] = "a"
        if frame_or_series is Series:

            

Reported by Pylint.

Method could be a function
Error

Line: 36 Column: 5

                      exp.index = exp.index.asfreq("M")
        tm.assert_equal(pts, exp)

    def test_to_period_without_freq(self, frame_or_series):
        # GH#7606 without freq
        idx = DatetimeIndex(["2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04"])
        exp_idx = PeriodIndex(
            ["2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04"], freq="D"
        )

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 36 Column: 5

                      exp.index = exp.index.asfreq("M")
        tm.assert_equal(pts, exp)

    def test_to_period_without_freq(self, frame_or_series):
        # GH#7606 without freq
        idx = DatetimeIndex(["2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04"])
        exp_idx = PeriodIndex(
            ["2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04"], freq="D"
        )

            

Reported by Pylint.

Method could be a function
Error

Line: 55 Column: 5

                          expected.columns = exp_idx
            tm.assert_frame_equal(obj.to_period(axis=1), expected)

    def test_to_period_columns(self):
        dr = date_range("1/1/2000", "1/1/2001")
        df = DataFrame(np.random.randn(len(dr), 5), index=dr)
        df["mix"] = "a"

        df = df.T

            

Reported by Pylint.

pandas/core/indexes/accessors.py
20 issues
Parameters differ from overridden '_delegate_property_get' method
Error

Line: 77 Column: 5

                          f"cannot convert an object of type {type(data)} to a datetimelike index"
        )

    def _delegate_property_get(self, name):
        from pandas import Series

        values = self._get_values()

        result = getattr(values, name)

            

Reported by Pylint.

Access to a protected member _is_copy of a client class
Error

Line: 101 Column: 9

                      result = Series(result, index=index, name=self.name).__finalize__(self._parent)

        # setting this object will show a SettingWithCopyWarning/Error
        result._is_copy = (
            "modifications to a property of a datetimelike "
            "object are not supported and are discarded. "
            "Change values on the original."
        )


            

Reported by Pylint.

Access to a protected member _is_copy of a client class
Error

Line: 131 Column: 9

                      )

        # setting this object will show a SettingWithCopyWarning/Error
        result._is_copy = (
            "modifications to a method of a datetimelike "
            "object are not supported and are discarded. "
            "Change values on the original."
        )


            

Reported by Pylint.

Access to a protected member _datetimelike_ops of a client class
Error

Line: 141 Column: 39

              

@delegate_names(
    delegate=DatetimeArray, accessors=DatetimeArray._datetimelike_ops, typ="property"
)
@delegate_names(
    delegate=DatetimeArray, accessors=DatetimeArray._datetimelike_methods, typ="method"
)
class DatetimeProperties(Properties):

            

Reported by Pylint.

Access to a protected member _datetimelike_methods of a client class
Error

Line: 144 Column: 39

                  delegate=DatetimeArray, accessors=DatetimeArray._datetimelike_ops, typ="property"
)
@delegate_names(
    delegate=DatetimeArray, accessors=DatetimeArray._datetimelike_methods, typ="method"
)
class DatetimeProperties(Properties):
    """
    Accessor object for datetimelike properties of the Series values.


            

Reported by Pylint.

Access to a protected member _datetimelike_ops of a client class
Error

Line: 301 Column: 40

              

@delegate_names(
    delegate=TimedeltaArray, accessors=TimedeltaArray._datetimelike_ops, typ="property"
)
@delegate_names(
    delegate=TimedeltaArray,
    accessors=TimedeltaArray._datetimelike_methods,
    typ="method",

            

Reported by Pylint.

Access to a protected member _datetimelike_methods of a client class
Error

Line: 305 Column: 15

              )
@delegate_names(
    delegate=TimedeltaArray,
    accessors=TimedeltaArray._datetimelike_methods,
    typ="method",
)
class TimedeltaProperties(Properties):
    """
    Accessor object for datetimelike properties of the Series values.

            

Reported by Pylint.

Access to a protected member _datetimelike_ops of a client class
Error

Line: 408 Column: 37

              

@delegate_names(
    delegate=PeriodArray, accessors=PeriodArray._datetimelike_ops, typ="property"
)
@delegate_names(
    delegate=PeriodArray, accessors=PeriodArray._datetimelike_methods, typ="method"
)
class PeriodProperties(Properties):

            

Reported by Pylint.

Access to a protected member _datetimelike_methods of a client class
Error

Line: 411 Column: 37

                  delegate=PeriodArray, accessors=PeriodArray._datetimelike_ops, typ="property"
)
@delegate_names(
    delegate=PeriodArray, accessors=PeriodArray._datetimelike_methods, typ="method"
)
class PeriodProperties(Properties):
    """
    Accessor object for datetimelike properties of the Series values.


            

Reported by Pylint.

Missing class docstring
Error

Line: 42 Column: 1

                  from pandas import Series


class Properties(PandasDelegate, PandasObject, NoNewAttributesMixin):
    _hidden_attrs = PandasObject._hidden_attrs | {
        "orig",
        "name",
    }


            

Reported by Pylint.