The following issues were found

pandas/tests/tseries/offsets/test_business_hour.py
151 issues
Unable to import 'pytest'
Error

Line: 9 Column: 1

                  time as dt_time,
)

import pytest

from pandas._libs.tslibs import (
    Timedelta,
    Timestamp,
)

            

Reported by Pylint.

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

Line: 15 Column: 1

                  Timedelta,
    Timestamp,
)
from pandas._libs.tslibs.offsets import (
    BDay,
    BusinessHour,
    Nano,
)


            

Reported by Pylint.

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

Line: 15 Column: 1

                  Timedelta,
    Timestamp,
)
from pandas._libs.tslibs.offsets import (
    BDay,
    BusinessHour,
    Nano,
)


            

Reported by Pylint.

Unused argument 'method'
Error

Line: 35 Column: 28

              class TestBusinessHour(Base):
    _offset = BusinessHour

    def setup_method(self, method):
        self.d = datetime(2014, 7, 1, 10, 00)

        self.offset1 = BusinessHour()
        self.offset2 = BusinessHour(n=3)


            

Reported by Pylint.

Attribute 'offset1' defined outside __init__
Error

Line: 38 Column: 9

                  def setup_method(self, method):
        self.d = datetime(2014, 7, 1, 10, 00)

        self.offset1 = BusinessHour()
        self.offset2 = BusinessHour(n=3)

        self.offset3 = BusinessHour(n=-1)
        self.offset4 = BusinessHour(n=-4)


            

Reported by Pylint.

Attribute 'offset2' defined outside __init__
Error

Line: 39 Column: 9

                      self.d = datetime(2014, 7, 1, 10, 00)

        self.offset1 = BusinessHour()
        self.offset2 = BusinessHour(n=3)

        self.offset3 = BusinessHour(n=-1)
        self.offset4 = BusinessHour(n=-4)

        from datetime import time as dt_time

            

Reported by Pylint.

Attribute 'offset3' defined outside __init__
Error

Line: 41 Column: 9

                      self.offset1 = BusinessHour()
        self.offset2 = BusinessHour(n=3)

        self.offset3 = BusinessHour(n=-1)
        self.offset4 = BusinessHour(n=-4)

        from datetime import time as dt_time

        self.offset5 = BusinessHour(start=dt_time(11, 0), end=dt_time(14, 30))

            

Reported by Pylint.

Attribute 'offset4' defined outside __init__
Error

Line: 42 Column: 9

                      self.offset2 = BusinessHour(n=3)

        self.offset3 = BusinessHour(n=-1)
        self.offset4 = BusinessHour(n=-4)

        from datetime import time as dt_time

        self.offset5 = BusinessHour(start=dt_time(11, 0), end=dt_time(14, 30))
        self.offset6 = BusinessHour(start="20:00", end="05:00")

            

Reported by Pylint.

Redefining name 'dt_time' from outer scope (line 4)
Error

Line: 44 Column: 9

                      self.offset3 = BusinessHour(n=-1)
        self.offset4 = BusinessHour(n=-4)

        from datetime import time as dt_time

        self.offset5 = BusinessHour(start=dt_time(11, 0), end=dt_time(14, 30))
        self.offset6 = BusinessHour(start="20:00", end="05:00")
        self.offset7 = BusinessHour(n=-2, start=dt_time(21, 30), end=dt_time(6, 30))
        self.offset8 = BusinessHour(start=["09:00", "13:00"], end=["12:00", "17:00"])

            

Reported by Pylint.

Reimport 'time' (imported line 4)
Error

Line: 44 Column: 9

                      self.offset3 = BusinessHour(n=-1)
        self.offset4 = BusinessHour(n=-4)

        from datetime import time as dt_time

        self.offset5 = BusinessHour(start=dt_time(11, 0), end=dt_time(14, 30))
        self.offset6 = BusinessHour(start="20:00", end="05:00")
        self.offset7 = BusinessHour(n=-2, start=dt_time(21, 30), end=dt_time(6, 30))
        self.offset8 = BusinessHour(start=["09:00", "13:00"], end=["12:00", "17:00"])

            

Reported by Pylint.

pandas/tests/indexing/test_partial.py
151 issues
Unable to import 'pytest'
Error

Line: 8 Column: 1

              """

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 'Index' has no 'freq' member
Error

Line: 132 Column: 62

                      )

        expected = pd.concat(
            [df_orig, DataFrame({"A": 7}, index=dates[-1:] + dates.freq)], sort=True
        )
        df = df_orig.copy()
        df.loc[dates[-1] + dates.freq, "A"] = 7
        tm.assert_frame_equal(df, expected)
        df = df_orig.copy()

            

Reported by Pylint.

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

Line: 132 Column: 62

                      )

        expected = pd.concat(
            [df_orig, DataFrame({"A": 7}, index=dates[-1:] + dates.freq)], sort=True
        )
        df = df_orig.copy()
        df.loc[dates[-1] + dates.freq, "A"] = 7
        tm.assert_frame_equal(df, expected)
        df = df_orig.copy()

            

Reported by Pylint.

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

Line: 135 Column: 28

                          [df_orig, DataFrame({"A": 7}, index=dates[-1:] + dates.freq)], sort=True
        )
        df = df_orig.copy()
        df.loc[dates[-1] + dates.freq, "A"] = 7
        tm.assert_frame_equal(df, expected)
        df = df_orig.copy()
        df.at[dates[-1] + dates.freq, "A"] = 7
        tm.assert_frame_equal(df, expected)


            

Reported by Pylint.

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

Line: 135 Column: 28

                          [df_orig, DataFrame({"A": 7}, index=dates[-1:] + dates.freq)], sort=True
        )
        df = df_orig.copy()
        df.loc[dates[-1] + dates.freq, "A"] = 7
        tm.assert_frame_equal(df, expected)
        df = df_orig.copy()
        df.at[dates[-1] + dates.freq, "A"] = 7
        tm.assert_frame_equal(df, expected)


            

Reported by Pylint.

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

Line: 138 Column: 27

                      df.loc[dates[-1] + dates.freq, "A"] = 7
        tm.assert_frame_equal(df, expected)
        df = df_orig.copy()
        df.at[dates[-1] + dates.freq, "A"] = 7
        tm.assert_frame_equal(df, expected)

        exp_other = DataFrame({0: 7}, index=dates[-1:] + dates.freq)
        expected = pd.concat([df_orig, exp_other], axis=1)


            

Reported by Pylint.

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

Line: 138 Column: 27

                      df.loc[dates[-1] + dates.freq, "A"] = 7
        tm.assert_frame_equal(df, expected)
        df = df_orig.copy()
        df.at[dates[-1] + dates.freq, "A"] = 7
        tm.assert_frame_equal(df, expected)

        exp_other = DataFrame({0: 7}, index=dates[-1:] + dates.freq)
        expected = pd.concat([df_orig, exp_other], axis=1)


            

Reported by Pylint.

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

Line: 141 Column: 58

                      df.at[dates[-1] + dates.freq, "A"] = 7
        tm.assert_frame_equal(df, expected)

        exp_other = DataFrame({0: 7}, index=dates[-1:] + dates.freq)
        expected = pd.concat([df_orig, exp_other], axis=1)

        df = df_orig.copy()
        df.loc[dates[-1] + dates.freq, 0] = 7
        tm.assert_frame_equal(df, expected)

            

Reported by Pylint.

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

Line: 141 Column: 58

                      df.at[dates[-1] + dates.freq, "A"] = 7
        tm.assert_frame_equal(df, expected)

        exp_other = DataFrame({0: 7}, index=dates[-1:] + dates.freq)
        expected = pd.concat([df_orig, exp_other], axis=1)

        df = df_orig.copy()
        df.loc[dates[-1] + dates.freq, 0] = 7
        tm.assert_frame_equal(df, expected)

            

Reported by Pylint.

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

Line: 145 Column: 28

                      expected = pd.concat([df_orig, exp_other], axis=1)

        df = df_orig.copy()
        df.loc[dates[-1] + dates.freq, 0] = 7
        tm.assert_frame_equal(df, expected)
        df = df_orig.copy()
        df.at[dates[-1] + dates.freq, 0] = 7
        tm.assert_frame_equal(df, expected)


            

Reported by Pylint.

pandas/tests/plotting/test_converter.py
151 issues
Unable to import 'pytest'
Error

Line: 9 Column: 1

              import sys

import numpy as np
import pytest

import pandas._config.config as cf

from pandas.compat import (
    is_platform_windows,

            

Reported by Pylint.

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

Line: 228 Column: 31

                      rs = self.dtc.convert(Index([ts - Day(1), ts]), None, None)
        assert rs[1] == xp

        rs = self.dtc.convert(Index([ts - Day(1), ts]).to_pydatetime(), None, None)
        assert rs[1] == xp

    def test_conversion_float(self):
        rtol = 0.5 * 10 ** -9


            

Reported by Pylint.

Redefining name 'dates' from outer scope (line 47)
Error

Line: 144 Column: 9

              
    def test_registry_resets(self):
        units = pytest.importorskip("matplotlib.units")
        dates = pytest.importorskip("matplotlib.dates")

        # make a copy, to reset to
        original = dict(units.registry)

        try:

            

Reported by Pylint.

Unused argument 'method'
Error

Line: 169 Column: 28

              

class TestDateTimeConverter:
    def setup_method(self, method):
        self.dtc = converter.DatetimeConverter()
        self.tc = converter.TimeFormatter(None)

    def test_convert_accepts_unicode(self):
        r1 = self.dtc.convert("12:22", None, None)

            

Reported by Pylint.

Attribute 'dtc' defined outside __init__
Error

Line: 170 Column: 9

              
class TestDateTimeConverter:
    def setup_method(self, method):
        self.dtc = converter.DatetimeConverter()
        self.tc = converter.TimeFormatter(None)

    def test_convert_accepts_unicode(self):
        r1 = self.dtc.convert("12:22", None, None)
        r2 = self.dtc.convert("12:22", None, None)

            

Reported by Pylint.

Attribute 'tc' defined outside __init__
Error

Line: 171 Column: 9

              class TestDateTimeConverter:
    def setup_method(self, method):
        self.dtc = converter.DatetimeConverter()
        self.tc = converter.TimeFormatter(None)

    def test_convert_accepts_unicode(self):
        r1 = self.dtc.convert("12:22", None, None)
        r2 = self.dtc.convert("12:22", None, None)
        assert r1 == r2, "DatetimeConverter.convert should accept unicode"

            

Reported by Pylint.

Access to a protected member _mpl_repr of a client class
Error

Line: 285 Column: 43

                      for freq in ("B", "L", "S"):
            dateindex = tm.makeDateIndex(k=10, freq=freq)
            rs = self.dtc.convert(dateindex, None, None)
            xp = converter.dates.date2num(dateindex._mpl_repr())
            tm.assert_almost_equal(rs, xp, rtol=rtol)

    def test_resolution(self):
        def _assert_less(ts1, ts2):
            val1 = self.dtc.convert(ts1, None, None)

            

Reported by Pylint.

Unused argument 'method'
Error

Line: 311 Column: 28

              

class TestPeriodConverter:
    def setup_method(self, method):
        self.pc = converter.PeriodConverter()

        class Axis:
            pass


            

Reported by Pylint.

Attribute 'pc' defined outside __init__
Error

Line: 312 Column: 9

              
class TestPeriodConverter:
    def setup_method(self, method):
        self.pc = converter.PeriodConverter()

        class Axis:
            pass

        self.axis = Axis()

            

Reported by Pylint.

Attribute 'axis' defined outside __init__
Error

Line: 317 Column: 9

                      class Axis:
            pass

        self.axis = Axis()
        self.axis.freq = "D"

    def test_convert_accepts_unicode(self):
        r1 = self.pc.convert("2012-1-1", None, self.axis)
        r2 = self.pc.convert("2012-1-1", None, self.axis)

            

Reported by Pylint.

pandas/core/reshape/merge.py
151 issues
No name 'lib' in module 'pandas._libs'
Error

Line: 20 Column: 1

              
import numpy as np

from pandas._libs import (
    Timedelta,
    hashtable as libhashtable,
    join as libjoin,
    lib,
)

            

Reported by Pylint.

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

Line: 20 Column: 1

              
import numpy as np

from pandas._libs import (
    Timedelta,
    hashtable as libhashtable,
    join as libjoin,
    lib,
)

            

Reported by Pylint.

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

Line: 20 Column: 1

              
import numpy as np

from pandas._libs import (
    Timedelta,
    hashtable as libhashtable,
    join as libjoin,
    lib,
)

            

Reported by Pylint.

Module 'numpy.typing' has no 'NDArray' member
Error

Line: 1007 Column: 18

                      self,
        index: Index,
        other_index: Index,
        indexer: npt.NDArray[np.intp],
        how: str = "left",
    ) -> Index:
        """
        Create a join index by rearranging one index to match another


            

Reported by Pylint.

Module 'numpy.typing' has no 'NDArray' member
Error

Line: 1452 Column: 12

              
def get_join_indexers(
    left_keys, right_keys, sort: bool = False, how: str = "inner", **kwargs
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]:
    """

    Parameters
    ----------
    left_keys : ndarray, Index, Series

            

Reported by Pylint.

Module 'numpy.typing' has no 'NDArray' member
Error

Line: 1452 Column: 34

              
def get_join_indexers(
    left_keys, right_keys, sort: bool = False, how: str = "inner", **kwargs
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]:
    """

    Parameters
    ----------
    left_keys : ndarray, Index, Series

            

Reported by Pylint.

Module 'numpy.typing' has no 'NDArray' member
Error

Line: 1511 Column: 15

                  right: MultiIndex,
    dropped_level_names,
    join_index: Index,
    lindexer: npt.NDArray[np.intp],
    rindexer: npt.NDArray[np.intp],
) -> tuple[list[Index], npt.NDArray[np.intp], list[Hashable]]:
    """
    *this is an internal non-public method*


            

Reported by Pylint.

Module 'numpy.typing' has no 'NDArray' member
Error

Line: 1512 Column: 15

                  dropped_level_names,
    join_index: Index,
    lindexer: npt.NDArray[np.intp],
    rindexer: npt.NDArray[np.intp],
) -> tuple[list[Index], npt.NDArray[np.intp], list[Hashable]]:
    """
    *this is an internal non-public method*

    Returns the levels, labels and names of a multi-index to multi-index join.

            

Reported by Pylint.

Module 'numpy.typing' has no 'NDArray' member
Error

Line: 1513 Column: 25

                  join_index: Index,
    lindexer: npt.NDArray[np.intp],
    rindexer: npt.NDArray[np.intp],
) -> tuple[list[Index], npt.NDArray[np.intp], list[Hashable]]:
    """
    *this is an internal non-public method*

    Returns the levels, labels and names of a multi-index to multi-index join.
    Depending on the type of join, this method restores the appropriate

            

Reported by Pylint.

Module 'numpy.typing' has no 'NDArray' member
Error

Line: 2069 Column: 34

              
def _factorize_keys(
    lk: ArrayLike, rk: ArrayLike, sort: bool = True, how: str = "inner"
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp], int]:
    """
    Encode left and right keys as enumerated types.

    This is used to get the join indexers to be used when merging DataFrames.


            

Reported by Pylint.

pandas/tests/reshape/merge/test_join.py
150 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

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

            

Reported by Pylint.

Unused argument 'method'
Error

Line: 26 Column: 28

              

class TestJoin:
    def setup_method(self, method):
        # aggregate multiple columns
        self.df = DataFrame(
            {
                "key1": get_test_data(),
                "key2": get_test_data(),

            

Reported by Pylint.

Attribute 'df' defined outside __init__
Error

Line: 28 Column: 9

              class TestJoin:
    def setup_method(self, method):
        # aggregate multiple columns
        self.df = DataFrame(
            {
                "key1": get_test_data(),
                "key2": get_test_data(),
                "data1": np.random.randn(N),
                "data2": np.random.randn(N),

            

Reported by Pylint.

Attribute 'df' defined outside __init__
Error

Line: 38 Column: 9

                      )

        # exclude a couple keys for fun
        self.df = self.df[self.df["key2"] > 1]

        self.df2 = DataFrame(
            {
                "key1": get_test_data(n=N // 5),
                "key2": get_test_data(ngroups=NGROUPS // 2, n=N // 5),

            

Reported by Pylint.

Attribute 'df2' defined outside __init__
Error

Line: 40 Column: 9

                      # exclude a couple keys for fun
        self.df = self.df[self.df["key2"] > 1]

        self.df2 = DataFrame(
            {
                "key1": get_test_data(n=N // 5),
                "key2": get_test_data(ngroups=NGROUPS // 2, n=N // 5),
                "value": np.random.randn(N // 5),
            }

            

Reported by Pylint.

Attribute 'target' defined outside __init__
Error

Line: 49 Column: 9

                      )

        index, data = tm.getMixedTypeDict()
        self.target = DataFrame(data, index=index)

        # Join on string value
        self.source = DataFrame(
            {"MergedA": data["A"], "MergedD": data["D"]}, index=data["C"]
        )

            

Reported by Pylint.

Attribute 'source' defined outside __init__
Error

Line: 52 Column: 9

                      self.target = DataFrame(data, index=index)

        # Join on string value
        self.source = DataFrame(
            {"MergedA": data["A"], "MergedD": data["D"]}, index=data["C"]
        )

    def test_left_outer_join(self):
        joined_key2 = merge(self.df, self.df2, on="key2")

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest

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

            

Reported by Pylint.

Too many public methods (37/20)
Error

Line: 25 Column: 1

              a_ = np.array


class TestJoin:
    def setup_method(self, method):
        # aggregate multiple columns
        self.df = DataFrame(
            {
                "key1": get_test_data(),

            

Reported by Pylint.

Missing class docstring
Error

Line: 25 Column: 1

              a_ = np.array


class TestJoin:
    def setup_method(self, method):
        # aggregate multiple columns
        self.df = DataFrame(
            {
                "key1": get_test_data(),

            

Reported by Pylint.

pandas/tests/indexes/datetimes/test_misc.py
149 issues
Unable to import 'pytest'
Error

Line: 7 Column: 1

              import unicodedata

import numpy as np
import pytest

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

            

Reported by Pylint.

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

Line: 253 Column: 20

                  def test_datetimeindex_accessors2(self):
        dti = date_range(freq="BQ-FEB", start=datetime(1998, 1, 1), periods=4)

        assert sum(dti.is_quarter_start) == 0
        assert sum(dti.is_quarter_end) == 4
        assert sum(dti.is_year_start) == 0
        assert sum(dti.is_year_end) == 1

    def test_datetimeindex_accessors3(self):

            

Reported by Pylint.

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

Line: 253 Column: 20

                  def test_datetimeindex_accessors2(self):
        dti = date_range(freq="BQ-FEB", start=datetime(1998, 1, 1), periods=4)

        assert sum(dti.is_quarter_start) == 0
        assert sum(dti.is_quarter_end) == 4
        assert sum(dti.is_year_start) == 0
        assert sum(dti.is_year_end) == 1

    def test_datetimeindex_accessors3(self):

            

Reported by Pylint.

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

Line: 254 Column: 20

                      dti = date_range(freq="BQ-FEB", start=datetime(1998, 1, 1), periods=4)

        assert sum(dti.is_quarter_start) == 0
        assert sum(dti.is_quarter_end) == 4
        assert sum(dti.is_year_start) == 0
        assert sum(dti.is_year_end) == 1

    def test_datetimeindex_accessors3(self):
        # Ensure is_start/end accessors throw ValueError for CustomBusinessDay,

            

Reported by Pylint.

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

Line: 254 Column: 20

                      dti = date_range(freq="BQ-FEB", start=datetime(1998, 1, 1), periods=4)

        assert sum(dti.is_quarter_start) == 0
        assert sum(dti.is_quarter_end) == 4
        assert sum(dti.is_year_start) == 0
        assert sum(dti.is_year_end) == 1

    def test_datetimeindex_accessors3(self):
        # Ensure is_start/end accessors throw ValueError for CustomBusinessDay,

            

Reported by Pylint.

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

Line: 255 Column: 20

              
        assert sum(dti.is_quarter_start) == 0
        assert sum(dti.is_quarter_end) == 4
        assert sum(dti.is_year_start) == 0
        assert sum(dti.is_year_end) == 1

    def test_datetimeindex_accessors3(self):
        # Ensure is_start/end accessors throw ValueError for CustomBusinessDay,
        bday_egypt = offsets.CustomBusinessDay(weekmask="Sun Mon Tue Wed Thu")

            

Reported by Pylint.

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

Line: 255 Column: 20

              
        assert sum(dti.is_quarter_start) == 0
        assert sum(dti.is_quarter_end) == 4
        assert sum(dti.is_year_start) == 0
        assert sum(dti.is_year_end) == 1

    def test_datetimeindex_accessors3(self):
        # Ensure is_start/end accessors throw ValueError for CustomBusinessDay,
        bday_egypt = offsets.CustomBusinessDay(weekmask="Sun Mon Tue Wed Thu")

            

Reported by Pylint.

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

Line: 256 Column: 20

                      assert sum(dti.is_quarter_start) == 0
        assert sum(dti.is_quarter_end) == 4
        assert sum(dti.is_year_start) == 0
        assert sum(dti.is_year_end) == 1

    def test_datetimeindex_accessors3(self):
        # Ensure is_start/end accessors throw ValueError for CustomBusinessDay,
        bday_egypt = offsets.CustomBusinessDay(weekmask="Sun Mon Tue Wed Thu")
        dti = date_range(datetime(2013, 4, 30), periods=5, freq=bday_egypt)

            

Reported by Pylint.

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

Line: 256 Column: 20

                      assert sum(dti.is_quarter_start) == 0
        assert sum(dti.is_quarter_end) == 4
        assert sum(dti.is_year_start) == 0
        assert sum(dti.is_year_end) == 1

    def test_datetimeindex_accessors3(self):
        # Ensure is_start/end accessors throw ValueError for CustomBusinessDay,
        bday_egypt = offsets.CustomBusinessDay(weekmask="Sun Mon Tue Wed Thu")
        dti = date_range(datetime(2013, 4, 30), periods=5, freq=bday_egypt)

            

Reported by Pylint.

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

Line: 264 Column: 13

                      dti = date_range(datetime(2013, 4, 30), periods=5, freq=bday_egypt)
        msg = "Custom business days is not supported by is_month_start"
        with pytest.raises(ValueError, match=msg):
            dti.is_month_start

    def test_datetimeindex_accessors4(self):
        dti = DatetimeIndex(["2000-01-01", "2000-01-02", "2000-01-03"])

        assert dti.is_month_start[0] == 1

            

Reported by Pylint.

pandas/core/series.py
148 issues
No name 'lib' in module 'pandas._libs'
Error

Line: 29 Column: 1

              
from pandas._config import get_option

from pandas._libs import (
    lib,
    properties,
    reshape,
    tslibs,
)

            

Reported by Pylint.

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

Line: 29 Column: 1

              
from pandas._config import get_option

from pandas._libs import (
    lib,
    properties,
    reshape,
    tslibs,
)

            

Reported by Pylint.

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

Line: 29 Column: 1

              
from pandas._config import get_option

from pandas._libs import (
    lib,
    properties,
    reshape,
    tslibs,
)

            

Reported by Pylint.

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

Line: 35 Column: 1

                  reshape,
    tslibs,
)
from pandas._libs.lib import no_default
from pandas._typing import (
    AggFuncType,
    ArrayLike,
    Axis,
    Dtype,

            

Reported by Pylint.

Unable to import 'pandas._libs.lib'
Error

Line: 35 Column: 1

                  reshape,
    tslibs,
)
from pandas._libs.lib import no_default
from pandas._typing import (
    AggFuncType,
    ArrayLike,
    Axis,
    Dtype,

            

Reported by Pylint.

Method 'hasnans' has no 'func' member
Error

Line: 302 Column: 9

                  # error: Incompatible types in assignment (expression has type "property",
    # base class "IndexOpsMixin" defined the type as "Callable[[IndexOpsMixin], bool]")
    hasnans = property(  # type: ignore[assignment]
        base.IndexOpsMixin.hasnans.func, doc=base.IndexOpsMixin.hasnans.__doc__
    )
    _mgr: SingleManager
    div: Callable[[Series, Any], Series]
    rdiv: Callable[[Series, Any], Series]


            

Reported by Pylint.

Function 'array' has no '__doc__' member
Error

Line: 702 Column: 15

                      return self._mgr.internal_values()

    # error: Decorated property not supported
    @Appender(base.IndexOpsMixin.array.__doc__)  # type: ignore[misc]
    @property
    def array(self) -> ExtensionArray:
        return self._mgr.array_values()

    # ops

            

Reported by Pylint.

bad operand type for unary ~: slice
Error

Line: 1091 Column: 33

                              key = check_bool_indexer(self.index, key)
                key = np.asarray(key, dtype=bool)
                try:
                    self._where(~key, value, inplace=True)
                except InvalidIndexError:
                    self.iloc[key] = value
                return

            else:

            

Reported by Pylint.

Module 'numpy.typing' has no 'NDArray' member
Error

Line: 4386 Column: 49

                              return op(delegate, skipna=skipna, **kwds)

    def _reindex_indexer(
        self, new_index: Index | None, indexer: npt.NDArray[np.intp] | None, copy: bool
    ) -> Series:
        # Note: new_index is None iff indexer is None
        # if not None, indexer is np.intp
        if indexer is None:
            if copy:

            

Reported by Pylint.

TODO: passing np.float64 to not break anything yet. See GH-17261
Error

Line: 485 Column: 3

              
        # Input is now list-like, so rely on "standard" construction:

        # TODO: passing np.float64 to not break anything yet. See GH-17261
        s = create_series_with_explicit_dtype(
            # error: Argument "index" to "create_series_with_explicit_dtype" has
            # incompatible type "Tuple[Any, ...]"; expected "Union[ExtensionArray,
            # ndarray, Index, None]"
            values,

            

Reported by Pylint.

pandas/tests/plotting/test_misc.py
148 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              """ Test cases for misc plot functions """

import numpy as np
import pytest

import pandas.util._test_decorators as td

from pandas import (
    DataFrame,

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 111 Column: 21

              
        ax = None
        if pass_axis:
            _, ax = self.plt.subplots(3, 3)

        with tm.RNGContext(42):
            df = DataFrame(np.random.randn(100, 3))

        # we are plotting multiples on a sub-plot

            

Reported by Pylint.

Module 'matplotlib.cm' has no 'jet' member
Error

Line: 177 Column: 69

                      )

        ax = _check_plot_works(
            andrews_curves, frame=df, class_column="Name", colormap=cm.jet
        )
        cmaps = [cm.jet(n) for n in np.linspace(0, 1, df["Name"].nunique())]
        self._check_colors(
            ax.get_lines()[:10], linecolors=cmaps, mapping=df["Name"][:10]
        )

            

Reported by Pylint.

Module 'matplotlib.cm' has no 'jet' member
Error

Line: 179 Column: 18

                      ax = _check_plot_works(
            andrews_curves, frame=df, class_column="Name", colormap=cm.jet
        )
        cmaps = [cm.jet(n) for n in np.linspace(0, 1, df["Name"].nunique())]
        self._check_colors(
            ax.get_lines()[:10], linecolors=cmaps, mapping=df["Name"][:10]
        )

        length = 10

            

Reported by Pylint.

Module 'matplotlib.cm' has no 'jet' member
Error

Line: 213 Column: 69

                      )

        ax = _check_plot_works(
            andrews_curves, frame=df, class_column="Name", colormap=cm.jet
        )
        cmaps = [cm.jet(n) for n in np.linspace(0, 1, df["Name"].nunique())]
        self._check_colors(
            ax.get_lines()[:10], linecolors=cmaps, mapping=df["Name"][:10]
        )

            

Reported by Pylint.

Module 'matplotlib.cm' has no 'jet' member
Error

Line: 215 Column: 18

                      ax = _check_plot_works(
            andrews_curves, frame=df, class_column="Name", colormap=cm.jet
        )
        cmaps = [cm.jet(n) for n in np.linspace(0, 1, df["Name"].nunique())]
        self._check_colors(
            ax.get_lines()[:10], linecolors=cmaps, mapping=df["Name"][:10]
        )

        colors = ["b", "g", "r"]

            

Reported by Pylint.

Module 'matplotlib.cm' has no 'jet' member
Error

Line: 254 Column: 75

                      )

        ax = _check_plot_works(
            parallel_coordinates, frame=df, class_column="Name", colormap=cm.jet
        )
        cmaps = [cm.jet(n) for n in np.linspace(0, 1, df["Name"].nunique())]
        self._check_colors(
            ax.get_lines()[:10], linecolors=cmaps, mapping=df["Name"][:10]
        )

            

Reported by Pylint.

Module 'matplotlib.cm' has no 'jet' member
Error

Line: 256 Column: 18

                      ax = _check_plot_works(
            parallel_coordinates, frame=df, class_column="Name", colormap=cm.jet
        )
        cmaps = [cm.jet(n) for n in np.linspace(0, 1, df["Name"].nunique())]
        self._check_colors(
            ax.get_lines()[:10], linecolors=cmaps, mapping=df["Name"][:10]
        )

        ax = _check_plot_works(

            

Reported by Pylint.

Module 'matplotlib.cm' has no 'jet' member
Error

Line: 320 Column: 75

                      patches = [p for p in ax.patches[:20] if p.get_label() != ""]
        self._check_colors(patches, facecolors=cnames, mapping=df["Name"][:10])

        _check_plot_works(radviz, frame=df, class_column="Name", colormap=cm.jet)
        cmaps = [cm.jet(n) for n in np.linspace(0, 1, df["Name"].nunique())]
        patches = [p for p in ax.patches[:20] if p.get_label() != ""]
        self._check_colors(patches, facecolors=cmaps, mapping=df["Name"][:10])

        colors = [[0.0, 0.0, 1.0, 1.0], [0.0, 0.5, 1.0, 1.0], [1.0, 0.0, 0.0, 1.0]]

            

Reported by Pylint.

Module 'matplotlib.cm' has no 'jet' member
Error

Line: 321 Column: 18

                      self._check_colors(patches, facecolors=cnames, mapping=df["Name"][:10])

        _check_plot_works(radviz, frame=df, class_column="Name", colormap=cm.jet)
        cmaps = [cm.jet(n) for n in np.linspace(0, 1, df["Name"].nunique())]
        patches = [p for p in ax.patches[:20] if p.get_label() != ""]
        self._check_colors(patches, facecolors=cmaps, mapping=df["Name"][:10])

        colors = [[0.0, 0.0, 1.0, 1.0], [0.0, 0.5, 1.0, 1.0], [1.0, 0.0, 0.0, 1.0]]
        df = DataFrame(

            

Reported by Pylint.

pandas/tests/extension/base/methods.py
147 issues
Unable to import 'pytest'
Error

Line: 5 Column: 1

              import operator

import numpy as np
import pytest

from pandas.core.dtypes.common import is_bool_dtype

import pandas as pd
import pandas._testing as tm

            

Reported by Pylint.

Unused argument 'na_value'
Error

Line: 90 Column: 78

                      expected = pd.Series(np.array([1, -1, 0], dtype=np.int64))
        self.assert_series_equal(result, expected)

    def test_argmin_argmax(self, data_for_sorting, data_missing_for_sorting, na_value):
        # GH 24382

        # data_for_sorting -> [B, C, A] with A < B < C
        assert data_for_sorting.argmax() == 1
        assert data_for_sorting.argmin() == 2

            

Reported by Pylint.

Access to a protected member _from_sequence of a client class
Error

Line: 118 Column: 19

                  def test_argmin_argmax_all_na(self, method, data, na_value):
        # all missing with skipna=True is the same as empty
        err_msg = "attempt to get"
        data_na = type(data)._from_sequence([na_value, na_value], dtype=data.dtype)
        with pytest.raises(ValueError, match=err_msg):
            getattr(data_na, method)()

    @pytest.mark.parametrize(
        "op_name, skipna, expected",

            

Reported by Pylint.

Unused argument 'ascending'
Error

Line: 192 Column: 56

                      self.assert_series_equal(result, expected)

    @pytest.mark.parametrize("ascending", [True, False])
    def test_sort_values_frame(self, data_for_sorting, ascending):
        df = pd.DataFrame({"A": [1, 2, 1], "B": data_for_sorting})
        result = df.sort_values(["A", "B"])
        expected = pd.DataFrame(
            {"A": [1, 1, 2], "B": data_for_sorting.take([2, 0, 1])}, index=[2, 0, 1]
        )

            

Reported by Pylint.

Access to a protected member _from_sequence of a client class
Error

Line: 203 Column: 26

                  @pytest.mark.parametrize("box", [pd.Series, lambda x: x])
    @pytest.mark.parametrize("method", [lambda x: x.unique(), pd.unique])
    def test_unique(self, data, box, method):
        duplicated = box(data._from_sequence([data[0], data[0]]))

        result = method(duplicated)

        assert len(result) == 1
        assert isinstance(result, type(data))

            

Reported by Pylint.

Access to a protected member _from_sequence of a client class
Error

Line: 235 Column: 28

                  def test_factorize_empty(self, data):
        codes, uniques = pd.factorize(data[:0])
        expected_codes = np.array([], dtype=np.intp)
        expected_uniques = type(data)._from_sequence([], dtype=data[:0].dtype)

        tm.assert_numpy_array_equal(codes, expected_codes)
        self.assert_extension_array_equal(uniques, expected_uniques)

    def test_fillna_copy_frame(self, data_missing):

            

Reported by Pylint.

Access to a protected member _values of a client class
Error

Line: 256 Column: 16

                      filled_val = ser[0]
        result = ser.fillna(filled_val)

        assert ser._values is not result._values
        assert ser._values is arr

    def test_fillna_length_mismatch(self, data_missing):
        msg = "Length of 'value' does not match."
        with pytest.raises(ValueError, match=msg):

            

Reported by Pylint.

Access to a protected member _values of a client class
Error

Line: 256 Column: 35

                      filled_val = ser[0]
        result = ser.fillna(filled_val)

        assert ser._values is not result._values
        assert ser._values is arr

    def test_fillna_length_mismatch(self, data_missing):
        msg = "Length of 'value' does not match."
        with pytest.raises(ValueError, match=msg):

            

Reported by Pylint.

Access to a protected member _values of a client class
Error

Line: 257 Column: 16

                      result = ser.fillna(filled_val)

        assert ser._values is not result._values
        assert ser._values is arr

    def test_fillna_length_mismatch(self, data_missing):
        msg = "Length of 'value' does not match."
        with pytest.raises(ValueError, match=msg):
            data_missing.fillna(data_missing.take([1]))

            

Reported by Pylint.

Access to a protected member _from_sequence of a client class
Error

Line: 289 Column: 17

                      result = s1.combine(s2, lambda x1, x2: x1 + x2)
        with np.errstate(over="ignore"):
            expected = pd.Series(
                orig_data1._from_sequence(
                    [a + b for (a, b) in zip(list(orig_data1), list(orig_data2))]
                )
            )
        self.assert_series_equal(result, expected)


            

Reported by Pylint.

pandas/tests/series/methods/test_replace.py
146 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              import re

import numpy as np
import pytest

import pandas as pd
import pandas._testing as tm



            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import re

import numpy as np
import pytest

import pandas as pd
import pandas._testing as tm



            

Reported by Pylint.

Too many public methods (30/20)
Error

Line: 10 Column: 1

              import pandas._testing as tm


class TestSeriesReplace:
    def test_replace(self, datetime_series):
        N = 100
        ser = pd.Series(np.random.randn(N))
        ser[0:4] = np.nan
        ser[6:10] = 0

            

Reported by Pylint.

Missing class docstring
Error

Line: 10 Column: 1

              import pandas._testing as tm


class TestSeriesReplace:
    def test_replace(self, datetime_series):
        N = 100
        ser = pd.Series(np.random.randn(N))
        ser[0:4] = np.nan
        ser[6:10] = 0

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 5

              

class TestSeriesReplace:
    def test_replace(self, datetime_series):
        N = 100
        ser = pd.Series(np.random.randn(N))
        ser[0:4] = np.nan
        ser[6:10] = 0


            

Reported by Pylint.

Method could be a function
Error

Line: 11 Column: 5

              

class TestSeriesReplace:
    def test_replace(self, datetime_series):
        N = 100
        ser = pd.Series(np.random.randn(N))
        ser[0:4] = np.nan
        ser[6:10] = 0


            

Reported by Pylint.

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

Line: 12 Column: 9

              
class TestSeriesReplace:
    def test_replace(self, datetime_series):
        N = 100
        ser = pd.Series(np.random.randn(N))
        ser[0:4] = np.nan
        ser[6:10] = 0

        # replace list with a single value

            

Reported by Pylint.

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

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

              
        # replace list with a single value
        return_value = ser.replace([np.nan], -1, inplace=True)
        assert return_value is None

        exp = ser.fillna(-1)
        tm.assert_series_equal(ser, exp)

        rs = ser.replace(0.0, np.nan)

            

Reported by Bandit.

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

Line: 24 Column: 9

                      exp = ser.fillna(-1)
        tm.assert_series_equal(ser, exp)

        rs = ser.replace(0.0, np.nan)
        ser[ser == 0.0] = np.nan
        tm.assert_series_equal(rs, ser)

        ser = pd.Series(np.fabs(np.random.randn(N)), tm.makeDateIndex(N), dtype=object)
        ser[:5] = np.nan

            

Reported by Pylint.

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

Line: 34 Column: 9

                      ser[20:30] = "bar"

        # replace list with a single value
        rs = ser.replace([np.nan, "foo", "bar"], -1)

        assert (rs[:5] == -1).all()
        assert (rs[6:10] == -1).all()
        assert (rs[20:30] == -1).all()
        assert (pd.isna(ser[:5])).all()

            

Reported by Pylint.