The following issues were found

pandas/tests/io/formats/test_format.py
1134 issues
Unable to import 'pytest'
Error

Line: 18 Column: 1

              
import dateutil
import numpy as np
import pytest
import pytz

from pandas.compat import (
    IS64,
    is_platform_windows,

            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 19 Column: 1

              import dateutil
import numpy as np
import pytest
import pytz

from pandas.compat import (
    IS64,
    is_platform_windows,
)

            

Reported by Pylint.

Redefining name 'filepath_or_buffer_id' from outer scope (line 51)
Error

Line: 59 Column: 24

              

@pytest.fixture
def filepath_or_buffer(filepath_or_buffer_id, tmp_path):
    """
    A fixture yielding a string representing a filepath, a path-like object
    and a StringIO buffer. Also checks that buffer is not closed.
    """
    if filepath_or_buffer_id == "buffer":

            

Reported by Pylint.

Redefining name 'filepath_or_buffer' from outer scope (line 59)
Error

Line: 78 Column: 5

              
@pytest.fixture
def assert_filepath_or_buffer_equals(
    filepath_or_buffer, filepath_or_buffer_id, encoding
):
    """
    Assertion helper for checking filepath_or_buffer.
    """


            

Reported by Pylint.

Redefining name 'filepath_or_buffer_id' from outer scope (line 51)
Error

Line: 78 Column: 25

              
@pytest.fixture
def assert_filepath_or_buffer_equals(
    filepath_or_buffer, filepath_or_buffer_id, encoding
):
    """
    Assertion helper for checking filepath_or_buffer.
    """


            

Reported by Pylint.

Unused variable 'l'
Error

Line: 131 Column: 13

                      return False
    # Make sure each row has this ... in the same place
    r = repr(df)
    for ix, l in enumerate(r.splitlines()):
        if not r.split()[cand_col] == "...":
            return False
    return True



            

Reported by Pylint.

Unused variable 'ix'
Error

Line: 131 Column: 9

                      return False
    # Make sure each row has this ... in the same place
    r = repr(df)
    for ix, l in enumerate(r.splitlines()):
        if not r.split()[cand_col] == "...":
            return False
    return True



            

Reported by Pylint.

FIXME: remove in future version after deprecation cycle
Error

Line: 242 Column: 3

                          assert "..." not in repr(df)

    def test_repr_deprecation_negative_int(self):
        # FIXME: remove in future version after deprecation cycle
        # Non-regression test for:
        # https://github.com/pandas-dev/pandas/issues/31532
        width = get_option("display.max_colwidth")
        with tm.assert_produces_warning(FutureWarning):
            set_option("display.max_colwidth", -1)

            

Reported by Pylint.

Use of possibly insecure function - consider using safer ast.literal_eval.
Security blacklist

Line: 313
Suggestion: https://bandit.readthedocs.io/en/latest/blacklists/blacklist_calls.html#b307-eval

                      # for the case of Index, where the repr is traditional rather than
        # stylized
        idx = Index(["a", "b"])
        res = eval("pd." + repr(idx))
        tm.assert_series_equal(Series(res), Series(idx))

    def test_repr_should_return_str(self):
        # https://docs.python.org/3/reference/datamodel.html#object.__repr__
        # "...The return value must be a string object."

            

Reported by Bandit.

Use of eval
Error

Line: 313 Column: 15

                      # for the case of Index, where the repr is traditional rather than
        # stylized
        idx = Index(["a", "b"])
        res = eval("pd." + repr(idx))
        tm.assert_series_equal(Series(res), Series(idx))

    def test_repr_should_return_str(self):
        # https://docs.python.org/3/reference/datamodel.html#object.__repr__
        # "...The return value must be a string object."

            

Reported by Pylint.

pandas/tests/frame/test_constructors.py
842 issues
Unable to import 'pytest'
Error

Line: 18 Column: 1

              import numpy as np
import numpy.ma as ma
import numpy.ma.mrecords as mrecords
import pytest
import pytz

from pandas.compat import np_version_under1p19
import pandas.util._test_decorators as td


            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 19 Column: 1

              import numpy.ma as ma
import numpy.ma.mrecords as mrecords
import pytest
import pytz

from pandas.compat import np_version_under1p19
import pandas.util._test_decorators as td

from pandas.core.dtypes.common import is_integer_dtype

            

Reported by Pylint.

The special method '__len__' expects 0 param(s), 1 was given
Error

Line: 1329 Column: 13

                          def __getitem__(self, n):
                return self._lst.__getitem__(n)

            def __len__(self, n):
                return self._lst.__len__()

        lst_containers = [DummyContainer([1, "a"]), DummyContainer([2, "b"])]
        columns = ["num", "str"]
        result = DataFrame(lst_containers, columns=columns)

            

Reported by Pylint.

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

Line: 2588 Column: 17

                      # after GH#7822
        # these retain the timezones on dict construction
        dr = date_range("2011/1/1", "2012/1/1", freq="W-FRI")
        dr_tz = dr.tz_localize(tz)
        df = DataFrame({"A": "foo", "B": dr_tz}, index=dr)
        tz_expected = DatetimeTZDtype("ns", dr_tz.tzinfo)
        assert df["B"].dtype == tz_expected

        # GH#2810 (with timezones)

            

Reported by Pylint.

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

Line: 2588 Column: 17

                      # after GH#7822
        # these retain the timezones on dict construction
        dr = date_range("2011/1/1", "2012/1/1", freq="W-FRI")
        dr_tz = dr.tz_localize(tz)
        df = DataFrame({"A": "foo", "B": dr_tz}, index=dr)
        tz_expected = DatetimeTZDtype("ns", dr_tz.tzinfo)
        assert df["B"].dtype == tz_expected

        # GH#2810 (with timezones)

            

Reported by Pylint.

Access to a protected member _mgr of a client class
Error

Line: 131 Column: 16

                          arr = arr[:, 0]

        obj = frame_or_series(arr, dtype=object)
        assert obj._mgr.arrays[0].dtype == object
        assert isinstance(obj._mgr.arrays[0].ravel()[0], scalar_type)

        # go through a different path in internals.construction
        obj = frame_or_series(frame_or_series(arr), dtype=object)
        assert obj._mgr.arrays[0].dtype == object

            

Reported by Pylint.

Access to a protected member _mgr of a client class
Error

Line: 132 Column: 27

              
        obj = frame_or_series(arr, dtype=object)
        assert obj._mgr.arrays[0].dtype == object
        assert isinstance(obj._mgr.arrays[0].ravel()[0], scalar_type)

        # go through a different path in internals.construction
        obj = frame_or_series(frame_or_series(arr), dtype=object)
        assert obj._mgr.arrays[0].dtype == object
        assert isinstance(obj._mgr.arrays[0].ravel()[0], scalar_type)

            

Reported by Pylint.

Access to a protected member _mgr of a client class
Error

Line: 136 Column: 16

              
        # go through a different path in internals.construction
        obj = frame_or_series(frame_or_series(arr), dtype=object)
        assert obj._mgr.arrays[0].dtype == object
        assert isinstance(obj._mgr.arrays[0].ravel()[0], scalar_type)

        obj = frame_or_series(frame_or_series(arr), dtype=PandasDtype(object))
        assert obj._mgr.arrays[0].dtype == object
        assert isinstance(obj._mgr.arrays[0].ravel()[0], scalar_type)

            

Reported by Pylint.

Access to a protected member _mgr of a client class
Error

Line: 137 Column: 27

                      # go through a different path in internals.construction
        obj = frame_or_series(frame_or_series(arr), dtype=object)
        assert obj._mgr.arrays[0].dtype == object
        assert isinstance(obj._mgr.arrays[0].ravel()[0], scalar_type)

        obj = frame_or_series(frame_or_series(arr), dtype=PandasDtype(object))
        assert obj._mgr.arrays[0].dtype == object
        assert isinstance(obj._mgr.arrays[0].ravel()[0], scalar_type)


            

Reported by Pylint.

Access to a protected member _mgr of a client class
Error

Line: 140 Column: 16

                      assert isinstance(obj._mgr.arrays[0].ravel()[0], scalar_type)

        obj = frame_or_series(frame_or_series(arr), dtype=PandasDtype(object))
        assert obj._mgr.arrays[0].dtype == object
        assert isinstance(obj._mgr.arrays[0].ravel()[0], scalar_type)

        if frame_or_series is DataFrame:
            # other paths through internals.construction
            sers = [Series(x) for x in arr]

            

Reported by Pylint.

pandas/tests/scalar/period/test_period.py
762 issues
Unable to import 'pytest'
Error

Line: 8 Column: 1

              )

import numpy as np
import pytest
import pytz

from pandas._libs.tslibs import (
    iNaT,
    period as libperiod,

            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 9 Column: 1

              
import numpy as np
import pytest
import pytz

from pandas._libs.tslibs import (
    iNaT,
    period as libperiod,
)

            

Reported by Pylint.

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

Line: 11 Column: 1

              import pytest
import pytz

from pandas._libs.tslibs import (
    iNaT,
    period as libperiod,
)
from pandas._libs.tslibs.ccalendar import (
    DAYS,

            

Reported by Pylint.

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

Line: 15 Column: 1

                  iNaT,
    period as libperiod,
)
from pandas._libs.tslibs.ccalendar import (
    DAYS,
    MONTHS,
)
from pandas._libs.tslibs.np_datetime import OutOfBoundsDatetime
from pandas._libs.tslibs.parsing import DateParseError

            

Reported by Pylint.

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

Line: 15 Column: 1

                  iNaT,
    period as libperiod,
)
from pandas._libs.tslibs.ccalendar import (
    DAYS,
    MONTHS,
)
from pandas._libs.tslibs.np_datetime import OutOfBoundsDatetime
from pandas._libs.tslibs.parsing import DateParseError

            

Reported by Pylint.

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

Line: 19 Column: 1

                  DAYS,
    MONTHS,
)
from pandas._libs.tslibs.np_datetime import OutOfBoundsDatetime
from pandas._libs.tslibs.parsing import DateParseError
from pandas._libs.tslibs.period import (
    INVALID_FREQ_ERR_MSG,
    IncompatibleFrequency,
)

            

Reported by Pylint.

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

Line: 19 Column: 1

                  DAYS,
    MONTHS,
)
from pandas._libs.tslibs.np_datetime import OutOfBoundsDatetime
from pandas._libs.tslibs.parsing import DateParseError
from pandas._libs.tslibs.period import (
    INVALID_FREQ_ERR_MSG,
    IncompatibleFrequency,
)

            

Reported by Pylint.

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

Line: 20 Column: 1

                  MONTHS,
)
from pandas._libs.tslibs.np_datetime import OutOfBoundsDatetime
from pandas._libs.tslibs.parsing import DateParseError
from pandas._libs.tslibs.period import (
    INVALID_FREQ_ERR_MSG,
    IncompatibleFrequency,
)
from pandas._libs.tslibs.timezones import (

            

Reported by Pylint.

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

Line: 20 Column: 1

                  MONTHS,
)
from pandas._libs.tslibs.np_datetime import OutOfBoundsDatetime
from pandas._libs.tslibs.parsing import DateParseError
from pandas._libs.tslibs.period import (
    INVALID_FREQ_ERR_MSG,
    IncompatibleFrequency,
)
from pandas._libs.tslibs.timezones import (

            

Reported by Pylint.

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

Line: 21 Column: 1

              )
from pandas._libs.tslibs.np_datetime import OutOfBoundsDatetime
from pandas._libs.tslibs.parsing import DateParseError
from pandas._libs.tslibs.period import (
    INVALID_FREQ_ERR_MSG,
    IncompatibleFrequency,
)
from pandas._libs.tslibs.timezones import (
    dateutil_gettz,

            

Reported by Pylint.

pandas/tests/plotting/test_datetimelike.py
679 issues
Unable to import 'pytest'
Error

Line: 12 Column: 1

              import sys

import numpy as np
import pytest

from pandas._libs.tslibs import (
    BaseOffset,
    to_offset,
)

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 87 Column: 19

                  def test_fontsize_set_correctly(self):
        # For issue #8765
        df = DataFrame(np.random.randn(10, 9), index=range(10))
        fig, ax = self.plt.subplots()
        df.plot(fontsize=2, ax=ax)
        for label in ax.get_xticklabels() + ax.get_yticklabels():
            assert label.get_fontsize() == 2

    def test_frame_inferred(self):

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 122 Column: 19

                      idx = date_range("1/1/1987", freq="A", periods=3)
        df = DataFrame({"A": ["x", "y", "z"], "B": [1, 2, 3]}, idx)

        fig, ax = self.plt.subplots()
        df.plot(ax=ax)  # it works
        assert len(ax.get_lines()) == 1  # B was plotted
        self.plt.close(fig)

        msg = "no numeric data to plot"

            

Reported by Pylint.

Method 'plt' has no 'close' member
Error

Line: 125 Column: 9

                      fig, ax = self.plt.subplots()
        df.plot(ax=ax)  # it works
        assert len(ax.get_lines()) == 1  # B was plotted
        self.plt.close(fig)

        msg = "no numeric data to plot"
        with pytest.raises(TypeError, match=msg):
            df["A"].plot()


            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 133 Column: 17

              
    def test_tsplot(self):

        _, ax = self.plt.subplots()
        ts = tm.makeTimeSeries()

        for s in self.period_ser:
            _check_plot_works(s.plot, ax=ax)


            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 142 Column: 17

                      for s in self.datetime_ser:
            _check_plot_works(s.plot, ax=ax)

        _, ax = self.plt.subplots()
        ts.plot(style="k", ax=ax)
        color = (0.0, 0.0, 0.0, 1)
        assert color == ax.get_lines()[0].get_color()

    def test_both_style_and_color(self):

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 165 Column: 21

                  def test_high_freq(self):
        freaks = ["ms", "us"]
        for freq in freaks:
            _, ax = self.plt.subplots()
            rng = date_range("1/1/2012", periods=100, freq=freq)
            ser = Series(np.random.randn(len(rng)), rng)
            _check_plot_works(ser.plot, ax=ax)

    def test_get_datevalue(self):

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 191 Column: 17

                              )

        annual = Series(1, index=date_range("2014-01-01", periods=3, freq="A-DEC"))
        _, ax = self.plt.subplots()
        annual.plot(ax=ax)
        check_format_of_first_point(ax, "t = 2014  y = 1.000000")

        # note this is added to the annual plot already in existence, and
        # changes its freq field

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 250 Column: 17

                          _check_plot_works(ser.plot)

    def test_fake_inferred_business(self):
        _, ax = self.plt.subplots()
        rng = date_range("2001-1-1", "2001-1-10")
        ts = Series(range(len(rng)), index=rng)
        ts = ts[:3].append(ts[5:])
        ts.plot(ax=ax)
        assert not hasattr(ax, "freq")

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 276 Column: 17

                      idx = date_range("2012-6-22 21:59:51.960928", freq="L", periods=500)
        df = DataFrame(np.random.randn(len(idx), 2), index=idx)

        _, ax = self.plt.subplots()
        df.plot(ax=ax)
        axis = ax.get_xaxis()

        tlocs = axis.get_ticklocs()
        tlabels = axis.get_ticklabels()

            

Reported by Pylint.

pandas/tests/io/test_sql.py
673 issues
Unable to import 'pytest'
Error

Line: 32 Column: 1

              import sqlite3

import numpy as np
import pytest

from pandas.core.dtypes.common import (
    is_datetime64_dtype,
    is_datetime64tz_dtype,
)

            

Reported by Pylint.

Instance of 'MixInBase' has no '_get_all_tables' member
Error

Line: 374 Column: 24

                  def teardown_method(self, method):
        # if setup fails, there may not be a connection to close.
        if hasattr(self, "conn"):
            for tbl in self._get_all_tables():
                self.drop_table(tbl)
            self._close_conn()


class MySQLMixIn(MixInBase):

            

Reported by Pylint.

Instance of 'MixInBase' has no 'drop_table' member
Error

Line: 375 Column: 17

                      # if setup fails, there may not be a connection to close.
        if hasattr(self, "conn"):
            for tbl in self._get_all_tables():
                self.drop_table(tbl)
            self._close_conn()


class MySQLMixIn(MixInBase):
    def drop_table(self, table_name):

            

Reported by Pylint.

Instance of 'MixInBase' has no '_close_conn' member
Error

Line: 376 Column: 13

                      if hasattr(self, "conn"):
            for tbl in self._get_all_tables():
                self.drop_table(tbl)
            self._close_conn()


class MySQLMixIn(MixInBase):
    def drop_table(self, table_name):
        cur = self.conn.cursor()

            

Reported by Pylint.

Module 'pandas.io.sql' has no '_get_valid_mysql_name' member
Error

Line: 382 Column: 45

              class MySQLMixIn(MixInBase):
    def drop_table(self, table_name):
        cur = self.conn.cursor()
        cur.execute(f"DROP TABLE IF EXISTS {sql._get_valid_mysql_name(table_name)}")
        self.conn.commit()

    def _get_all_tables(self):
        cur = self.conn.cursor()
        cur.execute("SHOW TABLES")

            

Reported by Pylint.

Unable to import 'pymysql.err'
Error

Line: 391 Column: 9

                      return [table[0] for table in cur.fetchall()]

    def _close_conn(self):
        from pymysql.err import Error

        try:
            self.conn.close()
        except Error:
            pass

            

Reported by Pylint.

Instance of 'PandasSQLTest' has no 'setup_connect' member
Error

Line: 437 Column: 13

                  @pytest.fixture
    def load_iris_data(self, iris_path):
        if not hasattr(self, "conn"):
            self.setup_connect()
        self.drop_table("iris")
        if isinstance(self.conn, sqlite3.Connection):
            create_and_load_iris_sqlite3(self.conn, iris_path)
        else:
            create_and_load_iris(self.conn, iris_path, self.flavor)

            

Reported by Pylint.

Instance of 'PandasSQLTest' has no 'drop_table' member
Error

Line: 438 Column: 9

                  def load_iris_data(self, iris_path):
        if not hasattr(self, "conn"):
            self.setup_connect()
        self.drop_table("iris")
        if isinstance(self.conn, sqlite3.Connection):
            create_and_load_iris_sqlite3(self.conn, iris_path)
        else:
            create_and_load_iris(self.conn, iris_path, self.flavor)


            

Reported by Pylint.

Instance of 'PandasSQLTest' has no 'conn' member
Error

Line: 439 Column: 23

                      if not hasattr(self, "conn"):
            self.setup_connect()
        self.drop_table("iris")
        if isinstance(self.conn, sqlite3.Connection):
            create_and_load_iris_sqlite3(self.conn, iris_path)
        else:
            create_and_load_iris(self.conn, iris_path, self.flavor)

    @pytest.fixture

            

Reported by Pylint.

Instance of 'PandasSQLTest' has no 'conn' member
Error

Line: 440 Column: 42

                          self.setup_connect()
        self.drop_table("iris")
        if isinstance(self.conn, sqlite3.Connection):
            create_and_load_iris_sqlite3(self.conn, iris_path)
        else:
            create_and_load_iris(self.conn, iris_path, self.flavor)

    @pytest.fixture
    def load_types_data(self, types_data):

            

Reported by Pylint.

pandas/tests/dtypes/test_inference.py
639 issues
Unable to import 'pytest'
Error

Line: 22 Column: 1

              import re

import numpy as np
import pytest
import pytz

from pandas._libs import (
    lib,
    missing as libmissing,

            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 23 Column: 1

              
import numpy as np
import pytest
import pytz

from pandas._libs import (
    lib,
    missing as libmissing,
    ops as libops,

            

Reported by Pylint.

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

Line: 25 Column: 1

              import pytest
import pytz

from pandas._libs import (
    lib,
    missing as libmissing,
    ops as libops,
)
import pandas.util._test_decorators as td

            

Reported by Pylint.

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

Line: 25 Column: 1

              import pytest
import pytz

from pandas._libs import (
    lib,
    missing as libmissing,
    ops as libops,
)
import pandas.util._test_decorators as td

            

Reported by Pylint.

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

Line: 25 Column: 1

              import pytest
import pytz

from pandas._libs import (
    lib,
    missing as libmissing,
    ops as libops,
)
import pandas.util._test_decorators as td

            

Reported by Pylint.

The special method '__getitem__' expects 1 param(s), 0 was given
Error

Line: 161 Column: 9

                  assert not is_seq(np.int64)

    class A:
        def __getitem__(self):
            return 1

    assert not is_seq(A())



            

Reported by Pylint.

Redefining name 'maybe_list_like' from outer scope (line 126)
Error

Line: 130 Column: 23

                  return request.param


def test_is_list_like(maybe_list_like):
    obj, expected = maybe_list_like
    expected = True if expected == "set" else expected
    assert inference.is_list_like(obj) == expected



            

Reported by Pylint.

Redefining name 'expected' from outer scope (line 122)
Error

Line: 131 Column: 10

              

def test_is_list_like(maybe_list_like):
    obj, expected = maybe_list_like
    expected = True if expected == "set" else expected
    assert inference.is_list_like(obj) == expected


def test_is_list_like_disallow_sets(maybe_list_like):

            

Reported by Pylint.

Redefining name 'maybe_list_like' from outer scope (line 126)
Error

Line: 136 Column: 37

                  assert inference.is_list_like(obj) == expected


def test_is_list_like_disallow_sets(maybe_list_like):
    obj, expected = maybe_list_like
    expected = False if expected == "set" else expected
    assert inference.is_list_like(obj, allow_sets=False) == expected



            

Reported by Pylint.

Redefining name 'expected' from outer scope (line 122)
Error

Line: 137 Column: 10

              

def test_is_list_like_disallow_sets(maybe_list_like):
    obj, expected = maybe_list_like
    expected = False if expected == "set" else expected
    assert inference.is_list_like(obj, allow_sets=False) == expected


def test_is_list_like_recursion():

            

Reported by Pylint.

pandas/tests/plotting/frame/test_frame.py
618 issues
Unable to import 'pytest'
Error

Line: 12 Column: 1

              import warnings

import numpy as np
import pytest

import pandas.util._test_decorators as td

from pandas.core.dtypes.api import is_list_like


            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 158 Column: 19

                      self._check_axes_shape(axes, axes_num=1, layout=(1, 1))
        # When ax is supplied and required number of axes is 1,
        # passed ax should be used:
        fig, ax = self.plt.subplots()
        axes = df.plot.bar(subplots=True, ax=ax)
        assert len(axes) == 1
        result = ax.axes
        assert result is axes[0]


            

Reported by Pylint.

Method 'plt' has no 'axhline' member
Error

Line: 321 Column: 9

                      )

        df.plot()
        self.plt.axhline(y=0)
        tm.close()

    def test_unsorted_index(self):
        df = DataFrame(
            {"y": np.arange(100)}, index=np.arange(99, -1, -1), dtype=np.int64

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 523 Column: 27

                  def test_area_sharey_dont_overwrite(self):
        # GH37942
        df = DataFrame(np.random.rand(4, 2), columns=["x", "y"])
        fig, (ax1, ax2) = self.plt.subplots(1, 2, sharey=True)

        df.plot(ax=ax1, kind="area")
        df.plot(ax=ax2, kind="area")

        assert ax1._shared_y_axes.joined(ax1, ax2)

            

Reported by Pylint.

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

Line: 684 Column: 23

                  def test_raise_error_on_datetime_time_data(self):
        # GH 8113, datetime.time type is not supported by matplotlib in scatter
        df = DataFrame(np.random.randn(10), columns=["a"])
        df["dtime"] = date_range(start="2014-01-01", freq="h", periods=10).time
        msg = "must be a string or a number, not 'datetime.time'"

        with pytest.raises(TypeError, match=msg):
            df.plot(kind="scatter", x="dtime", y="a")


            

Reported by Pylint.

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

Line: 684 Column: 23

                  def test_raise_error_on_datetime_time_data(self):
        # GH 8113, datetime.time type is not supported by matplotlib in scatter
        df = DataFrame(np.random.randn(10), columns=["a"])
        df["dtime"] = date_range(start="2014-01-01", freq="h", periods=10).time
        msg = "must be a string or a number, not 'datetime.time'"

        with pytest.raises(TypeError, match=msg):
            df.plot(kind="scatter", x="dtime", y="a")


            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 1397 Column: 21

                      df = DataFrame(np.random.rand(4, 4))
        for i in range(4):
            df.iloc[i, i] = np.nan
        fig, axes = self.plt.subplots(ncols=4)

        # GH 37668
        kwargs = {}
        if mpl.__version__ >= "3.3":
            kwargs = {"normalize": True}

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 1914 Column: 19

              
        # supplied ax itself is a SubplotAxes, but figure contains also
        # a plain Axes object (GH11556)
        fig, ax = self.plt.subplots()
        fig.add_axes([0.2, 0.2, 0.2, 0.2])
        Series(np.random.rand(10)).plot(ax=ax)

        # supplied ax itself is a plain Axes, but because the cmap keyword
        # a new ax is created for the colorbar -> also multiples axes (GH11520)

            

Reported by Pylint.

Method 'plt' has no 'figure' member
Error

Line: 1921 Column: 15

                      # supplied ax itself is a plain Axes, but because the cmap keyword
        # a new ax is created for the colorbar -> also multiples axes (GH11520)
        df = DataFrame({"a": np.random.randn(8), "b": np.random.randn(8)})
        fig = self.plt.figure()
        ax = fig.add_axes((0, 0, 1, 1))
        df.plot(kind="scatter", ax=ax, x="a", y="b", c="a", cmap="hsv")

        # other examples
        fig, ax = self.plt.subplots()

            

Reported by Pylint.

Method 'plt' has no 'subplots' member
Error

Line: 1926 Column: 19

                      df.plot(kind="scatter", ax=ax, x="a", y="b", c="a", cmap="hsv")

        # other examples
        fig, ax = self.plt.subplots()
        from mpl_toolkits.axes_grid1 import make_axes_locatable

        divider = make_axes_locatable(ax)
        cax = divider.append_axes("right", size="5%", pad=0.05)
        Series(np.random.rand(10)).plot(ax=ax)

            

Reported by Pylint.

pandas/tests/indexing/test_loc.py
618 issues
Unable to import 'pytest'
Error

Line: 14 Column: 1

              
from dateutil.tz import gettz
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 'hour' member
Error

Line: 1173 Column: 17

              
    def test_loc_getitem_time_object(self, frame_or_series):
        rng = date_range("1/1/2000", "1/5/2000", freq="5min")
        mask = (rng.hour == 9) & (rng.minute == 30)

        obj = DataFrame(np.random.randn(len(rng), 3), index=rng)
        if frame_or_series is Series:
            obj = obj[0]


            

Reported by Pylint.

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

Line: 1173 Column: 35

              
    def test_loc_getitem_time_object(self, frame_or_series):
        rng = date_range("1/1/2000", "1/5/2000", freq="5min")
        mask = (rng.hour == 9) & (rng.minute == 30)

        obj = DataFrame(np.random.randn(len(rng), 3), index=rng)
        if frame_or_series is Series:
            obj = obj[0]


            

Reported by Pylint.

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

Line: 1173 Column: 17

              
    def test_loc_getitem_time_object(self, frame_or_series):
        rng = date_range("1/1/2000", "1/5/2000", freq="5min")
        mask = (rng.hour == 9) & (rng.minute == 30)

        obj = DataFrame(np.random.randn(len(rng), 3), index=rng)
        if frame_or_series is Series:
            obj = obj[0]


            

Reported by Pylint.

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

Line: 1173 Column: 35

              
    def test_loc_getitem_time_object(self, frame_or_series):
        rng = date_range("1/1/2000", "1/5/2000", freq="5min")
        mask = (rng.hour == 9) & (rng.minute == 30)

        obj = DataFrame(np.random.randn(len(rng), 3), index=rng)
        if frame_or_series is Series:
            obj = obj[0]


            

Reported by Pylint.

Unable to import 'scipy.sparse'
Error

Line: 1196 Column: 9

                  @pytest.mark.parametrize("dtype", [np.int64, np.float64, complex])
    @td.skip_if_no_scipy
    def test_loc_getitem_range_from_spmatrix(self, spmatrix_t, dtype):
        import scipy.sparse

        spmatrix_t = getattr(scipy.sparse, spmatrix_t)

        # The bug is triggered by a sparse matrix with purely sparse columns.  So the
        # recipe below generates a rectangular matrix of dimension (5, 7) where all the

            

Reported by Pylint.

Unable to import 'scipy.sparse'
Error

Line: 1226 Column: 9

                  @td.skip_if_no_scipy
    def test_loc_getitem_sparse_frame(self):
        # GH34687
        from scipy.sparse import eye

        df = DataFrame.sparse.from_spmatrix(eye(5))
        result = df.loc[range(2)]
        expected = DataFrame(
            [[1.0, 0.0, 0.0, 0.0, 0.0], [0.0, 1.0, 0.0, 0.0, 0.0]],

            

Reported by Pylint.

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

Line: 2399 Column: 19

              
        idx = date_range("2011-01-01", "2011-01-02", freq="D", name="idx")
        if to_period:
            idx = idx.to_period("D")
        ser = Series([0.1, 0.2], index=idx, name="s")

        keys = [Timestamp("2011-01-01"), Timestamp("2011-01-02")]
        if to_period:
            keys = [x.to_period("D") for x in keys]

            

Reported by Pylint.

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

Line: 2399 Column: 19

              
        idx = date_range("2011-01-01", "2011-01-02", freq="D", name="idx")
        if to_period:
            idx = idx.to_period("D")
        ser = Series([0.1, 0.2], index=idx, name="s")

        keys = [Timestamp("2011-01-01"), Timestamp("2011-01-02")]
        if to_period:
            keys = [x.to_period("D") for x in keys]

            

Reported by Pylint.

TODO: test something?
Error

Line: 97 Column: 3

                      )

    def test_loc_getitem_label_array_like(self):
        # TODO: test something?
        # array like
        pass

    def test_loc_getitem_bool(self):
        # boolean indexers

            

Reported by Pylint.

pandas/tests/computation/test_eval.py
596 issues
Unable to import 'pytest'
Error

Line: 9 Column: 1

              import warnings

import numpy as np
import pytest

from pandas.errors import PerformanceWarning
import pandas.util._test_decorators as td

from pandas.core.dtypes.common import (

            

Reported by Pylint.

Unable to import 'numexpr'
Error

Line: 154 Column: 9

              
    @classmethod
    def setup_class(cls):
        import numexpr as ne

        cls.ne = ne

    @property
    def current_engines(self):

            

Reported by Pylint.

Unable to import 'numexpr'
Error

Line: 765 Column: 9

                  @classmethod
    def setup_class(cls):
        super().setup_class()
        import numexpr as ne

        cls.ne = ne

    def check_chained_cmp_op(self, lhs, cmp1, mid, cmp2, rhs):
        ex1 = f"lhs {cmp1} mid {cmp2} rhs"

            

Reported by Pylint.

function already defined line 1305
Error

Line: 1318 Column: 9

              
        df = orig_df.copy()

        def f():
            a = 1  # noqa
            old_a = df.a.copy()
            df.eval("a = a + b", inplace=True)
            result = old_a + df.b
            tm.assert_series_equal(result, df.a, check_names=False)

            

Reported by Pylint.

Comparing against a callable, did you omit the parenthesis?
Error

Line: 56 Column: 17

                      pytest.param(
            engine,
            marks=pytest.mark.skipif(
                engine == "numexpr" and not USE_NUMEXPR,
                reason=f"numexpr enabled->{USE_NUMEXPR}, "
                f"installed->{NUMEXPR_INSTALLED}",
            ),
        )
        for engine in ENGINES

            

Reported by Pylint.

Redefining name 'engine' from outer scope (line 62)
Error

Line: 82 Column: 25

                  return request.param


def engine_has_neg_frac(engine):
    return ENGINES[engine].has_neg_frac


def _eval_single_bin(lhs, cmp1, rhs, engine):
    c = _binary_ops_dict[cmp1]

            

Reported by Pylint.

Redefining name 'engine' from outer scope (line 62)
Error

Line: 86 Column: 38

                  return ENGINES[engine].has_neg_frac


def _eval_single_bin(lhs, cmp1, rhs, engine):
    c = _binary_ops_dict[cmp1]
    if engine_has_neg_frac(engine):
        try:
            return c(lhs, rhs)
        except ValueError as e:

            

Reported by Pylint.

Redefining name 'rhs' from outer scope (line 140)
Error

Line: 86 Column: 33

                  return ENGINES[engine].has_neg_frac


def _eval_single_bin(lhs, cmp1, rhs, engine):
    c = _binary_ops_dict[cmp1]
    if engine_has_neg_frac(engine):
        try:
            return c(lhs, rhs)
        except ValueError as e:

            

Reported by Pylint.

Redefining name 'lhs' from outer scope (line 125)
Error

Line: 86 Column: 22

                  return ENGINES[engine].has_neg_frac


def _eval_single_bin(lhs, cmp1, rhs, engine):
    c = _binary_ops_dict[cmp1]
    if engine_has_neg_frac(engine):
        try:
            return c(lhs, rhs)
        except ValueError as e:

            

Reported by Pylint.

Redefining name 'rhs' from outer scope (line 140)
Error

Line: 100 Column: 33

                  return c(lhs, rhs)


def _series_and_2d_ndarray(lhs, rhs):
    return (
        isinstance(lhs, Series) and isinstance(rhs, np.ndarray) and rhs.ndim > 1
    ) or (isinstance(rhs, Series) and isinstance(lhs, np.ndarray) and lhs.ndim > 1)



            

Reported by Pylint.

pandas/tests/series/test_constructors.py
567 issues
Unable to import 'pytest'
Error

Line: 10 Column: 1

              from dateutil.tz import tzoffset
import numpy as np
import numpy.ma as ma
import pytest

from pandas._libs import (
    iNaT,
    lib,
)

            

Reported by Pylint.

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

Line: 12 Column: 1

              import numpy.ma as ma
import pytest

from pandas._libs import (
    iNaT,
    lib,
)
import pandas.util._test_decorators as td


            

Reported by Pylint.

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

Line: 911 Column: 46

                          tm.assert_series_equal(result, expected)

        # leave datetime.date alone
        dates2 = np.array([d.date() for d in dates.to_pydatetime()], dtype=object)
        series1 = Series(dates2, dates)
        tm.assert_numpy_array_equal(series1.values, dates2)
        assert series1.dtype == object

    def test_constructor_dtype_datetime64_6(self):

            

Reported by Pylint.

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

Line: 911 Column: 46

                          tm.assert_series_equal(result, expected)

        # leave datetime.date alone
        dates2 = np.array([d.date() for d in dates.to_pydatetime()], dtype=object)
        series1 = Series(dates2, dates)
        tm.assert_numpy_array_equal(series1.values, dates2)
        assert series1.dtype == object

    def test_constructor_dtype_datetime64_6(self):

            

Reported by Pylint.

Lambda may not be necessary
Error

Line: 59 Column: 14

                          # test for None or an empty generator.
            # test_constructor_pass_none tests None but only with the index also
            # passed.
            (lambda: Series(), True),
            (lambda: Series(None), True),
            (lambda: Series({}), True),
            (lambda: Series(()), False),  # creates a RangeIndex
            (lambda: Series([]), False),  # creates a RangeIndex
            (lambda: Series(_ for _ in []), False),  # creates a RangeIndex

            

Reported by Pylint.

TODO: share with frame test of the same name
Error

Line: 73 Column: 3

                      ],
    )
    def test_empty_constructor(self, constructor, check_index_type):
        # TODO: share with frame test of the same name
        with tm.assert_produces_warning(FutureWarning):
            expected = Series()
            result = constructor()

        assert len(result.index) == 0

            

Reported by Pylint.

Access to a protected member _is_all_dates of a client class
Error

Line: 121 Column: 16

                  def test_constructor(self, datetime_series):
        with tm.assert_produces_warning(FutureWarning):
            empty_series = Series()
        assert datetime_series.index._is_all_dates

        # Pass in Series
        derived = Series(datetime_series)
        assert derived.index._is_all_dates


            

Reported by Pylint.

Access to a protected member _is_all_dates of a client class
Error

Line: 125 Column: 16

              
        # Pass in Series
        derived = Series(datetime_series)
        assert derived.index._is_all_dates

        assert tm.equalContents(derived.index, datetime_series.index)
        # Ensure new index is not created
        assert id(datetime_series.index) == id(derived.index)


            

Reported by Pylint.

Comparison 'mixed[1] is np.NaN' should be 'math.isnan(mixed[1])'
Error

Line: 134 Column: 16

                      # Mixed type Series
        mixed = Series(["hello", np.NaN], index=[0, 1])
        assert mixed.dtype == np.object_
        assert mixed[1] is np.NaN

        assert not empty_series.index._is_all_dates
        with tm.assert_produces_warning(FutureWarning):
            assert not Series().index._is_all_dates


            

Reported by Pylint.

Access to a protected member _is_all_dates of a client class
Error

Line: 136 Column: 20

                      assert mixed.dtype == np.object_
        assert mixed[1] is np.NaN

        assert not empty_series.index._is_all_dates
        with tm.assert_produces_warning(FutureWarning):
            assert not Series().index._is_all_dates

        # exception raised is of type ValueError GH35744
        with pytest.raises(ValueError, match="Data must be 1-dimensional"):

            

Reported by Pylint.