The following issues were found

pandas/_libs/tslibs/src/datetime/np_datetime_strings.c
7 issues
_snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 630 Column: 14 CWE codes: 134
Suggestion: Use a constant for the format specification

               * to have data all the way to the end of the buffer.
 */
#ifdef _WIN32
    tmplen = _snprintf(substr, sublen, "%04" NPY_INT64_FMT, dts->year);
#else
    tmplen = snprintf(substr, sublen, "%04" NPY_INT64_FMT, dts->year);
#endif  // _WIN32
    /* If it ran out of space or there isn't space for the NULL terminator */
    if (tmplen < 0 || tmplen > sublen) {

            

Reported by FlawFinder.

snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 632 Column: 14 CWE codes: 134
Suggestion: Use a constant for the format specification

              #ifdef _WIN32
    tmplen = _snprintf(substr, sublen, "%04" NPY_INT64_FMT, dts->year);
#else
    tmplen = snprintf(substr, sublen, "%04" NPY_INT64_FMT, dts->year);
#endif  // _WIN32
    /* If it ran out of space or there isn't space for the NULL terminator */
    if (tmplen < 0 || tmplen > sublen) {
        goto string_too_short;
    }

            

Reported by FlawFinder.

snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 913 Column: 14 CWE codes: 134
Suggestion: Use a constant for the format specification

              int make_iso_8601_timedelta(pandas_timedeltastruct *tds,
                            char *outstr, size_t *outlen) {
  *outlen = 0;
  *outlen += snprintf(outstr, 60,  // NOLINT
                     "P%" NPY_INT64_FMT
                     "DT%" NPY_INT32_FMT
                     "H%" NPY_INT32_FMT
                     "M%" NPY_INT32_FMT,
                     tds->days, tds->hrs, tds->min, tds->sec);

            

Reported by FlawFinder.

snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 922 Column: 16 CWE codes: 134
Suggestion: Use a constant for the format specification

                outstr += *outlen;

  if (tds->ns != 0) {
    *outlen += snprintf(outstr, 12,  // NOLINT
                       ".%03" NPY_INT32_FMT
                       "%03" NPY_INT32_FMT
                       "%03" NPY_INT32_FMT
                       "S", tds->ms, tds->us, tds->ns);
  } else if (tds->us != 0) {

            

Reported by FlawFinder.

snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 928 Column: 16 CWE codes: 134
Suggestion: Use a constant for the format specification

                                     "%03" NPY_INT32_FMT
                       "S", tds->ms, tds->us, tds->ns);
  } else if (tds->us != 0) {
    *outlen += snprintf(outstr, 9,  // NOLINT
                       ".%03" NPY_INT32_FMT
                       "%03" NPY_INT32_FMT
                       "S", tds->ms, tds->us);
  } else if (tds->ms != 0) {
    *outlen += snprintf(outstr, 6,  // NOLINT

            

Reported by FlawFinder.

snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 933 Column: 16 CWE codes: 134
Suggestion: Use a constant for the format specification

                                     "%03" NPY_INT32_FMT
                       "S", tds->ms, tds->us);
  } else if (tds->ms != 0) {
    *outlen += snprintf(outstr, 6,  // NOLINT
                        ".%03" NPY_INT32_FMT "S", tds->ms);
  } else {
    *outlen += snprintf(outstr, 2,  // NOLINT
                        "%s", "S");
  }

            

Reported by FlawFinder.

snprintf - If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate
Security

Line: 936 Column: 16 CWE codes: 134
Suggestion: Use a constant for the format specification

                  *outlen += snprintf(outstr, 6,  // NOLINT
                        ".%03" NPY_INT32_FMT "S", tds->ms);
  } else {
    *outlen += snprintf(outstr, 2,  // NOLINT
                        "%s", "S");
  }

  return 0;
}

            

Reported by FlawFinder.

pandas/tests/indexes/datetimes/methods/test_fillna.py
7 issues
Unable to import 'pytest'
Error

Line: 1 Column: 1

              import pytest

import pandas as pd
import pandas._testing as tm


class TestDatetimeIndexFillNA:
    @pytest.mark.parametrize("tz", ["US/Eastern", "Asia/Tokyo"])
    def test_fillna_datetime64(self, tz):

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import pytest

import pandas as pd
import pandas._testing as tm


class TestDatetimeIndexFillNA:
    @pytest.mark.parametrize("tz", ["US/Eastern", "Asia/Tokyo"])
    def test_fillna_datetime64(self, tz):

            

Reported by Pylint.

Missing class docstring
Error

Line: 7 Column: 1

              import pandas._testing as tm


class TestDatetimeIndexFillNA:
    @pytest.mark.parametrize("tz", ["US/Eastern", "Asia/Tokyo"])
    def test_fillna_datetime64(self, tz):
        # GH 11343
        idx = pd.DatetimeIndex(["2011-01-01 09:00", pd.NaT, "2011-01-01 11:00"])


            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 7 Column: 1

              import pandas._testing as tm


class TestDatetimeIndexFillNA:
    @pytest.mark.parametrize("tz", ["US/Eastern", "Asia/Tokyo"])
    def test_fillna_datetime64(self, tz):
        # GH 11343
        idx = pd.DatetimeIndex(["2011-01-01 09:00", pd.NaT, "2011-01-01 11:00"])


            

Reported by Pylint.

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

Line: 9 Column: 5

              
class TestDatetimeIndexFillNA:
    @pytest.mark.parametrize("tz", ["US/Eastern", "Asia/Tokyo"])
    def test_fillna_datetime64(self, tz):
        # GH 11343
        idx = pd.DatetimeIndex(["2011-01-01 09:00", pd.NaT, "2011-01-01 11:00"])

        exp = pd.DatetimeIndex(
            ["2011-01-01 09:00", "2011-01-01 10:00", "2011-01-01 11:00"]

            

Reported by Pylint.

Method could be a function
Error

Line: 9 Column: 5

              
class TestDatetimeIndexFillNA:
    @pytest.mark.parametrize("tz", ["US/Eastern", "Asia/Tokyo"])
    def test_fillna_datetime64(self, tz):
        # GH 11343
        idx = pd.DatetimeIndex(["2011-01-01 09:00", pd.NaT, "2011-01-01 11:00"])

        exp = pd.DatetimeIndex(
            ["2011-01-01 09:00", "2011-01-01 10:00", "2011-01-01 11:00"]

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 9 Column: 5

              
class TestDatetimeIndexFillNA:
    @pytest.mark.parametrize("tz", ["US/Eastern", "Asia/Tokyo"])
    def test_fillna_datetime64(self, tz):
        # GH 11343
        idx = pd.DatetimeIndex(["2011-01-01 09:00", pd.NaT, "2011-01-01 11:00"])

        exp = pd.DatetimeIndex(
            ["2011-01-01 09:00", "2011-01-01 10:00", "2011-01-01 11:00"]

            

Reported by Pylint.

pandas/compat/pyarrow.py
7 issues
Module 'pyarrow' has no '__version__' member
Error

Line: 8 Column: 19

              try:
    import pyarrow as pa

    _pa_version = pa.__version__
    _palv = Version(_pa_version)
    pa_version_under1p0 = _palv < Version("1.0.0")
    pa_version_under2p0 = _palv < Version("2.0.0")
    pa_version_under3p0 = _palv < Version("3.0.0")
    pa_version_under4p0 = _palv < Version("4.0.0")

            

Reported by Pylint.

Module import itself
Error

Line: 6 Column: 5

              from pandas.util.version import Version

try:
    import pyarrow as pa

    _pa_version = pa.__version__
    _palv = Version(_pa_version)
    pa_version_under1p0 = _palv < Version("1.0.0")
    pa_version_under2p0 = _palv < Version("2.0.0")

            

Reported by Pylint.

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

Line: 16 Column: 5

                  pa_version_under4p0 = _palv < Version("4.0.0")
    pa_version_under5p0 = _palv < Version("5.0.0")
except ImportError:
    pa_version_under1p0 = True
    pa_version_under2p0 = True
    pa_version_under3p0 = True
    pa_version_under4p0 = True
    pa_version_under5p0 = True

            

Reported by Pylint.

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

Line: 17 Column: 5

                  pa_version_under5p0 = _palv < Version("5.0.0")
except ImportError:
    pa_version_under1p0 = True
    pa_version_under2p0 = True
    pa_version_under3p0 = True
    pa_version_under4p0 = True
    pa_version_under5p0 = True

            

Reported by Pylint.

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

Line: 18 Column: 5

              except ImportError:
    pa_version_under1p0 = True
    pa_version_under2p0 = True
    pa_version_under3p0 = True
    pa_version_under4p0 = True
    pa_version_under5p0 = True

            

Reported by Pylint.

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

Line: 19 Column: 5

                  pa_version_under1p0 = True
    pa_version_under2p0 = True
    pa_version_under3p0 = True
    pa_version_under4p0 = True
    pa_version_under5p0 = True

            

Reported by Pylint.

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

Line: 20 Column: 5

                  pa_version_under2p0 = True
    pa_version_under3p0 = True
    pa_version_under4p0 = True
    pa_version_under5p0 = True

            

Reported by Pylint.

pandas/tests/base/test_transpose.py
7 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

from pandas import (
    CategoricalDtype,
    DataFrame,
)
import pandas._testing as tm


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest

from pandas import (
    CategoricalDtype,
    DataFrame,
)
import pandas._testing as tm


            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 1

              import pandas._testing as tm


def test_transpose(index_or_series_obj):
    obj = index_or_series_obj
    tm.assert_equal(obj.transpose(), obj)


def test_transpose_non_default_axes(index_or_series_obj):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 16 Column: 1

                  tm.assert_equal(obj.transpose(), obj)


def test_transpose_non_default_axes(index_or_series_obj):
    msg = "the 'axes' parameter is not supported"
    obj = index_or_series_obj
    with pytest.raises(ValueError, match=msg):
        obj.transpose(1)
    with pytest.raises(ValueError, match=msg):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 25 Column: 1

                      obj.transpose(axes=1)


def test_numpy_transpose(index_or_series_obj):
    msg = "the 'axes' parameter is not supported"
    obj = index_or_series_obj
    tm.assert_equal(np.transpose(obj), obj)

    with pytest.raises(ValueError, match=msg):

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 48 Column: 1

                          ["a", "a"],
            ["b", "b"],
            CategoricalDtype([1, 2, 3, 4]),
        ),
    ],
)
def test_duplicate_labels(data, transposed_data, index, columns, dtype):
    # GH 42380
    df = DataFrame(data, index=index, columns=columns, dtype=dtype)

            

Reported by Pylint.

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

Line: 53 Column: 5

              )
def test_duplicate_labels(data, transposed_data, index, columns, dtype):
    # GH 42380
    df = DataFrame(data, index=index, columns=columns, dtype=dtype)
    result = df.T
    expected = DataFrame(transposed_data, index=columns, columns=index, dtype=dtype)
    tm.assert_frame_equal(result, expected)

            

Reported by Pylint.

pandas/tests/reshape/concat/test_invalid.py
7 issues
Unable to import 'pytest'
Error

Line: 4 Column: 1

              from io import StringIO

import numpy as np
import pytest

from pandas import (
    DataFrame,
    concat,
    read_csv,

            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              from io import StringIO

import numpy as np
import pytest

from pandas import (
    DataFrame,
    concat,
    read_csv,

            

Reported by Pylint.

Missing class docstring
Error

Line: 14 Column: 1

              import pandas._testing as tm


class TestInvalidConcat:
    def test_concat_invalid(self):

        # trying to concat a ndframe with a non-ndframe
        df1 = tm.makeCustomDataframe(10, 2)
        for obj in [1, {}, [1, 2], (1, 2)]:

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 15 Column: 5

              

class TestInvalidConcat:
    def test_concat_invalid(self):

        # trying to concat a ndframe with a non-ndframe
        df1 = tm.makeCustomDataframe(10, 2)
        for obj in [1, {}, [1, 2], (1, 2)]:


            

Reported by Pylint.

Method could be a function
Error

Line: 15 Column: 5

              

class TestInvalidConcat:
    def test_concat_invalid(self):

        # trying to concat a ndframe with a non-ndframe
        df1 = tm.makeCustomDataframe(10, 2)
        for obj in [1, {}, [1, 2], (1, 2)]:


            

Reported by Pylint.

Method could be a function
Error

Line: 28 Column: 5

                          with pytest.raises(TypeError, match=msg):
                concat([df1, obj])

    def test_concat_invalid_first_argument(self):
        df1 = tm.makeCustomDataframe(10, 2)
        msg = (
            "first argument must be an iterable of pandas "
            'objects, you passed an object of type "DataFrame"'
        )

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 28 Column: 5

                          with pytest.raises(TypeError, match=msg):
                concat([df1, obj])

    def test_concat_invalid_first_argument(self):
        df1 = tm.makeCustomDataframe(10, 2)
        msg = (
            "first argument must be an iterable of pandas "
            'objects, you passed an object of type "DataFrame"'
        )

            

Reported by Pylint.

scripts/tests/test_no_bool_in_generic.py
7 issues
Missing module docstring
Error

Line: 1 Column: 1

              from scripts.no_bool_in_generic import check_for_bool_in_generic

BAD_FILE = "def foo(a: bool) -> bool:\n    return bool(0)"
GOOD_FILE = "def foo(a: bool_t) -> bool_t:\n    return bool(0)"


def test_bad_file_with_replace():
    content = BAD_FILE
    mutated, result = check_for_bool_in_generic(content)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 7 Column: 1

              GOOD_FILE = "def foo(a: bool_t) -> bool_t:\n    return bool(0)"


def test_bad_file_with_replace():
    content = BAD_FILE
    mutated, result = check_for_bool_in_generic(content)
    expected = GOOD_FILE
    assert result == expected
    assert mutated

            

Reported by Pylint.

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

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

                  content = BAD_FILE
    mutated, result = check_for_bool_in_generic(content)
    expected = GOOD_FILE
    assert result == expected
    assert mutated


def test_good_file_with_replace():
    content = GOOD_FILE

            

Reported by Bandit.

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

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

                  mutated, result = check_for_bool_in_generic(content)
    expected = GOOD_FILE
    assert result == expected
    assert mutated


def test_good_file_with_replace():
    content = GOOD_FILE
    mutated, result = check_for_bool_in_generic(content)

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 15 Column: 1

                  assert mutated


def test_good_file_with_replace():
    content = GOOD_FILE
    mutated, result = check_for_bool_in_generic(content)
    expected = content
    assert result == expected
    assert not mutated

            

Reported by Pylint.

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

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

                  content = GOOD_FILE
    mutated, result = check_for_bool_in_generic(content)
    expected = content
    assert result == expected
    assert not mutated

            

Reported by Bandit.

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

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

                  mutated, result = check_for_bool_in_generic(content)
    expected = content
    assert result == expected
    assert not mutated

            

Reported by Bandit.

pandas/tests/tseries/holiday/test_federal.py
7 issues
Missing module docstring
Error

Line: 1 Column: 1

              from datetime import datetime

from pandas.tseries.holiday import (
    AbstractHolidayCalendar,
    USMartinLutherKingJr,
    USMemorialDay,
)



            

Reported by Pylint.

Missing function or method docstring
Error

Line: 10 Column: 1

              )


def test_no_mlk_before_1986():
    # see gh-10278
    class MLKCalendar(AbstractHolidayCalendar):
        rules = [USMartinLutherKingJr]

    holidays = MLKCalendar().holidays(start="1984", end="1988").to_pydatetime().tolist()

            

Reported by Pylint.

Missing class docstring
Error

Line: 12 Column: 5

              
def test_no_mlk_before_1986():
    # see gh-10278
    class MLKCalendar(AbstractHolidayCalendar):
        rules = [USMartinLutherKingJr]

    holidays = MLKCalendar().holidays(start="1984", end="1988").to_pydatetime().tolist()

    # Testing to make sure holiday is not incorrectly observed before 1986.

            

Reported by Pylint.

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

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

                  holidays = MLKCalendar().holidays(start="1984", end="1988").to_pydatetime().tolist()

    # Testing to make sure holiday is not incorrectly observed before 1986.
    assert holidays == [datetime(1986, 1, 20, 0, 0), datetime(1987, 1, 19, 0, 0)]


def test_memorial_day():
    class MemorialDay(AbstractHolidayCalendar):
        rules = [USMemorialDay]

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 21 Column: 1

                  assert holidays == [datetime(1986, 1, 20, 0, 0), datetime(1987, 1, 19, 0, 0)]


def test_memorial_day():
    class MemorialDay(AbstractHolidayCalendar):
        rules = [USMemorialDay]

    holidays = MemorialDay().holidays(start="1971", end="1980").to_pydatetime().tolist()


            

Reported by Pylint.

Missing class docstring
Error

Line: 22 Column: 5

              

def test_memorial_day():
    class MemorialDay(AbstractHolidayCalendar):
        rules = [USMemorialDay]

    holidays = MemorialDay().holidays(start="1971", end="1980").to_pydatetime().tolist()

    # Fixes 5/31 error and checked manually against Wikipedia.

            

Reported by Pylint.

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

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

                  holidays = MemorialDay().holidays(start="1971", end="1980").to_pydatetime().tolist()

    # Fixes 5/31 error and checked manually against Wikipedia.
    assert holidays == [
        datetime(1971, 5, 31, 0, 0),
        datetime(1972, 5, 29, 0, 0),
        datetime(1973, 5, 28, 0, 0),
        datetime(1974, 5, 27, 0, 0),
        datetime(1975, 5, 26, 0, 0),

            

Reported by Bandit.

pandas/tests/series/methods/test_dtypes.py
7 issues
Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np


class TestSeriesDtypes:
    def test_dtype(self, datetime_series):

        assert datetime_series.dtype == np.dtype("float64")
        assert datetime_series.dtypes == np.dtype("float64")

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 4 Column: 1

              import numpy as np


class TestSeriesDtypes:
    def test_dtype(self, datetime_series):

        assert datetime_series.dtype == np.dtype("float64")
        assert datetime_series.dtypes == np.dtype("float64")

            

Reported by Pylint.

Missing class docstring
Error

Line: 4 Column: 1

              import numpy as np


class TestSeriesDtypes:
    def test_dtype(self, datetime_series):

        assert datetime_series.dtype == np.dtype("float64")
        assert datetime_series.dtypes == np.dtype("float64")

            

Reported by Pylint.

Method could be a function
Error

Line: 5 Column: 5

              

class TestSeriesDtypes:
    def test_dtype(self, datetime_series):

        assert datetime_series.dtype == np.dtype("float64")
        assert datetime_series.dtypes == np.dtype("float64")

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 5 Column: 5

              

class TestSeriesDtypes:
    def test_dtype(self, datetime_series):

        assert datetime_series.dtype == np.dtype("float64")
        assert datetime_series.dtypes == np.dtype("float64")

            

Reported by Pylint.

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

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

              class TestSeriesDtypes:
    def test_dtype(self, datetime_series):

        assert datetime_series.dtype == np.dtype("float64")
        assert datetime_series.dtypes == np.dtype("float64")

            

Reported by Bandit.

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

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

                  def test_dtype(self, datetime_series):

        assert datetime_series.dtype == np.dtype("float64")
        assert datetime_series.dtypes == np.dtype("float64")

            

Reported by Bandit.

pandas/tests/indexes/period/methods/test_repeat.py
7 issues
Unable to import 'pytest'
Error

Line: 2 Column: 1

              import numpy as np
import pytest

from pandas import (
    PeriodIndex,
    period_range,
)
import pandas._testing as tm


            

Reported by Pylint.

Missing module docstring
Error

Line: 1 Column: 1

              import numpy as np
import pytest

from pandas import (
    PeriodIndex,
    period_range,
)
import pandas._testing as tm


            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 11 Column: 1

              import pandas._testing as tm


class TestRepeat:
    @pytest.mark.parametrize("use_numpy", [True, False])
    @pytest.mark.parametrize(
        "index",
        [
            period_range("2000-01-01", periods=3, freq="D"),

            

Reported by Pylint.

Missing class docstring
Error

Line: 11 Column: 1

              import pandas._testing as tm


class TestRepeat:
    @pytest.mark.parametrize("use_numpy", [True, False])
    @pytest.mark.parametrize(
        "index",
        [
            period_range("2000-01-01", periods=3, freq="D"),

            

Reported by Pylint.

Method could be a function
Error

Line: 19 Column: 5

                          period_range("2000-01-01", periods=3, freq="D"),
            period_range("2001-01-01", periods=3, freq="2D"),
            PeriodIndex(["2001-01", "NaT", "2003-01"], freq="M"),
        ],
    )
    def test_repeat_freqstr(self, index, use_numpy):
        # GH#10183
        expected = PeriodIndex([per for per in index for _ in range(3)])
        result = np.repeat(index, 3) if use_numpy else index.repeat(3)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 19 Column: 5

                          period_range("2000-01-01", periods=3, freq="D"),
            period_range("2001-01-01", periods=3, freq="2D"),
            PeriodIndex(["2001-01", "NaT", "2003-01"], freq="M"),
        ],
    )
    def test_repeat_freqstr(self, index, use_numpy):
        # GH#10183
        expected = PeriodIndex([per for per in index for _ in range(3)])
        result = np.repeat(index, 3) if use_numpy else index.repeat(3)

            

Reported by Pylint.

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

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

                      expected = PeriodIndex([per for per in index for _ in range(3)])
        result = np.repeat(index, 3) if use_numpy else index.repeat(3)
        tm.assert_index_equal(result, expected)
        assert result.freqstr == index.freqstr

            

Reported by Bandit.

pandas/tests/series/test_npfuncs.py
7 issues
Missing class docstring
Error

Line: 10 Column: 1

              from pandas import Series


class TestPtp:
    def test_ptp(self):
        # GH#21614
        N = 1000
        arr = np.random.randn(N)
        ser = Series(arr)

            

Reported by Pylint.

Too few public methods (1/2)
Error

Line: 10 Column: 1

              from pandas import Series


class TestPtp:
    def test_ptp(self):
        # GH#21614
        N = 1000
        arr = np.random.randn(N)
        ser = Series(arr)

            

Reported by Pylint.

Missing function or method docstring
Error

Line: 11 Column: 5

              

class TestPtp:
    def test_ptp(self):
        # GH#21614
        N = 1000
        arr = np.random.randn(N)
        ser = Series(arr)
        assert np.ptp(ser) == np.ptp(arr)

            

Reported by Pylint.

Method could be a function
Error

Line: 11 Column: 5

              

class TestPtp:
    def test_ptp(self):
        # GH#21614
        N = 1000
        arr = np.random.randn(N)
        ser = Series(arr)
        assert np.ptp(ser) == np.ptp(arr)

            

Reported by Pylint.

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

Line: 13 Column: 9

              class TestPtp:
    def test_ptp(self):
        # GH#21614
        N = 1000
        arr = np.random.randn(N)
        ser = Series(arr)
        assert np.ptp(ser) == np.ptp(arr)



            

Reported by Pylint.

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

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

                      N = 1000
        arr = np.random.randn(N)
        ser = Series(arr)
        assert np.ptp(ser) == np.ptp(arr)


def test_numpy_unique(datetime_series):
    # it works!
    np.unique(datetime_series)

            

Reported by Bandit.

Missing function or method docstring
Error

Line: 19 Column: 1

                      assert np.ptp(ser) == np.ptp(arr)


def test_numpy_unique(datetime_series):
    # it works!
    np.unique(datetime_series)

            

Reported by Pylint.