The following issues were found

pandas/tests/indexing/test_scalar.py
116 issues
Unable to import 'pytest'
Error

Line: 8 Column: 1

              )

import numpy as np
import pytest

from pandas import (
    DataFrame,
    Series,
    Timedelta,

            

Reported by Pylint.

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

Line: 236 Column: 18

                  #  call maybe_box_datetimelike
    dti = date_range("2016-01-01", periods=3)
    tdi = dti - dti
    ser = Series(dti.to_pydatetime(), dtype=object)
    ser2 = Series(tdi.to_pytimedelta(), dtype=object)
    df = DataFrame({"A": ser, "B": ser2})
    assert (df.dtypes == object).all()

    for result in [df.at[0, "A"], df.iat[0, 0], df.loc[0, "A"], df.iloc[0, 0]]:

            

Reported by Pylint.

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

Line: 236 Column: 18

                  #  call maybe_box_datetimelike
    dti = date_range("2016-01-01", periods=3)
    tdi = dti - dti
    ser = Series(dti.to_pydatetime(), dtype=object)
    ser2 = Series(tdi.to_pytimedelta(), dtype=object)
    df = DataFrame({"A": ser, "B": ser2})
    assert (df.dtypes == object).all()

    for result in [df.at[0, "A"], df.iat[0, 0], df.loc[0, "A"], df.iloc[0, 0]]:

            

Reported by Pylint.

TODO: Better name, just separating things that dont need Base class
Error

Line: 78 Column: 3

              

class TestScalar2:
    # TODO: Better name, just separating things that dont need Base class

    def test_at_iat_coercion(self):

        # as timestamp is not a tuple!
        dates = date_range("1/1/2000", periods=8)

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 123 Column: 13

              
        msg = "index 10 is out of bounds for axis 0 with size 5"
        with pytest.raises(IndexError, match=msg):
            s.iat[10]
        msg = "index -10 is out of bounds for axis 0 with size 5"
        with pytest.raises(IndexError, match=msg):
            s.iat[-10]

        result = s.iloc[[2, 3]]

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 126 Column: 13

                          s.iat[10]
        msg = "index -10 is out of bounds for axis 0 with size 5"
        with pytest.raises(IndexError, match=msg):
            s.iat[-10]

        result = s.iloc[[2, 3]]
        expected = Series([2, 3], [2, 2], dtype="int64")
        tm.assert_series_equal(result, expected)


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 188 Column: 13

                          assert s.iat[i] == s.iloc[i] == i + 1

        with pytest.raises(KeyError, match="^4$"):
            s.at[4]
        with pytest.raises(KeyError, match="^4$"):
            s.loc[4]

    def test_mixed_index_at_iat_loc_iloc_dataframe(self):
        # GH 19860

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 190 Column: 13

                      with pytest.raises(KeyError, match="^4$"):
            s.at[4]
        with pytest.raises(KeyError, match="^4$"):
            s.loc[4]

    def test_mixed_index_at_iat_loc_iloc_dataframe(self):
        # GH 19860
        df = DataFrame(
            [[0, 1, 2, 3, 4], [5, 6, 7, 8, 9]], columns=["a", "b", "c", 1, 2]

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 206 Column: 13

                              assert df.iat[row, i] == df.iloc[row, i] == row * 5 + i

        with pytest.raises(KeyError, match="^3$"):
            df.at[0, 3]
        with pytest.raises(KeyError, match="^3$"):
            df.loc[0, 3]

    def test_iat_setter_incompatible_assignment(self):
        # GH 23236

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 208 Column: 13

                      with pytest.raises(KeyError, match="^3$"):
            df.at[0, 3]
        with pytest.raises(KeyError, match="^3$"):
            df.loc[0, 3]

    def test_iat_setter_incompatible_assignment(self):
        # GH 23236
        result = DataFrame({"a": [0, 1], "b": [4, 5]})
        result.iat[0, 0] = None

            

Reported by Pylint.

pandas/tests/extension/decimal/test_decimal.py
116 issues
Unable to import 'pytest'
Error

Line: 6 Column: 1

              import operator

import numpy as np
import pytest

import pandas as pd
import pandas._testing as tm
from pandas.api.types import infer_dtype
from pandas.tests.extension import base

            

Reported by Pylint.

Method should have "self" as first argument
Error

Line: 341 Column: 5

              class DecimalArrayWithoutFromSequence(DecimalArray):
    """Helper class for testing error handling in _from_sequence."""

    def _from_sequence(cls, scalars, dtype=None, copy=False):
        raise KeyError("For the test")


class DecimalArrayWithoutCoercion(DecimalArrayWithoutFromSequence):
    @classmethod

            

Reported by Pylint.

TODO(EA): select_dtypes
Error

Line: 99 Column: 3

              
    @classmethod
    def assert_frame_equal(cls, left, right, *args, **kwargs):
        # TODO(EA): select_dtypes
        tm.assert_index_equal(
            left.columns,
            right.columns,
            exact=kwargs.get("check_column_type", "equiv"),
            check_names=kwargs.get("check_names", True),

            

Reported by Pylint.

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

Line: 121 Column: 29

              

class TestDtype(BaseDecimal, base.BaseDtypeTests):
    def test_hashable(self, dtype):
        pass

    @pytest.mark.parametrize("skipna", [True, False])
    def test_infer_dtype(self, data, data_missing, skipna):
        # here overriding base test to ensure we fall back to return

            

Reported by Pylint.

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

Line: 125 Column: 32

                      pass

    @pytest.mark.parametrize("skipna", [True, False])
    def test_infer_dtype(self, data, data_missing, skipna):
        # here overriding base test to ensure we fall back to return
        # "unknown-array" for an EA pandas doesn't know
        assert infer_dtype(data, skipna=skipna) == "unknown-array"
        assert infer_dtype(data_missing, skipna=skipna) == "unknown-array"


            

Reported by Pylint.

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

Line: 125 Column: 38

                      pass

    @pytest.mark.parametrize("skipna", [True, False])
    def test_infer_dtype(self, data, data_missing, skipna):
        # here overriding base test to ensure we fall back to return
        # "unknown-array" for an EA pandas doesn't know
        assert infer_dtype(data, skipna=skipna) == "unknown-array"
        assert infer_dtype(data_missing, skipna=skipna) == "unknown-array"


            

Reported by Pylint.

Parameters differ from overridden 'test_value_counts' method
Error

Line: 180 Column: 5

              
class TestMethods(BaseDecimal, base.BaseMethodsTests):
    @pytest.mark.parametrize("dropna", [True, False])
    def test_value_counts(self, all_data, dropna, request):
        all_data = all_data[:10]
        if dropna:
            other = np.array(all_data[~all_data.isna()])
        else:
            other = all_data

            

Reported by Pylint.

Unused argument 'request'
Error

Line: 180 Column: 51

              
class TestMethods(BaseDecimal, base.BaseMethodsTests):
    @pytest.mark.parametrize("dropna", [True, False])
    def test_value_counts(self, all_data, dropna, request):
        all_data = all_data[:10]
        if dropna:
            other = np.array(all_data[~all_data.isna()])
        else:
            other = all_data

            

Reported by Pylint.

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

Line: 199 Column: 48

              
        tm.assert_series_equal(result, expected)

    def test_value_counts_with_normalize(self, data):
        return super().test_value_counts_with_normalize(data)


class TestCasting(BaseDecimal, base.BaseCastingTests):
    pass

            

Reported by Pylint.

Useless super delegation in method 'test_value_counts_with_normalize'
Error

Line: 199 Column: 5

              
        tm.assert_series_equal(result, expected)

    def test_value_counts_with_normalize(self, data):
        return super().test_value_counts_with_normalize(data)


class TestCasting(BaseDecimal, base.BaseCastingTests):
    pass

            

Reported by Pylint.

asv_bench/benchmarks/series_methods.py
116 issues
Unable to import 'pandas'
Error

Line: 5 Column: 1

              
import numpy as np

from pandas import (
    NaT,
    Series,
    date_range,
)


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 11 Column: 1

                  date_range,
)

from .pandas_vb_common import tm


class SeriesConstructor:

    params = [None, "dict"]

            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 244 Column: 1

                      self.s.rank()


from .pandas_vb_common import setup  # noqa: F401 isort:skip

            

Reported by Pylint.

Attribute 'idx' defined outside __init__
Error

Line: 20 Column: 9

                  param_names = ["data"]

    def setup(self, data):
        self.idx = date_range(
            start=datetime(2015, 10, 26), end=datetime(2016, 1, 1), freq="50s"
        )
        dict_data = dict(zip(self.idx, range(len(self.idx))))
        self.data = None if data is None else dict_data


            

Reported by Pylint.

Attribute 'data' defined outside __init__
Error

Line: 24 Column: 9

                          start=datetime(2015, 10, 26), end=datetime(2016, 1, 1), freq="50s"
        )
        dict_data = dict(zip(self.idx, range(len(self.idx))))
        self.data = None if data is None else dict_data

    def time_constructor(self, data):
        Series(data=self.data, index=self.idx)



            

Reported by Pylint.

Unused argument 'data'
Error

Line: 26 Column: 32

                      dict_data = dict(zip(self.idx, range(len(self.idx))))
        self.data = None if data is None else dict_data

    def time_constructor(self, data):
        Series(data=self.data, index=self.idx)


class NSort:


            

Reported by Pylint.

Unused argument 'keep'
Error

Line: 35 Column: 21

                  params = ["first", "last", "all"]
    param_names = ["keep"]

    def setup(self, keep):
        self.s = Series(np.random.randint(1, 10, 100000))

    def time_nlargest(self, keep):
        self.s.nlargest(3, keep=keep)


            

Reported by Pylint.

Attribute 's' defined outside __init__
Error

Line: 36 Column: 9

                  param_names = ["keep"]

    def setup(self, keep):
        self.s = Series(np.random.randint(1, 10, 100000))

    def time_nlargest(self, keep):
        self.s.nlargest(3, keep=keep)

    def time_nsmallest(self, keep):

            

Reported by Pylint.

Attribute 's' defined outside __init__
Error

Line: 56 Column: 9

                          "int": np.random.randint(1, 10, N),
            "datetime": date_range("2000-01-01", freq="S", periods=N),
        }
        self.s = Series(data[dtype])
        if dtype == "datetime":
            self.s[np.random.randint(1, N, 100)] = NaT

    def time_dropna(self, dtype):
        self.s.dropna()

            

Reported by Pylint.

Unused argument 'dtype'
Error

Line: 60 Column: 27

                      if dtype == "datetime":
            self.s[np.random.randint(1, N, 100)] = NaT

    def time_dropna(self, dtype):
        self.s.dropna()


class SearchSorted:


            

Reported by Pylint.

pandas/tests/io/json/test_normalize.py
111 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              import json

import numpy as np
import pytest

import pandas.util._test_decorators as td

from pandas import (
    DataFrame,

            

Reported by Pylint.

TODO(ArrayManager) sanitize S/U numpy dtypes to object
Error

Line: 156 Column: 3

              
        tm.assert_frame_equal(result, expected)

    # TODO(ArrayManager) sanitize S/U numpy dtypes to object
    @td.skip_array_manager_not_yet_implemented
    def test_simple_normalize(self, state_data):
        result = json_normalize(state_data[0], "counties")
        expected = DataFrame(state_data[0]["counties"])
        tm.assert_frame_equal(result, expected)

            

Reported by Pylint.

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

Line: 158 Column: 37

              
    # TODO(ArrayManager) sanitize S/U numpy dtypes to object
    @td.skip_array_manager_not_yet_implemented
    def test_simple_normalize(self, state_data):
        result = json_normalize(state_data[0], "counties")
        expected = DataFrame(state_data[0]["counties"])
        tm.assert_frame_equal(result, expected)

        result = json_normalize(state_data, "counties")

            

Reported by Pylint.

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

Line: 200 Column: 52

                          expected = DataFrame([0, 1], columns=["a"])
            tm.assert_frame_equal(result, expected)

    def test_simple_normalize_with_separator(self, deep_nested):
        # GH 14883
        result = json_normalize({"A": {"A": 1, "B": 2}})
        expected = DataFrame([[1, 2]], columns=["A.A", "A.B"])
        tm.assert_frame_equal(result.reindex_like(expected), expected)


            

Reported by Pylint.

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

Line: 249 Column: 39

                      )
        tm.assert_frame_equal(result, expected)

    def test_more_deeply_nested(self, deep_nested):

        result = json_normalize(
            deep_nested, ["states", "cities"], meta=["country", ["states", "name"]]
        )
        ex_data = {

            

Reported by Pylint.

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

Line: 316 Column: 61

                      expected = DataFrame(ex_data, columns=result.columns)
        tm.assert_frame_equal(result, expected)

    def test_nested_meta_path_with_nested_record_path(self, state_data):
        # GH 27220
        result = json_normalize(
            data=state_data,
            record_path=["counties"],
            meta=["state", "shortname", ["info", "governor"]],

            

Reported by Pylint.

TODO(ArrayManager) sanitize S/U numpy dtypes to object
Error

Line: 377 Column: 3

                      for val in ["metafoo", "metabar", "foo", "bar"]:
            assert val in result

    # TODO(ArrayManager) sanitize S/U numpy dtypes to object
    @td.skip_array_manager_not_yet_implemented
    def test_record_prefix(self, state_data):
        result = json_normalize(state_data[0], "counties")
        expected = DataFrame(state_data[0]["counties"])
        tm.assert_frame_equal(result, expected)

            

Reported by Pylint.

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

Line: 379 Column: 34

              
    # TODO(ArrayManager) sanitize S/U numpy dtypes to object
    @td.skip_array_manager_not_yet_implemented
    def test_record_prefix(self, state_data):
        result = json_normalize(state_data[0], "counties")
        expected = DataFrame(state_data[0]["counties"])
        tm.assert_frame_equal(result, expected)

        result = json_normalize(

            

Reported by Pylint.

Redefining name 'author_missing_data' from outer scope (line 84)
Error

Line: 413 Column: 34

                      result = json_normalize(json.loads(testjson))
        tm.assert_frame_equal(result, expected)

    def test_missing_field(self, author_missing_data):
        # GH20030:
        result = json_normalize(author_missing_data)
        ex_data = [
            {
                "info": np.nan,

            

Reported by Pylint.

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

Line: 552 Column: 30

                      )
        tm.assert_frame_equal(result, expected)

    def test_generator(self, state_data):
        # GH35923 Fix pd.json_normalize to not skip the first element of a
        # generator input
        def generator_data():
            yield from state_data[0]["counties"]


            

Reported by Pylint.

pandas/tests/tseries/frequencies/test_inference.py
110 issues
Unable to import 'pytest'
Error

Line: 7 Column: 1

              )

import numpy as np
import pytest

from pandas._libs.tslibs.ccalendar import (
    DAYS,
    MONTHS,
)

            

Reported by Pylint.

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

Line: 9 Column: 1

              import numpy as np
import pytest

from pandas._libs.tslibs.ccalendar import (
    DAYS,
    MONTHS,
)
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
from pandas.compat import is_platform_windows

            

Reported by Pylint.

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

Line: 9 Column: 1

              import numpy as np
import pytest

from pandas._libs.tslibs.ccalendar import (
    DAYS,
    MONTHS,
)
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
from pandas.compat import is_platform_windows

            

Reported by Pylint.

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

Line: 13 Column: 1

                  DAYS,
    MONTHS,
)
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
from pandas.compat import is_platform_windows

from pandas import (
    DatetimeIndex,
    Index,

            

Reported by Pylint.

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

Line: 13 Column: 1

                  DAYS,
    MONTHS,
)
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
from pandas.compat import is_platform_windows

from pandas import (
    DatetimeIndex,
    Index,

            

Reported by Pylint.

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

Line: 50 Column: 49

                  index = DatetimeIndex(gen.values)

    if not freq.startswith("Q-"):
        assert frequencies.infer_freq(index) == gen.freqstr
    else:
        inf_freq = frequencies.infer_freq(index)
        is_dec_range = inf_freq == "Q-DEC" and gen.freqstr in (
            "Q",
            "Q-DEC",

            

Reported by Pylint.

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

Line: 50 Column: 49

                  index = DatetimeIndex(gen.values)

    if not freq.startswith("Q-"):
        assert frequencies.infer_freq(index) == gen.freqstr
    else:
        inf_freq = frequencies.infer_freq(index)
        is_dec_range = inf_freq == "Q-DEC" and gen.freqstr in (
            "Q",
            "Q-DEC",

            

Reported by Pylint.

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

Line: 53 Column: 48

                      assert frequencies.infer_freq(index) == gen.freqstr
    else:
        inf_freq = frequencies.infer_freq(index)
        is_dec_range = inf_freq == "Q-DEC" and gen.freqstr in (
            "Q",
            "Q-DEC",
            "Q-SEP",
            "Q-JUN",
            "Q-MAR",

            

Reported by Pylint.

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

Line: 53 Column: 48

                      assert frequencies.infer_freq(index) == gen.freqstr
    else:
        inf_freq = frequencies.infer_freq(index)
        is_dec_range = inf_freq == "Q-DEC" and gen.freqstr in (
            "Q",
            "Q-DEC",
            "Q-SEP",
            "Q-JUN",
            "Q-MAR",

            

Reported by Pylint.

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

Line: 60 Column: 48

                          "Q-JUN",
            "Q-MAR",
        )
        is_nov_range = inf_freq == "Q-NOV" and gen.freqstr in (
            "Q-NOV",
            "Q-AUG",
            "Q-MAY",
            "Q-FEB",
        )

            

Reported by Pylint.

asv_bench/benchmarks/algos/isin.py
110 issues
Unable to import 'pandas'
Error

Line: 3 Column: 1

              import numpy as np

from pandas import (
    Categorical,
    NaT,
    Series,
    date_range,
)


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 10 Column: 1

                  date_range,
)

from ..pandas_vb_common import tm


class IsIn:

    params = [

            

Reported by Pylint.

Attribute 'mismatched' defined outside __init__
Error

Line: 34 Column: 9

                  def setup(self, dtype):
        N = 10000

        self.mismatched = [NaT.to_datetime64()] * 2

        if dtype in ["boolean", "bool"]:
            self.series = Series(np.random.randint(0, 2, N)).astype(dtype)
            self.values = [True, False]


            

Reported by Pylint.

Attribute 'series' defined outside __init__
Error

Line: 37 Column: 13

                      self.mismatched = [NaT.to_datetime64()] * 2

        if dtype in ["boolean", "bool"]:
            self.series = Series(np.random.randint(0, 2, N)).astype(dtype)
            self.values = [True, False]

        elif dtype == "datetime64[ns]":
            # Note: values here is much larger than non-dt64ns cases


            

Reported by Pylint.

Attribute 'values' defined outside __init__
Error

Line: 38 Column: 13

              
        if dtype in ["boolean", "bool"]:
            self.series = Series(np.random.randint(0, 2, N)).astype(dtype)
            self.values = [True, False]

        elif dtype == "datetime64[ns]":
            # Note: values here is much larger than non-dt64ns cases

            # dti has length=115777

            

Reported by Pylint.

Attribute 'series' defined outside __init__
Error

Line: 45 Column: 13

              
            # dti has length=115777
            dti = date_range(start="2015-10-26", end="2016-01-01", freq="50s")
            self.series = Series(dti)
            self.values = self.series._values[::3]
            self.mismatched = [1, 2]

        elif dtype in ["category[object]", "category[int]"]:
            # Note: sizes are different in this case than others

            

Reported by Pylint.

Attribute 'values' defined outside __init__
Error

Line: 46 Column: 13

                          # dti has length=115777
            dti = date_range(start="2015-10-26", end="2016-01-01", freq="50s")
            self.series = Series(dti)
            self.values = self.series._values[::3]
            self.mismatched = [1, 2]

        elif dtype in ["category[object]", "category[int]"]:
            # Note: sizes are different in this case than others
            n = 5 * 10 ** 5

            

Reported by Pylint.

Access to a protected member _values of a client class
Error

Line: 46 Column: 27

                          # dti has length=115777
            dti = date_range(start="2015-10-26", end="2016-01-01", freq="50s")
            self.series = Series(dti)
            self.values = self.series._values[::3]
            self.mismatched = [1, 2]

        elif dtype in ["category[object]", "category[int]"]:
            # Note: sizes are different in this case than others
            n = 5 * 10 ** 5

            

Reported by Pylint.

Attribute 'mismatched' defined outside __init__
Error

Line: 47 Column: 13

                          dti = date_range(start="2015-10-26", end="2016-01-01", freq="50s")
            self.series = Series(dti)
            self.values = self.series._values[::3]
            self.mismatched = [1, 2]

        elif dtype in ["category[object]", "category[int]"]:
            # Note: sizes are different in this case than others
            n = 5 * 10 ** 5
            sample_size = 100

            

Reported by Pylint.

Attribute 'values' defined outside __init__
Error

Line: 58 Column: 13

                          if dtype == "category[object]":
                arr = [f"s{i:04d}" for i in arr]

            self.values = np.random.choice(arr, sample_size)
            self.series = Series(arr).astype("category")

        elif dtype in ["str", "string[python]", "string[pyarrow]"]:
            try:
                self.series = Series(tm.makeStringIndex(N), dtype=dtype)

            

Reported by Pylint.

pandas/tests/reshape/concat/test_datetimes.py
109 issues
Unable to import 'pytest'
Error

Line: 6 Column: 1

              
import dateutil
import numpy as np
import pytest

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

            

Reported by Pylint.

Reimport 'date_range' (imported line 9)
Error

Line: 25 Column: 9

              
class TestDatetimeConcat:
    def test_concat_datetime64_block(self):
        from pandas.core.indexes.datetimes import date_range

        rng = date_range("1/1/2000", periods=10)

        df = DataFrame({"time": rng})


            

Reported by Pylint.

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

Line: 25 Column: 9

              
class TestDatetimeConcat:
    def test_concat_datetime64_block(self):
        from pandas.core.indexes.datetimes import date_range

        rng = date_range("1/1/2000", periods=10)

        df = DataFrame({"time": rng})


            

Reported by Pylint.

Access to a protected member _data of a client class
Error

Line: 126 Column: 9

                      # Non-monotonic index result
        result = concat([expected[50:], expected[:50]])
        expected = DataFrame(data[50:] + data[:50], index=dr[50:].append(dr[:50]))
        expected.index._data.freq = None
        tm.assert_frame_equal(result, expected)

    def test_concat_multiindex_datetime_object_index(self):
        # https://github.com/pandas-dev/pandas/issues/11058
        idx = Index(

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import datetime as dt
from datetime import datetime

import dateutil
import numpy as np
import pytest

import pandas as pd
from pandas import (

            

Reported by Pylint.

Missing class docstring
Error

Line: 23 Column: 1

              import pandas._testing as tm


class TestDatetimeConcat:
    def test_concat_datetime64_block(self):
        from pandas.core.indexes.datetimes import date_range

        rng = date_range("1/1/2000", periods=10)


            

Reported by Pylint.

Method could be a function
Error

Line: 24 Column: 5

              

class TestDatetimeConcat:
    def test_concat_datetime64_block(self):
        from pandas.core.indexes.datetimes import date_range

        rng = date_range("1/1/2000", periods=10)

        df = DataFrame({"time": rng})

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 24 Column: 5

              

class TestDatetimeConcat:
    def test_concat_datetime64_block(self):
        from pandas.core.indexes.datetimes import date_range

        rng = date_range("1/1/2000", periods=10)

        df = DataFrame({"time": rng})

            

Reported by Pylint.

Import outside toplevel (pandas.core.indexes.datetimes.date_range)
Error

Line: 25 Column: 9

              
class TestDatetimeConcat:
    def test_concat_datetime64_block(self):
        from pandas.core.indexes.datetimes import date_range

        rng = date_range("1/1/2000", periods=10)

        df = DataFrame({"time": rng})


            

Reported by Pylint.

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

Line: 29 Column: 9

              
        rng = date_range("1/1/2000", periods=10)

        df = DataFrame({"time": rng})

        result = concat([df, df])
        assert (result.iloc[:10]["time"] == rng).all()
        assert (result.iloc[10:]["time"] == rng).all()


            

Reported by Pylint.

pandas/tests/tseries/offsets/test_fiscal.py
109 issues
Unable to import 'pytest'
Error

Line: 7 Column: 1

              from datetime import datetime

from dateutil.relativedelta import relativedelta
import pytest

from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG

from pandas import Timestamp
import pandas._testing as tm

            

Reported by Pylint.

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

Line: 9 Column: 1

              from dateutil.relativedelta import relativedelta
import pytest

from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG

from pandas import Timestamp
import pandas._testing as tm
from pandas.tests.tseries.offsets.common import (
    Base,

            

Reported by Pylint.

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

Line: 9 Column: 1

              from dateutil.relativedelta import relativedelta
import pytest

from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG

from pandas import Timestamp
import pandas._testing as tm
from pandas.tests.tseries.offsets.common import (
    Base,

            

Reported by Pylint.

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

Line: 27 Column: 1

              )


def makeFY5253LastOfMonthQuarter(*args, **kwds):
    return FY5253Quarter(*args, variation="last", **kwds)


def makeFY5253NearestEndMonthQuarter(*args, **kwds):
    return FY5253Quarter(*args, variation="nearest", **kwds)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 27 Column: 1

              )


def makeFY5253LastOfMonthQuarter(*args, **kwds):
    return FY5253Quarter(*args, variation="last", **kwds)


def makeFY5253NearestEndMonthQuarter(*args, **kwds):
    return FY5253Quarter(*args, variation="nearest", **kwds)

            

Reported by Pylint.

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

Line: 31 Column: 1

                  return FY5253Quarter(*args, variation="last", **kwds)


def makeFY5253NearestEndMonthQuarter(*args, **kwds):
    return FY5253Quarter(*args, variation="nearest", **kwds)


def makeFY5253NearestEndMonth(*args, **kwds):
    return FY5253(*args, variation="nearest", **kwds)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 31 Column: 1

                  return FY5253Quarter(*args, variation="last", **kwds)


def makeFY5253NearestEndMonthQuarter(*args, **kwds):
    return FY5253Quarter(*args, variation="nearest", **kwds)


def makeFY5253NearestEndMonth(*args, **kwds):
    return FY5253(*args, variation="nearest", **kwds)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 35 Column: 1

                  return FY5253Quarter(*args, variation="nearest", **kwds)


def makeFY5253NearestEndMonth(*args, **kwds):
    return FY5253(*args, variation="nearest", **kwds)


def makeFY5253LastOfMonth(*args, **kwds):
    return FY5253(*args, variation="last", **kwds)

            

Reported by Pylint.

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

Line: 35 Column: 1

                  return FY5253Quarter(*args, variation="nearest", **kwds)


def makeFY5253NearestEndMonth(*args, **kwds):
    return FY5253(*args, variation="nearest", **kwds)


def makeFY5253LastOfMonth(*args, **kwds):
    return FY5253(*args, variation="last", **kwds)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 39 Column: 1

                  return FY5253(*args, variation="nearest", **kwds)


def makeFY5253LastOfMonth(*args, **kwds):
    return FY5253(*args, variation="last", **kwds)


def test_get_offset_name():
    assert (

            

Reported by Pylint.

pandas/tests/scalar/interval/test_interval.py
109 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

from pandas import (
    Interval,
    Period,
    Timedelta,
    Timestamp,
)

            

Reported by Pylint.

Redefining name 'interval' from outer scope (line 15)
Error

Line: 20 Column: 31

              

class TestInterval:
    def test_properties(self, interval):
        assert interval.closed == "right"
        assert interval.left == 0
        assert interval.right == 1
        assert interval.mid == 0.5


            

Reported by Pylint.

Redefining name 'interval' from outer scope (line 15)
Error

Line: 26 Column: 25

                      assert interval.right == 1
        assert interval.mid == 0.5

    def test_repr(self, interval):
        assert repr(interval) == "Interval(0, 1, closed='right')"
        assert str(interval) == "(0, 1]"

        interval_left = Interval(0, 1, closed="left")
        assert repr(interval_left) == "Interval(0, 1, closed='left')"

            

Reported by Pylint.

Redefining name 'interval' from outer scope (line 15)
Error

Line: 34 Column: 29

                      assert repr(interval_left) == "Interval(0, 1, closed='left')"
        assert str(interval_left) == "[0, 1)"

    def test_contains(self, interval):
        assert 0.5 in interval
        assert 1 in interval
        assert 0 not in interval

        msg = "__contains__ not defined for two intervals"

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 41 Column: 13

              
        msg = "__contains__ not defined for two intervals"
        with pytest.raises(TypeError, match=msg):
            interval in interval

        interval_both = Interval(0, 1, closed="both")
        assert 0 in interval_both
        assert 1 in interval_both


            

Reported by Pylint.

Expression "Interval(0, 1) < 2" is assigned to nothing
Error

Line: 63 Column: 13

                          "'pandas._libs.interval.Interval' and 'int'"
        )
        with pytest.raises(TypeError, match=msg):
            Interval(0, 1) < 2

        assert Interval(0, 1) < Interval(1, 2)
        assert Interval(0, 1) < Interval(0, 2)
        assert Interval(0, 1) < Interval(0.5, 1.5)
        assert Interval(0, 1) <= Interval(0, 1)

            

Reported by Pylint.

Redefining name 'interval' from outer scope (line 15)
Error

Line: 72 Column: 25

                      assert Interval(0, 1) > Interval(-1, 2)
        assert Interval(0, 1) >= Interval(0, 1)

    def test_hash(self, interval):
        # should not raise
        hash(interval)

    @pytest.mark.parametrize(
        "left, right, expected",

            

Reported by Pylint.

Redefining name 'interval' from outer scope (line 15)
Error

Line: 155 Column: 9

                          Interval(left, right)

    def test_math_add(self, closed):
        interval = Interval(0, 1, closed=closed)
        expected = Interval(1, 2, closed=closed)

        result = interval + 1
        assert result == expected


            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 170 Column: 13

              
        msg = r"unsupported operand type\(s\) for \+"
        with pytest.raises(TypeError, match=msg):
            interval + interval

        with pytest.raises(TypeError, match=msg):
            interval + "foo"

    def test_math_sub(self, closed):

            

Reported by Pylint.

Statement seems to have no effect
Error

Line: 173 Column: 13

                          interval + interval

        with pytest.raises(TypeError, match=msg):
            interval + "foo"

    def test_math_sub(self, closed):
        interval = Interval(0, 1, closed=closed)
        expected = Interval(-1, 0, closed=closed)


            

Reported by Pylint.

pandas/tests/indexes/datetimelike_/test_equals.py
109 issues
Unable to import 'pytest'
Error

Line: 10 Column: 1

              )

import numpy as np
import pytest

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

            

Reported by Pylint.

TODO: de-duplicate with other test_equals2 methods
Error

Line: 57 Column: 3

                  def index(self):
        return period_range("2013-01-01", periods=5, freq="D")

    # TODO: de-duplicate with other test_equals2 methods
    @pytest.mark.parametrize("freq", ["D", "M"])
    def test_equals2(self, freq):
        # GH#13107
        idx = PeriodIndex(["2011-01-01", "2011-01-02", "NaT"], freq=freq)
        assert idx.equals(idx)

            

Reported by Pylint.

Access to a protected member _simple_new of a client class
Error

Line: 79 Column: 16

                      assert not idx.equals(pd.Series(idx2))

        # same internal, different tz
        idx3 = PeriodIndex._simple_new(
            idx._values._simple_new(idx._values.asi8, freq="H")
        )
        tm.assert_numpy_array_equal(idx.asi8, idx3.asi8)
        assert not idx.equals(idx3)
        assert not idx.equals(idx3.copy())

            

Reported by Pylint.

Access to a protected member _simple_new of a client class
Error

Line: 80 Column: 13

              
        # same internal, different tz
        idx3 = PeriodIndex._simple_new(
            idx._values._simple_new(idx._values.asi8, freq="H")
        )
        tm.assert_numpy_array_equal(idx.asi8, idx3.asi8)
        assert not idx.equals(idx3)
        assert not idx.equals(idx3.copy())
        assert not idx.equals(idx3.astype(object))

            

Reported by Pylint.

Access to a protected member _values of a client class
Error

Line: 80 Column: 37

              
        # same internal, different tz
        idx3 = PeriodIndex._simple_new(
            idx._values._simple_new(idx._values.asi8, freq="H")
        )
        tm.assert_numpy_array_equal(idx.asi8, idx3.asi8)
        assert not idx.equals(idx3)
        assert not idx.equals(idx3.copy())
        assert not idx.equals(idx3.astype(object))

            

Reported by Pylint.

Access to a protected member _values of a client class
Error

Line: 80 Column: 13

              
        # same internal, different tz
        idx3 = PeriodIndex._simple_new(
            idx._values._simple_new(idx._values.asi8, freq="H")
        )
        tm.assert_numpy_array_equal(idx.asi8, idx3.asi8)
        assert not idx.equals(idx3)
        assert not idx.equals(idx3.copy())
        assert not idx.equals(idx3.astype(object))

            

Reported by Pylint.

FIXME: oob.apply(np.timedelta64) incorrectly overflows
Error

Line: 174 Column: 3

                      assert not idx.equals(oob)
        assert not idx2.equals(oob)

        # FIXME: oob.apply(np.timedelta64) incorrectly overflows
        oob2 = Index([np.timedelta64(x) for x in oob], dtype=object)
        assert not idx.equals(oob2)
        assert not idx2.equals(oob2)

            

Reported by Pylint.

Missing class docstring
Error

Line: 25 Column: 1

              import pandas._testing as tm


class EqualsTests:
    def test_not_equals_numeric(self, index):

        assert not index.equals(Index(index.asi8))
        assert not index.equals(Index(index.asi8.astype("u8")))
        assert not index.equals(Index(index.asi8).astype("f8"))

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 26 Column: 5

              

class EqualsTests:
    def test_not_equals_numeric(self, index):

        assert not index.equals(Index(index.asi8))
        assert not index.equals(Index(index.asi8.astype("u8")))
        assert not index.equals(Index(index.asi8).astype("f8"))


            

Reported by Pylint.

Method could be a function
Error

Line: 26 Column: 5

              

class EqualsTests:
    def test_not_equals_numeric(self, index):

        assert not index.equals(Index(index.asi8))
        assert not index.equals(Index(index.asi8.astype("u8")))
        assert not index.equals(Index(index.asi8).astype("f8"))


            

Reported by Pylint.