The following issues were found

pandas/io/formats/excel.py
54 issues
Unable to import 'pandas._libs.lib'
Error

Line: 21 Column: 1

              
import numpy as np

from pandas._libs.lib import is_list_like
from pandas._typing import (
    IndexLabel,
    StorageOptions,
)
from pandas.util._decorators import doc

            

Reported by Pylint.

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

Line: 21 Column: 1

              
import numpy as np

from pandas._libs.lib import is_list_like
from pandas._typing import (
    IndexLabel,
    StorageOptions,
)
from pandas.util._decorators import doc

            

Reported by Pylint.

Abstract class 'ExcelWriter' with abstract methods instantiated
Error

Line: 834 Column: 22

                      else:
            # error: Cannot instantiate abstract class 'ExcelWriter' with abstract
            # attributes 'engine', 'save', 'supported_extensions' and 'write_cells'
            writer = ExcelWriter(  # type: ignore[abstract]
                writer, engine=engine, storage_options=storage_options
            )
            need_save = True

        try:

            

Reported by Pylint.

TODO: memoize?
Error

Line: 162 Column: 3

                          A style as interpreted by ExcelWriter when found in
            ExcelCell.style.
        """
        # TODO: memoize?
        properties = self.compute_css(declarations_str, self.inherited)
        return self.build_xlstyle(properties)

    def build_xlstyle(self, props: Mapping[str, str]) -> dict[str, dict[str, str]]:
        out = {

            

Reported by Pylint.

TODO: handle cell width and height: needs support in pandas.io.excel
Error

Line: 175 Column: 3

                          "number_format": self.build_number_format(props),
        }

        # TODO: handle cell width and height: needs support in pandas.io.excel

        def remove_none(d: dict[str, str]) -> None:
            """Remove key where value is None, through nested dicts"""
            for k, v in list(d.items()):
                if v is None:

            

Reported by Pylint.

TODO: text-indent, padding-left -> alignment.indent
Error

Line: 191 Column: 3

                      return out

    def build_alignment(self, props: Mapping[str, str]) -> dict[str, bool | str | None]:
        # TODO: text-indent, padding-left -> alignment.indent
        return {
            "horizontal": props.get("text-align"),
            "vertical": self._get_vertical_alignment(props),
            "wrap_text": self._get_is_wrap_text(props),
        }

            

Reported by Pylint.

TODO: perhaps allow for special properties
Error

Line: 282 Column: 3

                      return float(pt_string.rstrip("pt"))

    def build_fill(self, props: Mapping[str, str]):
        # TODO: perhaps allow for special properties
        #       -excel-pattern-bgcolor and -excel-pattern-type
        fill_color = props.get("background-color")
        if fill_color not in (None, "transparent", "none"):
            return {"fgColor": self.color_to_excel(fill_color), "patternType": "solid"}


            

Reported by Pylint.

FIXME: dont leave commented-out
Error

Line: 307 Column: 3

                          "color": self.color_to_excel(props.get("color")),
            # shadow if nonzero digit before shadow color
            "shadow": self._get_shadow(props),
            # FIXME: dont leave commented-out
            # 'vertAlign':,
            # 'charset': ,
            # 'scheme': ,
            # 'outline': ,
            # 'condense': ,

            

Reported by Pylint.

Access to a protected member _can_hold_na of a client class
Error

Line: 719 Column: 36

              
                    values = levels.take(
                        level_codes,
                        allow_fill=levels._can_hold_na,
                        fill_value=levels._na_value,
                    )

                    for i, span_val in spans.items():
                        spans_multiple_cells = span_val > 1

            

Reported by Pylint.

Access to a protected member _na_value of a client class
Error

Line: 720 Column: 36

                                  values = levels.take(
                        level_codes,
                        allow_fill=levels._can_hold_na,
                        fill_value=levels._na_value,
                    )

                    for i, span_val in spans.items():
                        spans_multiple_cells = span_val > 1
                        yield ExcelCell(

            

Reported by Pylint.

pandas/_config/config.py
54 issues
Attribute 'undo' defined outside __init__
Error

Line: 413 Column: 9

                      self.ops = list(zip(args[::2], args[1::2]))

    def __enter__(self):
        self.undo = [(pat, _get_option(pat, silent=True)) for pat, val in self.ops]

        for pat, val in self.ops:
            _set_option(pat, val, silent=True)

    def __exit__(self, *args):

            

Reported by Pylint.

Global variable 'register_option' undefined at the module level
Error

Line: 735 Column: 5

                  # Note: reset_option relies on set_option, and on key directly
    # it does not fit in to this monkey-patching scheme

    global register_option, get_option, set_option, reset_option

    def wrap(func: F) -> F:
        def inner(key: str, *args, **kwds):
            pkey = f"{prefix}.{key}"
            return func(pkey, *args, **kwds)

            

Reported by Pylint.

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

Line: 135 Column: 12

                      kwarg = list(kwargs.keys())[0]
        raise TypeError(f'_set_option() got an unexpected keyword argument "{kwarg}"')

    for k, v in zip(args[::2], args[1::2]):
        key = _get_single_key(k, silent)

        o = _get_registered_option(key)
        if o and o.validator:
            o.validator(v)

            

Reported by Pylint.

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

Line: 138 Column: 9

                  for k, v in zip(args[::2], args[1::2]):
        key = _get_single_key(k, silent)

        o = _get_registered_option(key)
        if o and o.validator:
            o.validator(v)

        # walk the nested dict
        root, k = _get_root(key)

            

Reported by Pylint.

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

Line: 154 Column: 1

                              o.cb(key)


def _describe_option(pat: str = "", _print_desc: bool = True):

    keys = _select_options(pat)
    if len(keys) == 0:
        raise OptionError("No such keys(s)")


            

Reported by Pylint.

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

Line: 160 Column: 5

                  if len(keys) == 0:
        raise OptionError("No such keys(s)")

    s = "\n".join([_build_option_description(k) for k in keys])

    if _print_desc:
        print(s)
    else:
        return s

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 186 Column: 1

                      _set_option(k, _registered_options[k].defval, silent=silent)


def get_default_val(pat: str):
    key = _get_single_key(pat, silent=True)
    return _get_registered_option(key).defval


class DictWrapper:

            

Reported by Pylint.

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

Line: 216 Column: 13

                          prefix += "."
        prefix += key
        try:
            v = object.__getattribute__(self, "d")[key]
        except KeyError as err:
            raise OptionError("No such option") from err
        if isinstance(v, dict):
            return DictWrapper(v, prefix)
        else:

            

Reported by Pylint.

Unnecessary "else" after "return"
Error

Line: 219 Column: 9

                          v = object.__getattribute__(self, "d")[key]
        except KeyError as err:
            raise OptionError("No such option") from err
        if isinstance(v, dict):
            return DictWrapper(v, prefix)
        else:
            return _get_option(prefix)

    def __dir__(self) -> Iterable[str]:

            

Reported by Pylint.

Missing class docstring
Error

Line: 237 Column: 1

              # of options, and option descriptions.


class CallableDynamicDoc:
    def __init__(self, func, doc_tmpl):
        self.__doc_tmpl__ = doc_tmpl
        self.__func__ = func

    def __call__(self, *args, **kwds):

            

Reported by Pylint.

pandas/core/window/ewm.py
53 issues
Unable to import 'pandas._libs.window.aggregations'
Error

Line: 12 Column: 1

              import numpy as np

from pandas._libs.tslibs import Timedelta
import pandas._libs.window.aggregations as window_aggregations
from pandas._typing import (
    Axis,
    FrameOrSeries,
    TimedeltaConvertibleTypes,
)

            

Reported by Pylint.

No name 'aggregations' in module 'pandas._libs.window'
Error

Line: 12 Column: 1

              import numpy as np

from pandas._libs.tslibs import Timedelta
import pandas._libs.window.aggregations as window_aggregations
from pandas._typing import (
    Axis,
    FrameOrSeries,
    TimedeltaConvertibleTypes,
)

            

Reported by Pylint.

Method '_selected_obj' has no 'ndim' member
Error

Line: 855 Column: 28

                      1  0.75  5.75
        """
        result_kwargs = {}
        is_frame = True if self._selected_obj.ndim == 2 else False
        if update_times is not None:
            raise NotImplementedError("update_times is not implemented.")
        else:
            update_deltas = np.ones(
                max(self._selected_obj.shape[self.axis - 1] - 1, 0), dtype=np.float64

            

Reported by Pylint.

Method '_selected_obj' has no 'shape' member
Error

Line: 860 Column: 21

                          raise NotImplementedError("update_times is not implemented.")
        else:
            update_deltas = np.ones(
                max(self._selected_obj.shape[self.axis - 1] - 1, 0), dtype=np.float64
            )
        if update is not None:
            if self._mean.last_ewm is None:
                raise ValueError(
                    "Must call mean with update=None first before passing update"

            

Reported by Pylint.

Method '_selected_obj' has no 'index' member
Error

Line: 878 Column: 38

                          np_array = np.concatenate((last_value, update.to_numpy()))
        else:
            result_from = 0
            result_kwargs["index"] = self._selected_obj.index
            if is_frame:
                result_kwargs["columns"] = self._selected_obj.columns
            else:
                result_kwargs["name"] = self._selected_obj.name
            np_array = self._selected_obj.astype(np.float64).to_numpy()

            

Reported by Pylint.

Method '_selected_obj' has no 'columns' member
Error

Line: 880 Column: 44

                          result_from = 0
            result_kwargs["index"] = self._selected_obj.index
            if is_frame:
                result_kwargs["columns"] = self._selected_obj.columns
            else:
                result_kwargs["name"] = self._selected_obj.name
            np_array = self._selected_obj.astype(np.float64).to_numpy()
        ewma_func = generate_online_numba_ewma_func(self.engine_kwargs)
        result = self._mean.run_ewm(

            

Reported by Pylint.

Method '_selected_obj' has no 'name' member
Error

Line: 882 Column: 41

                          if is_frame:
                result_kwargs["columns"] = self._selected_obj.columns
            else:
                result_kwargs["name"] = self._selected_obj.name
            np_array = self._selected_obj.astype(np.float64).to_numpy()
        ewma_func = generate_online_numba_ewma_func(self.engine_kwargs)
        result = self._mean.run_ewm(
            np_array if is_frame else np_array[:, np.newaxis],
            update_deltas,

            

Reported by Pylint.

Method '_selected_obj' has no 'astype' member
Error

Line: 883 Column: 24

                              result_kwargs["columns"] = self._selected_obj.columns
            else:
                result_kwargs["name"] = self._selected_obj.name
            np_array = self._selected_obj.astype(np.float64).to_numpy()
        ewma_func = generate_online_numba_ewma_func(self.engine_kwargs)
        result = self._mean.run_ewm(
            np_array if is_frame else np_array[:, np.newaxis],
            update_deltas,
            self.min_periods,

            

Reported by Pylint.

Method '_selected_obj' has no '_constructor' member
Error

Line: 894 Column: 18

                      if not is_frame:
            result = result.squeeze()
        result = result[result_from:]
        result = self._selected_obj._constructor(result, **result_kwargs)
        return result

            

Reported by Pylint.

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

Line: 508 Column: 5

                      window_method="ewm",
        aggregation_description="(exponential weighted moment) standard deviation",
        agg_method="std",
    )
    def std(self, bias: bool = False, *args, **kwargs):
        nv.validate_window_func("std", args, kwargs)
        return zsqrt(self.var(bias=bias, **kwargs))

    def vol(self, bias: bool = False, *args, **kwargs):

            

Reported by Pylint.

asv_bench/benchmarks/io/hdf.py
53 issues
Unable to import 'pandas'
Error

Line: 3 Column: 1

              import numpy as np

from pandas import (
    DataFrame,
    HDFStore,
    date_range,
    read_hdf,
)


            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 10 Column: 1

                  read_hdf,
)

from ..pandas_vb_common import (
    BaseIO,
    tm,
)



            

Reported by Pylint.

Attempted relative import beyond top-level package
Error

Line: 138 Column: 1

                      self.df.to_hdf(self.fname, "df", format=format)


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

            

Reported by Pylint.

Attribute 'df' defined outside __init__
Error

Line: 20 Column: 9

                  def setup(self):
        N = 25000
        index = tm.makeStringIndex(N)
        self.df = DataFrame(
            {"float1": np.random.randn(N), "float2": np.random.randn(N)}, index=index
        )
        self.df_mixed = DataFrame(
            {
                "float1": np.random.randn(N),

            

Reported by Pylint.

Attribute 'df_mixed' defined outside __init__
Error

Line: 23 Column: 9

                      self.df = DataFrame(
            {"float1": np.random.randn(N), "float2": np.random.randn(N)}, index=index
        )
        self.df_mixed = DataFrame(
            {
                "float1": np.random.randn(N),
                "float2": np.random.randn(N),
                "string1": ["foo"] * N,
                "bool1": [True] * N,

            

Reported by Pylint.

Attribute 'df_wide' defined outside __init__
Error

Line: 33 Column: 9

                          },
            index=index,
        )
        self.df_wide = DataFrame(np.random.randn(N, 100))
        self.start_wide = self.df_wide.index[10000]
        self.stop_wide = self.df_wide.index[15000]
        self.df2 = DataFrame(
            {"float1": np.random.randn(N), "float2": np.random.randn(N)},
            index=date_range("1/1/2000", periods=N),

            

Reported by Pylint.

Attribute 'start_wide' defined outside __init__
Error

Line: 34 Column: 9

                          index=index,
        )
        self.df_wide = DataFrame(np.random.randn(N, 100))
        self.start_wide = self.df_wide.index[10000]
        self.stop_wide = self.df_wide.index[15000]
        self.df2 = DataFrame(
            {"float1": np.random.randn(N), "float2": np.random.randn(N)},
            index=date_range("1/1/2000", periods=N),
        )

            

Reported by Pylint.

Attribute 'stop_wide' defined outside __init__
Error

Line: 35 Column: 9

                      )
        self.df_wide = DataFrame(np.random.randn(N, 100))
        self.start_wide = self.df_wide.index[10000]
        self.stop_wide = self.df_wide.index[15000]
        self.df2 = DataFrame(
            {"float1": np.random.randn(N), "float2": np.random.randn(N)},
            index=date_range("1/1/2000", periods=N),
        )
        self.start = self.df2.index[10000]

            

Reported by Pylint.

Attribute 'df2' defined outside __init__
Error

Line: 36 Column: 9

                      self.df_wide = DataFrame(np.random.randn(N, 100))
        self.start_wide = self.df_wide.index[10000]
        self.stop_wide = self.df_wide.index[15000]
        self.df2 = DataFrame(
            {"float1": np.random.randn(N), "float2": np.random.randn(N)},
            index=date_range("1/1/2000", periods=N),
        )
        self.start = self.df2.index[10000]
        self.stop = self.df2.index[15000]

            

Reported by Pylint.

Attribute 'start' defined outside __init__
Error

Line: 40 Column: 9

                          {"float1": np.random.randn(N), "float2": np.random.randn(N)},
            index=date_range("1/1/2000", periods=N),
        )
        self.start = self.df2.index[10000]
        self.stop = self.df2.index[15000]
        self.df_wide2 = DataFrame(
            np.random.randn(N, 100), index=date_range("1/1/2000", periods=N)
        )
        self.df_dc = DataFrame(

            

Reported by Pylint.

pandas/tests/dtypes/cast/test_infer_dtype.py
53 issues
Unable to import 'pytest'
Error

Line: 8 Column: 1

              )

import numpy as np
import pytest

from pandas.core.dtypes.cast import (
    infer_dtype_from,
    infer_dtype_from_array,
    infer_dtype_from_scalar,

            

Reported by Pylint.

Unused variable 'val'
Error

Line: 37 Column: 12

                  # Test that infer_dtype_from_scalar is
    # returning correct dtype for int and float.
    data = np.dtype(any_int_numpy_dtype).type(12)
    dtype, val = infer_dtype_from_scalar(data)
    assert dtype == type(data)


def test_infer_dtype_from_float_scalar(float_numpy_dtype):
    float_numpy_dtype = np.dtype(float_numpy_dtype).type

            

Reported by Pylint.

Unused variable 'val'
Error

Line: 45 Column: 12

                  float_numpy_dtype = np.dtype(float_numpy_dtype).type
    data = float_numpy_dtype(12)

    dtype, val = infer_dtype_from_scalar(data)
    assert dtype == float_numpy_dtype


@pytest.mark.parametrize(
    "data,exp_dtype", [(12, np.int64), (np.float_(12), np.float64)]

            

Reported by Pylint.

Unused variable 'val'
Error

Line: 53 Column: 12

                  "data,exp_dtype", [(12, np.int64), (np.float_(12), np.float64)]
)
def test_infer_dtype_from_python_scalar(data, exp_dtype):
    dtype, val = infer_dtype_from_scalar(data)
    assert dtype == exp_dtype


@pytest.mark.parametrize("bool_val", [True, False])
def test_infer_dtype_from_boolean(bool_val):

            

Reported by Pylint.

Unused variable 'val'
Error

Line: 59 Column: 12

              
@pytest.mark.parametrize("bool_val", [True, False])
def test_infer_dtype_from_boolean(bool_val):
    dtype, val = infer_dtype_from_scalar(bool_val)
    assert dtype == np.bool_


def test_infer_dtype_from_complex(complex_dtype):
    data = np.dtype(complex_dtype).type(1)

            

Reported by Pylint.

Unused variable 'val'
Error

Line: 65 Column: 12

              
def test_infer_dtype_from_complex(complex_dtype):
    data = np.dtype(complex_dtype).type(1)
    dtype, val = infer_dtype_from_scalar(data)
    assert dtype == np.complex_


@pytest.mark.parametrize(
    "data", [np.datetime64(1, "ns"), Timestamp(1), datetime(2000, 1, 1, 0, 0)]

            

Reported by Pylint.

Unused variable 'val'
Error

Line: 73 Column: 12

                  "data", [np.datetime64(1, "ns"), Timestamp(1), datetime(2000, 1, 1, 0, 0)]
)
def test_infer_dtype_from_datetime(data):
    dtype, val = infer_dtype_from_scalar(data)
    assert dtype == "M8[ns]"


@pytest.mark.parametrize("data", [np.timedelta64(1, "ns"), Timedelta(1), timedelta(1)])
def test_infer_dtype_from_timedelta(data):

            

Reported by Pylint.

Unused variable 'val'
Error

Line: 79 Column: 12

              
@pytest.mark.parametrize("data", [np.timedelta64(1, "ns"), Timedelta(1), timedelta(1)])
def test_infer_dtype_from_timedelta(data):
    dtype, val = infer_dtype_from_scalar(data)
    assert dtype == "m8[ns]"


@pytest.mark.parametrize("freq", ["M", "D"])
def test_infer_dtype_from_period(freq, pandas_dtype):

            

Reported by Pylint.

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

Line: 84 Column: 40

              

@pytest.mark.parametrize("freq", ["M", "D"])
def test_infer_dtype_from_period(freq, pandas_dtype):
    p = Period("2011-01-01", freq=freq)
    dtype, val = infer_dtype_from_scalar(p, pandas_dtype=pandas_dtype)

    if pandas_dtype:
        exp_dtype = f"period[{freq}]"

            

Reported by Pylint.

Unused variable 'val'
Error

Line: 101 Column: 12

                  "data", [date(2000, 1, 1), "foo", Timestamp(1, tz="US/Eastern")]
)
def test_infer_dtype_misc(data):
    dtype, val = infer_dtype_from_scalar(data)
    assert dtype == np.object_


@pytest.mark.parametrize("tz", ["UTC", "US/Eastern", "Asia/Tokyo"])
def test_infer_from_scalar_tz(tz, pandas_dtype):

            

Reported by Pylint.

pandas/tests/strings/test_case_justify.py
53 issues
Unable to import 'pytest'
Error

Line: 5 Column: 1

              import operator

import numpy as np
import pytest

from pandas import (
    Series,
    _testing as tm,
)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from datetime import datetime
import operator

import numpy as np
import pytest

from pandas import (
    Series,
    _testing as tm,

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

              )


def test_title(any_string_dtype):
    s = Series(["FOO", "BAR", np.nan, "Blah", "blurg"], dtype=any_string_dtype)
    result = s.str.title()
    expected = Series(["Foo", "Bar", np.nan, "Blah", "Blurg"], dtype=any_string_dtype)
    tm.assert_series_equal(result, expected)


            

Reported by Pylint.

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

Line: 14 Column: 5

              

def test_title(any_string_dtype):
    s = Series(["FOO", "BAR", np.nan, "Blah", "blurg"], dtype=any_string_dtype)
    result = s.str.title()
    expected = Series(["Foo", "Bar", np.nan, "Blah", "Blurg"], dtype=any_string_dtype)
    tm.assert_series_equal(result, expected)



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 20 Column: 1

                  tm.assert_series_equal(result, expected)


def test_title_mixed_object():
    s = Series(["FOO", np.nan, "bar", True, datetime.today(), "blah", None, 1, 2.0])
    result = s.str.title()
    expected = Series(
        ["Foo", np.nan, "Bar", np.nan, np.nan, "Blah", np.nan, np.nan, np.nan]
    )

            

Reported by Pylint.

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

Line: 21 Column: 5

              

def test_title_mixed_object():
    s = Series(["FOO", np.nan, "bar", True, datetime.today(), "blah", None, 1, 2.0])
    result = s.str.title()
    expected = Series(
        ["Foo", np.nan, "Bar", np.nan, np.nan, "Blah", np.nan, np.nan, np.nan]
    )
    tm.assert_almost_equal(result, expected)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 29 Column: 1

                  tm.assert_almost_equal(result, expected)


def test_lower_upper(any_string_dtype):
    s = Series(["om", np.nan, "nom", "nom"], dtype=any_string_dtype)

    result = s.str.upper()
    expected = Series(["OM", np.nan, "NOM", "NOM"], dtype=any_string_dtype)
    tm.assert_series_equal(result, expected)

            

Reported by Pylint.

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

Line: 30 Column: 5

              

def test_lower_upper(any_string_dtype):
    s = Series(["om", np.nan, "nom", "nom"], dtype=any_string_dtype)

    result = s.str.upper()
    expected = Series(["OM", np.nan, "NOM", "NOM"], dtype=any_string_dtype)
    tm.assert_series_equal(result, expected)


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 40 Column: 1

                  tm.assert_series_equal(result, s)


def test_lower_upper_mixed_object():
    s = Series(["a", np.nan, "b", True, datetime.today(), "foo", None, 1, 2.0])

    result = s.str.upper()
    expected = Series(["A", np.nan, "B", np.nan, np.nan, "FOO", np.nan, np.nan, np.nan])
    tm.assert_series_equal(result, expected)

            

Reported by Pylint.

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

Line: 41 Column: 5

              

def test_lower_upper_mixed_object():
    s = Series(["a", np.nan, "b", True, datetime.today(), "foo", None, 1, 2.0])

    result = s.str.upper()
    expected = Series(["A", np.nan, "B", np.nan, np.nan, "FOO", np.nan, np.nan, np.nan])
    tm.assert_series_equal(result, expected)


            

Reported by Pylint.

pandas/tests/arrays/boolean/test_logical.py
53 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              import operator

import numpy as np
import pytest

import pandas as pd
import pandas._testing as tm
from pandas.arrays import BooleanArray
from pandas.tests.extension.base import BaseOpsUtil

            

Reported by Pylint.

FIXME: dont leave commented-out
Error

Line: 41 Column: 3

                      result = getattr(a, op_name)(False)
        tm.assert_extension_array_equal(a, result)

        # FIXME: dont leave commented-out
        # TODO: pd.NA
        # result = getattr(a, op_name)(pd.NA)
        # tm.assert_extension_array_equal(a, result)

    def test_logical_length_mismatch_raises(self, all_logical_operators):

            

Reported by Pylint.

TODO: pd.NA
Error

Line: 42 Column: 3

                      tm.assert_extension_array_equal(a, result)

        # FIXME: dont leave commented-out
        # TODO: pd.NA
        # result = getattr(a, op_name)(pd.NA)
        # tm.assert_extension_array_equal(a, result)

    def test_logical_length_mismatch_raises(self, all_logical_operators):
        op_name = all_logical_operators

            

Reported by Pylint.

TODO: test True & False
Error

Line: 106 Column: 3

                      ],
    )
    def test_kleene_or_scalar(self, other, expected):
        # TODO: test True & False
        a = pd.array([True, False, None], dtype="boolean")
        result = a | other
        expected = pd.array(expected, dtype="boolean")
        tm.assert_extension_array_equal(result, expected)


            

Reported by Pylint.

Access to a protected member _mask of a client class
Error

Line: 224 Column: 25

                      tm.assert_extension_array_equal(result, expected)

        if isinstance(other, BooleanArray):
            other._data[other._mask] = True
            a._data[a._mask] = False

            result = getattr(a, all_logical_operators)(other)
            expected = getattr(b, all_logical_operators)(other)
            tm.assert_extension_array_equal(result, expected)

            

Reported by Pylint.

Access to a protected member _data of a client class
Error

Line: 224 Column: 13

                      tm.assert_extension_array_equal(result, expected)

        if isinstance(other, BooleanArray):
            other._data[other._mask] = True
            a._data[a._mask] = False

            result = getattr(a, all_logical_operators)(other)
            expected = getattr(b, all_logical_operators)(other)
            tm.assert_extension_array_equal(result, expected)

            

Reported by Pylint.

Access to a protected member _mask of a client class
Error

Line: 225 Column: 21

              
        if isinstance(other, BooleanArray):
            other._data[other._mask] = True
            a._data[a._mask] = False

            result = getattr(a, all_logical_operators)(other)
            expected = getattr(b, all_logical_operators)(other)
            tm.assert_extension_array_equal(result, expected)

            

Reported by Pylint.

Access to a protected member _data of a client class
Error

Line: 225 Column: 13

              
        if isinstance(other, BooleanArray):
            other._data[other._mask] = True
            a._data[a._mask] = False

            result = getattr(a, all_logical_operators)(other)
            expected = getattr(b, all_logical_operators)(other)
            tm.assert_extension_array_equal(result, expected)

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import operator

import numpy as np
import pytest

import pandas as pd
import pandas._testing as tm
from pandas.arrays import BooleanArray
from pandas.tests.extension.base import BaseOpsUtil

            

Reported by Pylint.

Missing class docstring
Error

Line: 12 Column: 1

              from pandas.tests.extension.base import BaseOpsUtil


class TestLogicalOps(BaseOpsUtil):
    def test_numpy_scalars_ok(self, all_logical_operators):
        a = pd.array([True, False, None], dtype="boolean")
        op = getattr(a, all_logical_operators)

        tm.assert_extension_array_equal(op(True), op(np.bool_(True)))

            

Reported by Pylint.

pandas/tests/arrays/boolean/test_construction.py
53 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

import pandas as pd
import pandas._testing as tm
from pandas.arrays import BooleanArray
from pandas.core.arrays.boolean import coerce_to_array



            

Reported by Pylint.

Access to a protected member _data of a client class
Error

Line: 42 Column: 12

                  mask = np.array([False, False, False, True], dtype="bool")

    result = BooleanArray(values, mask)
    assert result._data is values
    assert result._mask is mask

    result = BooleanArray(values, mask, copy=True)
    assert result._data is not values
    assert result._mask is not mask

            

Reported by Pylint.

Access to a protected member _mask of a client class
Error

Line: 43 Column: 12

              
    result = BooleanArray(values, mask)
    assert result._data is values
    assert result._mask is mask

    result = BooleanArray(values, mask, copy=True)
    assert result._data is not values
    assert result._mask is not mask


            

Reported by Pylint.

Access to a protected member _data of a client class
Error

Line: 46 Column: 12

                  assert result._mask is mask

    result = BooleanArray(values, mask, copy=True)
    assert result._data is not values
    assert result._mask is not mask


def test_to_boolean_array():
    expected = BooleanArray(

            

Reported by Pylint.

Access to a protected member _mask of a client class
Error

Line: 47 Column: 12

              
    result = BooleanArray(values, mask, copy=True)
    assert result._data is not values
    assert result._mask is not mask


def test_to_boolean_array():
    expected = BooleanArray(
        np.array([True, False, True]), np.array([False, False, False])

            

Reported by Pylint.

TODO this is currently not public API
Error

Line: 155 Column: 3

              

def test_coerce_to_array():
    # TODO this is currently not public API
    values = np.array([True, False, True, False], dtype="bool")
    mask = np.array([False, False, False, True], dtype="bool")
    result = BooleanArray(*coerce_to_array(values, mask=mask))
    expected = BooleanArray(values, mask)
    tm.assert_extension_array_equal(result, expected)

            

Reported by Pylint.

Access to a protected member _data of a client class
Error

Line: 161 Column: 12

                  result = BooleanArray(*coerce_to_array(values, mask=mask))
    expected = BooleanArray(values, mask)
    tm.assert_extension_array_equal(result, expected)
    assert result._data is values
    assert result._mask is mask
    result = BooleanArray(*coerce_to_array(values, mask=mask, copy=True))
    expected = BooleanArray(values, mask)
    tm.assert_extension_array_equal(result, expected)
    assert result._data is not values

            

Reported by Pylint.

Access to a protected member _mask of a client class
Error

Line: 162 Column: 12

                  expected = BooleanArray(values, mask)
    tm.assert_extension_array_equal(result, expected)
    assert result._data is values
    assert result._mask is mask
    result = BooleanArray(*coerce_to_array(values, mask=mask, copy=True))
    expected = BooleanArray(values, mask)
    tm.assert_extension_array_equal(result, expected)
    assert result._data is not values
    assert result._mask is not mask

            

Reported by Pylint.

Access to a protected member _data of a client class
Error

Line: 166 Column: 12

                  result = BooleanArray(*coerce_to_array(values, mask=mask, copy=True))
    expected = BooleanArray(values, mask)
    tm.assert_extension_array_equal(result, expected)
    assert result._data is not values
    assert result._mask is not mask

    # mixed missing from values and mask
    values = [True, False, None, False]
    mask = np.array([False, False, False, True], dtype="bool")

            

Reported by Pylint.

Access to a protected member _mask of a client class
Error

Line: 167 Column: 12

                  expected = BooleanArray(values, mask)
    tm.assert_extension_array_equal(result, expected)
    assert result._data is not values
    assert result._mask is not mask

    # mixed missing from values and mask
    values = [True, False, None, False]
    mask = np.array([False, False, False, True], dtype="bool")
    result = BooleanArray(*coerce_to_array(values, mask=mask))

            

Reported by Pylint.

pandas/tests/series/methods/test_rank.py
53 issues
Unable to import 'pytest'
Error

Line: 7 Column: 1

              )

import numpy as np
import pytest

from pandas._libs.algos import (
    Infinity,
    NegInfinity,
)

            

Reported by Pylint.

Unable to import 'pandas._libs.algos'
Error

Line: 9 Column: 1

              import numpy as np
import pytest

from pandas._libs.algos import (
    Infinity,
    NegInfinity,
)
import pandas.util._test_decorators as td


            

Reported by Pylint.

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

Line: 9 Column: 1

              import numpy as np
import pytest

from pandas._libs.algos import (
    Infinity,
    NegInfinity,
)
import pandas.util._test_decorators as td


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from itertools import (
    chain,
    product,
)

import numpy as np
import pytest

from pandas._libs.algos import (

            

Reported by Pylint.

Missing class docstring
Error

Line: 25 Column: 1

              from pandas.api.types import CategoricalDtype


class TestSeriesRank:
    s = Series([1, 3, 4, 2, np.nan, 2, 1, 5, np.nan, 3])

    results = {
        "average": np.array([1.5, 5.5, 7.0, 3.5, np.nan, 3.5, 1.5, 8.0, np.nan, 5.5]),
        "min": np.array([1, 5, 7, 3, np.nan, 3, 1, 8, np.nan, 5]),

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 36 Column: 5

                      "dense": np.array([1, 3, 4, 2, np.nan, 2, 1, 5, np.nan, 3]),
    }

    def test_rank(self, datetime_series):
        pytest.importorskip("scipy.stats.special")
        rankdata = pytest.importorskip("scipy.stats.rankdata")

        datetime_series[::2] = np.nan
        datetime_series[:10][::3] = 4.0

            

Reported by Pylint.

Method could be a function
Error

Line: 36 Column: 5

                      "dense": np.array([1, 3, 4, 2, np.nan, 2, 1, 5, np.nan, 3]),
    }

    def test_rank(self, datetime_series):
        pytest.importorskip("scipy.stats.special")
        rankdata = pytest.importorskip("scipy.stats.rankdata")

        datetime_series[::2] = np.nan
        datetime_series[:10][::3] = 4.0

            

Reported by Pylint.

Too many statements (64/50)
Error

Line: 36 Column: 5

                      "dense": np.array([1, 3, 4, 2, np.nan, 2, 1, 5, np.nan, 3]),
    }

    def test_rank(self, datetime_series):
        pytest.importorskip("scipy.stats.special")
        rankdata = pytest.importorskip("scipy.stats.rankdata")

        datetime_series[::2] = np.nan
        datetime_series[:10][::3] = 4.0

            

Reported by Pylint.

Method could be a function
Error

Line: 124 Column: 5

                      iranks = iseries.rank()
        tm.assert_series_equal(iranks, exp)

    def test_rank_categorical(self):
        # GH issue #15420 rank incorrectly orders ordered categories

        # Test ascending/descending ranking for ordered categoricals
        exp = Series([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
        exp_desc = Series([6.0, 5.0, 4.0, 3.0, 2.0, 1.0])

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 124 Column: 5

                      iranks = iseries.rank()
        tm.assert_series_equal(iranks, exp)

    def test_rank_categorical(self):
        # GH issue #15420 rank incorrectly orders ordered categories

        # Test ascending/descending ranking for ordered categoricals
        exp = Series([1.0, 2.0, 3.0, 4.0, 5.0, 6.0])
        exp_desc = Series([6.0, 5.0, 4.0, 3.0, 2.0, 1.0])

            

Reported by Pylint.

pandas/tests/scalar/timestamp/test_rendering.py
53 issues
Unable to import 'pytest'
Error

Line: 3 Column: 1

              import pprint

import pytest
import pytz  # noqa  # a test below uses pytz but only inside a `eval` call

from pandas import Timestamp
import pandas._testing as tm



            

Reported by Pylint.

Unable to import 'pytz'
Error

Line: 4 Column: 1

              import pprint

import pytest
import pytz  # noqa  # a test below uses pytz but only inside a `eval` call

from pandas import Timestamp
import pandas._testing as tm



            

Reported by Pylint.

Unused import pytz
Error

Line: 4 Column: 1

              import pprint

import pytest
import pytz  # noqa  # a test below uses pytz but only inside a `eval` call

from pandas import Timestamp
import pandas._testing as tm



            

Reported by Pylint.

Use of eval
Error

Line: 31 Column: 29

                      assert date in repr(date_only)
        assert tz_repr not in repr(date_only)
        assert freq_repr not in repr(date_only)
        assert date_only == eval(repr(date_only))

        date_tz = Timestamp(date, tz=tz)
        assert date in repr(date_tz)
        assert tz_repr in repr(date_tz)
        assert freq_repr not in repr(date_tz)

            

Reported by Pylint.

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

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

                      assert date in repr(date_only)
        assert tz_repr not in repr(date_only)
        assert freq_repr not in repr(date_only)
        assert date_only == eval(repr(date_only))

        date_tz = Timestamp(date, tz=tz)
        assert date in repr(date_tz)
        assert tz_repr in repr(date_tz)
        assert freq_repr not in repr(date_tz)

            

Reported by Bandit.

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

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

                      assert date in repr(date_tz)
        assert tz_repr in repr(date_tz)
        assert freq_repr not in repr(date_tz)
        assert date_tz == eval(repr(date_tz))

        msg = "The 'freq' argument in Timestamp"
        with tm.assert_produces_warning(FutureWarning, match=msg):
            date_freq = Timestamp(date, freq=freq)
        assert date in repr(date_freq)

            

Reported by Bandit.

Use of eval
Error

Line: 37 Column: 27

                      assert date in repr(date_tz)
        assert tz_repr in repr(date_tz)
        assert freq_repr not in repr(date_tz)
        assert date_tz == eval(repr(date_tz))

        msg = "The 'freq' argument in Timestamp"
        with tm.assert_produces_warning(FutureWarning, match=msg):
            date_freq = Timestamp(date, freq=freq)
        assert date in repr(date_freq)

            

Reported by Pylint.

Use of eval
Error

Line: 48 Column: 33

                      with tm.assert_produces_warning(
            FutureWarning, match=msg, check_stacklevel=False
        ):
            assert date_freq == eval(repr(date_freq))

        with tm.assert_produces_warning(FutureWarning, match=msg):
            date_tz_freq = Timestamp(date, tz=tz, freq=freq)
        assert date in repr(date_tz_freq)
        assert tz_repr in repr(date_tz_freq)

            

Reported by Pylint.

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

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

                      with tm.assert_produces_warning(
            FutureWarning, match=msg, check_stacklevel=False
        ):
            assert date_freq == eval(repr(date_freq))

        with tm.assert_produces_warning(FutureWarning, match=msg):
            date_tz_freq = Timestamp(date, tz=tz, freq=freq)
        assert date in repr(date_tz_freq)
        assert tz_repr in repr(date_tz_freq)

            

Reported by Bandit.

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

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

                      with tm.assert_produces_warning(
            FutureWarning, match=msg, check_stacklevel=False
        ):
            assert date_tz_freq == eval(repr(date_tz_freq))

    def test_repr_utcoffset(self):
        # This can cause the tz field to be populated, but it's redundant to
        # include this information in the date-string.
        date_with_utc_offset = Timestamp("2014-03-13 00:00:00-0400", tz=None)

            

Reported by Bandit.