The following issues were found

pandas/plotting/_matplotlib/compat.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              # being a bit too dynamic
import operator

from pandas.util.version import Version


def _mpl_version(version, op):
    def inner():
        try:

            

Reported by Pylint.

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

Line: 7 Column: 1

              from pandas.util.version import Version


def _mpl_version(version, op):
    def inner():
        try:
            import matplotlib as mpl
        except ImportError:
            return False

            

Reported by Pylint.

Import outside toplevel (matplotlib)
Error

Line: 10 Column: 13

              def _mpl_version(version, op):
    def inner():
        try:
            import matplotlib as mpl
        except ImportError:
            return False
        return (
            op(Version(mpl.__version__), Version(version))
            and str(mpl.__version__)[0] != "0"

            

Reported by Pylint.

pandas/core/ops/methods.py
3 issues
TODO: make these non-runtime imports once the relevant functions
Error

Line: 28 Column: 3

                  arith_flex : function or None
    comp_flex : function or None
    """
    # TODO: make these non-runtime imports once the relevant functions
    #  are no longer in __init__
    from pandas.core.ops import (
        flex_arith_method_FRAME,
        flex_comp_method_FRAME,
        flex_method_SERIES,

            

Reported by Pylint.

Import outside toplevel (pandas.core.ops.flex_arith_method_FRAME, pandas.core.ops.flex_comp_method_FRAME, pandas.core.ops.flex_method_SERIES)
Error

Line: 30 Column: 5

                  """
    # TODO: make these non-runtime imports once the relevant functions
    #  are no longer in __init__
    from pandas.core.ops import (
        flex_arith_method_FRAME,
        flex_comp_method_FRAME,
        flex_method_SERIES,
    )


            

Reported by Pylint.

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

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

                      }
    )
    # opt out of bool flex methods for now
    assert not any(kname in new_methods for kname in ("ror_", "rxor", "rand_"))

    _add_methods(cls, new_methods=new_methods)


def _create_methods(cls, arith_method, comp_method):

            

Reported by Bandit.

pandas/core/computation/api.py
3 issues
Redefining built-in 'eval'
Error

Line: 3 Column: 1

              # flake8: noqa

from pandas.core.computation.eval import eval

            

Reported by Pylint.

Unused eval imported from pandas.core.computation.eval
Error

Line: 3 Column: 1

              # flake8: noqa

from pandas.core.computation.eval import eval

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              # flake8: noqa

from pandas.core.computation.eval import eval

            

Reported by Pylint.

pandas/tests/arrays/floating/test_concat.py
3 issues
Unable to import 'pytest'
Error

Line: 1 Column: 1

              import pytest

import pandas as pd
import pandas._testing as tm


@pytest.mark.parametrize(
    "to_concat_dtypes, result_dtype",
    [

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import pytest

import pandas as pd
import pandas._testing as tm


@pytest.mark.parametrize(
    "to_concat_dtypes, result_dtype",
    [

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

                      (["Float64", "Float64"], "Float64"),
        (["Float32", "Float64"], "Float64"),
        (["Float32", "Float32"], "Float32"),
    ],
)
def test_concat_series(to_concat_dtypes, result_dtype):

    result = pd.concat([pd.Series([1, 2, pd.NA], dtype=t) for t in to_concat_dtypes])
    expected = pd.concat([pd.Series([1, 2, pd.NA], dtype=object)] * 2).astype(

            

Reported by Pylint.

pandas/tests/arrays/integer/test_indexing.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              import pandas as pd
import pandas._testing as tm


def test_array_setitem_nullable_boolean_mask():
    # GH 31446
    ser = pd.Series([1, 2], dtype="Int64")
    result = ser.where(ser > 1)
    expected = pd.Series([pd.NA, 2], dtype="Int64")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 1

              import pandas._testing as tm


def test_array_setitem_nullable_boolean_mask():
    # GH 31446
    ser = pd.Series([1, 2], dtype="Int64")
    result = ser.where(ser > 1)
    expected = pd.Series([pd.NA, 2], dtype="Int64")
    tm.assert_series_equal(result, expected)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 13 Column: 1

                  tm.assert_series_equal(result, expected)


def test_array_setitem():
    # GH 31446
    arr = pd.Series([1, 2], dtype="Int64").array
    arr[arr > 1] = 1

    expected = pd.array([1, 1], dtype="Int64")

            

Reported by Pylint.

pandas/tests/apply/conftest.py
3 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

from pandas import DataFrame


@pytest.fixture
def int_frame_const_col():
    """

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest

from pandas import DataFrame


@pytest.fixture
def int_frame_const_col():
    """

            

Reported by Pylint.

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

Line: 14 Column: 5

              
    Columns are ['A', 'B', 'C'], with values (per column): [1, 2, 3]
    """
    df = DataFrame(
        np.tile(np.arange(3, dtype="int64"), 6).reshape(6, -1) + 1,
        columns=["A", "B", "C"],
    )
    return df

            

Reported by Pylint.

pandas/compat/numpy/__init__.py
3 issues
third party import "from pandas.util.version import Version" should be placed before "import numpy as np"
Error

Line: 7 Column: 1

              
import numpy as np

from pandas.util.version import Version

# numpy versioning
_np_version = np.__version__
_nlv = Version(_np_version)
np_version_under1p19 = _nlv < Version("1.19")

            

Reported by Pylint.

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

Line: 10 Column: 1

              from pandas.util.version import Version

# numpy versioning
_np_version = np.__version__
_nlv = Version(_np_version)
np_version_under1p19 = _nlv < Version("1.19")
np_version_under1p20 = _nlv < Version("1.20")
is_numpy_dev = _nlv.dev is not None
_min_numpy_ver = "1.18.5"

            

Reported by Pylint.

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

Line: 15 Column: 1

              np_version_under1p19 = _nlv < Version("1.19")
np_version_under1p20 = _nlv < Version("1.20")
is_numpy_dev = _nlv.dev is not None
_min_numpy_ver = "1.18.5"


if _nlv < Version(_min_numpy_ver):
    raise ImportError(
        f"this version of pandas is incompatible with numpy < {_min_numpy_ver}\n"

            

Reported by Pylint.

pandas/compat/__init__.py
3 issues
Argument name "f" doesn't conform to snake_case naming style
Error

Line: 35 Column: 1

              IS64 = sys.maxsize > 2 ** 32


def set_function_name(f: F, name: str, cls) -> F:
    """
    Bind the name/qualname attributes of the function.
    """
    f.__name__ = name
    f.__qualname__ = f"{cls.__name__}.{name}"

            

Reported by Pylint.

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

Line: 105 Column: 1

                  return platform.machine() in ("arm64", "aarch64")


def import_lzma():
    """
    Importing the `lzma` module.

    Warns
    -----

            

Reported by Pylint.

Import outside toplevel (lzma)
Error

Line: 114 Column: 9

                  When the `lzma` module is not available.
    """
    try:
        import lzma

        return lzma
    except ImportError:
        msg = (
            "Could not import the lzma module. Your installed Python is incomplete. "

            

Reported by Pylint.

pandas/_testing/_random.py
3 issues
Missing module docstring
Error

Line: 1 Column: 1

              import string

import numpy as np


def randbool(size=(), p: float = 0.5):
    return np.random.rand(*size) <= p



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 6 Column: 1

              import numpy as np


def randbool(size=(), p: float = 0.5):
    return np.random.rand(*size) <= p


RANDS_CHARS = np.array(list(string.ascii_letters + string.digits), dtype=(np.str_, 1))
RANDU_CHARS = np.array(

            

Reported by Pylint.

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

Line: 6 Column: 1

              import numpy as np


def randbool(size=(), p: float = 0.5):
    return np.random.rand(*size) <= p


RANDS_CHARS = np.array(list(string.ascii_letters + string.digits), dtype=(np.str_, 1))
RANDU_CHARS = np.array(

            

Reported by Pylint.

pandas/tests/indexes/datetimelike_/test_indexing.py
3 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

import pandas as pd
from pandas import (
    DatetimeIndex,
    Index,
)
import pandas._testing as tm

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest

import pandas as pd
from pandas import (
    DatetimeIndex,
    Index,
)
import pandas._testing as tm

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 21 Column: 1

              
@pytest.mark.parametrize("ldtype", dtlike_dtypes)
@pytest.mark.parametrize("rdtype", dtlike_dtypes)
def test_get_indexer_non_unique_wrong_dtype(ldtype, rdtype):

    vals = np.tile(3600 * 10 ** 9 * np.arange(3), 2)

    def construct(dtype):
        if dtype is dtlike_dtypes[-1]:

            

Reported by Pylint.