The following issues were found
pandas/tests/io/parser/usecols/test_parse_dates.py
9 issues
Line: 7
Column: 1
"""
from io import StringIO
import pytest
from pandas import (
DataFrame,
Index,
Timestamp,
Reported by Pylint.
Line: 16
Column: 1
)
import pandas._testing as tm
_msg_validate_usecols_arg = (
"'usecols' must either be list-like "
"of all strings, all unicode, all "
"integers or a callable."
)
_msg_validate_usecols_names = (
Reported by Pylint.
Line: 21
Column: 1
"of all strings, all unicode, all "
"integers or a callable."
)
_msg_validate_usecols_names = (
"Usecols do not match columns, columns expected but not found: {0}"
)
@pytest.mark.parametrize("usecols", [[0, 2, 3], [3, 0, 2]])
Reported by Pylint.
Line: 27
Column: 1
@pytest.mark.parametrize("usecols", [[0, 2, 3], [3, 0, 2]])
def test_usecols_with_parse_dates(all_parsers, usecols):
# see gh-9755
data = """a,b,c,d,e
0,1,20140101,0900,4
0,1,20140102,1000,4"""
parser = all_parsers
Reported by Pylint.
Line: 44
Column: 1
tm.assert_frame_equal(result, expected)
def test_usecols_with_parse_dates2(all_parsers):
# see gh-13604
parser = all_parsers
data = """2008-02-07 09:40,1032.43
2008-02-07 09:50,1042.54
2008-02-07 10:00,1051.65"""
Reported by Pylint.
Line: 77
Column: 1
tm.assert_frame_equal(result, expected)
def test_usecols_with_parse_dates3(all_parsers):
# see gh-14792
parser = all_parsers
data = """a,b,c,d,e,f,g,h,i,j
2016/09/21,1,1,2,3,4,5,6,7,8"""
Reported by Pylint.
Line: 104
Column: 1
tm.assert_frame_equal(result, expected)
def test_usecols_with_parse_dates4(all_parsers):
data = "a,b,c,d,e,f,g,h,i,j\n2016/09/21,1,1,2,3,4,5,6,7,8"
usecols = list("abcdefghij")
parse_dates = [[0, 1]]
parser = all_parsers
Reported by Pylint.
Line: 133
Column: 1
[
list("abcde"), # Names span all columns in original data.
list("acd"), # Names span only the selected columns.
],
)
def test_usecols_with_parse_dates_and_names(all_parsers, usecols, names):
# see gh-9755
s = """0,1,20140101,0900,4
0,1,20140102,1000,4"""
Reported by Pylint.
Line: 137
Column: 5
)
def test_usecols_with_parse_dates_and_names(all_parsers, usecols, names):
# see gh-9755
s = """0,1,20140101,0900,4
0,1,20140102,1000,4"""
parse_dates = [[1, 2]]
parser = all_parsers
cols = {
Reported by Pylint.
pandas/tests/series/accessors/test_str_accessor.py
9 issues
Line: 1
Column: 1
import pytest
from pandas import Series
import pandas._testing as tm
class TestStrAccessor:
def test_str_attribute(self):
# GH#9068
Reported by Pylint.
Line: 1
Column: 1
import pytest
from pandas import Series
import pandas._testing as tm
class TestStrAccessor:
def test_str_attribute(self):
# GH#9068
Reported by Pylint.
Line: 7
Column: 1
import pandas._testing as tm
class TestStrAccessor:
def test_str_attribute(self):
# GH#9068
methods = ["strip", "rstrip", "lstrip"]
ser = Series([" jack", "jill ", " jesse ", "frank"])
for method in methods:
Reported by Pylint.
Line: 8
Column: 5
class TestStrAccessor:
def test_str_attribute(self):
# GH#9068
methods = ["strip", "rstrip", "lstrip"]
ser = Series([" jack", "jill ", " jesse ", "frank"])
for method in methods:
expected = Series([getattr(str, method)(x) for x in ser.values])
Reported by Pylint.
Line: 8
Column: 5
class TestStrAccessor:
def test_str_attribute(self):
# GH#9068
methods = ["strip", "rstrip", "lstrip"]
ser = Series([" jack", "jill ", " jesse ", "frank"])
for method in methods:
expected = Series([getattr(str, method)(x) for x in ser.values])
Reported by Pylint.
Line: 21
Column: 5
with pytest.raises(AttributeError, match="only use .str accessor"):
ser.str.repeat(2)
def test_str_accessor_updates_on_inplace(self):
ser = Series(list("abc"))
return_value = ser.drop([0], inplace=True)
assert return_value is None
assert len(ser.str.lower()) == 2
Reported by Pylint.
Line: 21
Column: 5
with pytest.raises(AttributeError, match="only use .str accessor"):
ser.str.repeat(2)
def test_str_accessor_updates_on_inplace(self):
ser = Series(list("abc"))
return_value = ser.drop([0], inplace=True)
assert return_value is None
assert len(ser.str.lower()) == 2
Reported by Pylint.
Line: 24
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_str_accessor_updates_on_inplace(self):
ser = Series(list("abc"))
return_value = ser.drop([0], inplace=True)
assert return_value is None
assert len(ser.str.lower()) == 2
Reported by Bandit.
Line: 25
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
ser = Series(list("abc"))
return_value = ser.drop([0], inplace=True)
assert return_value is None
assert len(ser.str.lower()) == 2
Reported by Bandit.
pandas/tests/io/parser/common/test_iterator.py
9 issues
Line: 7
Column: 1
"""
from io import StringIO
import pytest
from pandas import (
DataFrame,
Series,
concat,
Reported by Pylint.
Line: 17
Column: 1
import pandas._testing as tm
def test_iterator(all_parsers):
# see gh-6607
data = """index,A,B,C,D
foo,2,3,4,5
bar,7,8,9,10
baz,12,13,14,15
Reported by Pylint.
Line: 40
Column: 1
tm.assert_frame_equal(last_chunk, expected[3:])
def test_iterator2(all_parsers):
parser = all_parsers
data = """A,B,C
foo,1,2,3
bar,4,5,6
baz,7,8,9
Reported by Pylint.
Line: 59
Column: 1
tm.assert_frame_equal(result[0], expected)
def test_iterator_stop_on_chunksize(all_parsers):
# gh-3967: stopping iteration when chunksize is specified
parser = all_parsers
data = """A,B,C
foo,1,2,3
bar,4,5,6
Reported by Pylint.
Line: 71
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
with parser.read_csv(StringIO(data), chunksize=1) as reader:
result = list(reader)
assert len(result) == 3
expected = DataFrame(
[[1, 2, 3], [4, 5, 6], [7, 8, 9]],
index=["foo", "bar", "baz"],
columns=["A", "B", "C"],
)
Reported by Bandit.
Line: 82
Column: 1
@pytest.mark.parametrize(
"kwargs", [{"iterator": True, "chunksize": 1}, {"iterator": True}, {"chunksize": 1}]
)
def test_iterator_skipfooter_errors(all_parsers, kwargs):
msg = "'skipfooter' not supported for iteration"
parser = all_parsers
data = "a\n1\n2"
Reported by Pylint.
Line: 93
Column: 1
pass
def test_iteration_open_handle(all_parsers):
parser = all_parsers
kwargs = {"squeeze": True, "header": None}
with tm.ensure_clean() as path:
with open(path, "w") as f:
Reported by Pylint.
Line: 98
Column: 33
kwargs = {"squeeze": True, "header": None}
with tm.ensure_clean() as path:
with open(path, "w") as f:
f.write("AAA\nBBB\nCCC\nDDD\nEEE\nFFF\nGGG")
with open(path) as f:
for line in f:
if "CCC" in line:
Reported by Pylint.
Line: 101
Column: 28
with open(path, "w") as f:
f.write("AAA\nBBB\nCCC\nDDD\nEEE\nFFF\nGGG")
with open(path) as f:
for line in f:
if "CCC" in line:
break
result = parser.read_csv(f, **kwargs)
Reported by Pylint.
pandas/tests/window/conftest.py
9 issues
Line: 3
Column: 1
from datetime import timedelta
import pytest
import pandas.util._test_decorators as td
from pandas import (
DataFrame,
to_datetime,
Reported by Pylint.
Line: 1
Column: 1
from datetime import timedelta
import pytest
import pandas.util._test_decorators as td
from pandas import (
DataFrame,
to_datetime,
Reported by Pylint.
Line: 29
Column: 1
"blackmanharris",
"nuttall",
"barthann",
]
)
def win_types(request):
return request.param
Reported by Pylint.
Line: 36
Column: 1
@pytest.fixture(params=["kaiser", "gaussian", "general_gaussian", "exponential"])
def win_types_special(request):
return request.param
@pytest.fixture(
params=[
Reported by Pylint.
Line: 53
Column: 1
"skew",
"count",
"sem",
]
)
def arithmetic_win_operators(request):
return request.param
Reported by Pylint.
Line: 66
Column: 1
"median",
"max",
"min",
]
)
def arithmetic_numba_supported_operators(request):
return request.param
Reported by Pylint.
Line: 73
Column: 1
@pytest.fixture(params=["right", "left", "both", "neither"])
def closed(request):
return request.param
@pytest.fixture(params=[True, False])
def center(request):
Reported by Pylint.
Line: 78
Column: 1
@pytest.fixture(params=[True, False])
def center(request):
return request.param
@pytest.fixture(params=[None, 1])
def min_periods(request):
Reported by Pylint.
Line: 83
Column: 1
@pytest.fixture(params=[None, 1])
def min_periods(request):
return request.param
@pytest.fixture(params=["single", "table"])
def method(request):
Reported by Pylint.
pandas/tests/indexes/period/methods/test_is_full.py
9 issues
Line: 1
Column: 1
import pytest
from pandas import PeriodIndex
def test_is_full():
index = PeriodIndex([2005, 2007, 2009], freq="A")
assert not index.is_full
Reported by Pylint.
Line: 21
Column: 9
index = PeriodIndex([2006, 2005, 2005], freq="A")
with pytest.raises(ValueError, match="Index is not monotonic"):
index.is_full
assert index[:0].is_full
Reported by Pylint.
Line: 1
Column: 1
import pytest
from pandas import PeriodIndex
def test_is_full():
index = PeriodIndex([2005, 2007, 2009], freq="A")
assert not index.is_full
Reported by Pylint.
Line: 6
Column: 1
from pandas import PeriodIndex
def test_is_full():
index = PeriodIndex([2005, 2007, 2009], freq="A")
assert not index.is_full
index = PeriodIndex([2005, 2006, 2007], freq="A")
assert index.is_full
Reported by Pylint.
Line: 8
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
def test_is_full():
index = PeriodIndex([2005, 2007, 2009], freq="A")
assert not index.is_full
index = PeriodIndex([2005, 2006, 2007], freq="A")
assert index.is_full
index = PeriodIndex([2005, 2005, 2007], freq="A")
Reported by Bandit.
Line: 11
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
assert not index.is_full
index = PeriodIndex([2005, 2006, 2007], freq="A")
assert index.is_full
index = PeriodIndex([2005, 2005, 2007], freq="A")
assert not index.is_full
index = PeriodIndex([2005, 2005, 2006], freq="A")
Reported by Bandit.
Line: 14
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
assert index.is_full
index = PeriodIndex([2005, 2005, 2007], freq="A")
assert not index.is_full
index = PeriodIndex([2005, 2005, 2006], freq="A")
assert index.is_full
index = PeriodIndex([2006, 2005, 2005], freq="A")
Reported by Bandit.
Line: 17
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
assert not index.is_full
index = PeriodIndex([2005, 2005, 2006], freq="A")
assert index.is_full
index = PeriodIndex([2006, 2005, 2005], freq="A")
with pytest.raises(ValueError, match="Index is not monotonic"):
index.is_full
Reported by Bandit.
Line: 23
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
with pytest.raises(ValueError, match="Index is not monotonic"):
index.is_full
assert index[:0].is_full
Reported by Bandit.
pandas/tests/io/parser/common/test_verbose.py
8 issues
Line: 8
Column: 1
from io import StringIO
def test_verbose_read(all_parsers, capsys):
parser = all_parsers
data = """a,b,c,d
one,1,2,3
one,1,2,3
,1,2,3
Reported by Pylint.
Line: 25
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
captured = capsys.readouterr()
if parser.engine == "c":
assert "Tokenization took:" in captured.out
assert "Parser memory cleanup took:" in captured.out
else: # Python engine
assert captured.out == "Filled 3 NA values in column a\n"
Reported by Bandit.
Line: 26
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
if parser.engine == "c":
assert "Tokenization took:" in captured.out
assert "Parser memory cleanup took:" in captured.out
else: # Python engine
assert captured.out == "Filled 3 NA values in column a\n"
def test_verbose_read2(all_parsers, capsys):
Reported by Bandit.
Line: 28
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
assert "Tokenization took:" in captured.out
assert "Parser memory cleanup took:" in captured.out
else: # Python engine
assert captured.out == "Filled 3 NA values in column a\n"
def test_verbose_read2(all_parsers, capsys):
parser = all_parsers
data = """a,b,c,d
Reported by Bandit.
Line: 31
Column: 1
assert captured.out == "Filled 3 NA values in column a\n"
def test_verbose_read2(all_parsers, capsys):
parser = all_parsers
data = """a,b,c,d
one,1,2,3
two,1,2,3
three,1,2,3
Reported by Pylint.
Line: 48
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
# Engines are verbose in different ways.
if parser.engine == "c":
assert "Tokenization took:" in captured.out
assert "Parser memory cleanup took:" in captured.out
else: # Python engine
assert captured.out == "Filled 1 NA values in column a\n"
Reported by Bandit.
Line: 49
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
# Engines are verbose in different ways.
if parser.engine == "c":
assert "Tokenization took:" in captured.out
assert "Parser memory cleanup took:" in captured.out
else: # Python engine
assert captured.out == "Filled 1 NA values in column a\n"
Reported by Bandit.
Line: 51
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
assert "Tokenization took:" in captured.out
assert "Parser memory cleanup took:" in captured.out
else: # Python engine
assert captured.out == "Filled 1 NA values in column a\n"
Reported by Bandit.
pandas/tests/indexes/multi/test_isin.py
8 issues
Line: 2
Column: 1
import numpy as np
import pytest
from pandas import MultiIndex
import pandas._testing as tm
def test_isin_nan():
idx = MultiIndex.from_arrays([["foo", "bar"], [1.0, np.nan]])
Reported by Pylint.
Line: 1
Column: 1
import numpy as np
import pytest
from pandas import MultiIndex
import pandas._testing as tm
def test_isin_nan():
idx = MultiIndex.from_arrays([["foo", "bar"], [1.0, np.nan]])
Reported by Pylint.
Line: 8
Column: 1
import pandas._testing as tm
def test_isin_nan():
idx = MultiIndex.from_arrays([["foo", "bar"], [1.0, np.nan]])
tm.assert_numpy_array_equal(idx.isin([("bar", np.nan)]), np.array([False, True]))
tm.assert_numpy_array_equal(
idx.isin([("bar", float("nan"))]), np.array([False, True])
)
Reported by Pylint.
Line: 16
Column: 1
)
def test_isin():
values = [("foo", 2), ("bar", 3), ("quux", 4)]
idx = MultiIndex.from_arrays([["qux", "baz", "foo", "bar"], np.arange(4)])
result = idx.isin(values)
expected = np.array([False, False, True, True])
Reported by Pylint.
Line: 27
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
# empty, return dtype bool
idx = MultiIndex.from_arrays([[], []])
result = idx.isin(values)
assert len(result) == 0
assert result.dtype == np.bool_
def test_isin_level_kwarg():
idx = MultiIndex.from_arrays([["qux", "baz", "foo", "bar"], np.arange(4)])
Reported by Bandit.
Line: 28
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
idx = MultiIndex.from_arrays([[], []])
result = idx.isin(values)
assert len(result) == 0
assert result.dtype == np.bool_
def test_isin_level_kwarg():
idx = MultiIndex.from_arrays([["qux", "baz", "foo", "bar"], np.arange(4)])
Reported by Bandit.
Line: 31
Column: 1
assert result.dtype == np.bool_
def test_isin_level_kwarg():
idx = MultiIndex.from_arrays([["qux", "baz", "foo", "bar"], np.arange(4)])
vals_0 = ["foo", "bar", "quux"]
vals_1 = [2, 3, 10]
Reported by Pylint.
Line: 72
Column: 1
([("b", np.nan)], np.array([False, False, True]), None),
([np.nan, "a"], np.array([True, True, False]), 0),
(["d", np.nan], np.array([False, True, True]), 1),
],
)
def test_isin_multi_index_with_missing_value(labels, expected, level):
# GH 19132
midx = MultiIndex.from_arrays([[np.nan, "a", "b"], ["c", "d", np.nan]])
result = midx.isin(labels, level=level)
Reported by Pylint.
pandas/tests/indexes/test_numpy_compat.py
8 issues
Line: 2
Column: 1
import numpy as np
import pytest
from pandas import (
DatetimeIndex,
Float64Index,
Index,
NumericIndex,
PeriodIndex,
Reported by Pylint.
Line: 1
Column: 1
import numpy as np
import pytest
from pandas import (
DatetimeIndex,
Float64Index,
Index,
NumericIndex,
PeriodIndex,
Reported by Pylint.
Line: 43
Column: 1
np.rad2deg,
],
ids=lambda x: x.__name__,
)
def test_numpy_ufuncs_basic(index, func):
# test ufuncs of numpy, see:
# https://numpy.org/doc/stable/reference/ufuncs.html
if isinstance(index, DatetimeIndexOpsMixin):
Reported by Pylint.
Line: 59
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
exp = Index(func(index.values), name=index.name)
tm.assert_index_equal(result, exp)
assert isinstance(result, Float64Index)
else:
# raise AttributeError or TypeError
if len(index) == 0:
pass
else:
Reported by Bandit.
Line: 72
Column: 1
@pytest.mark.parametrize(
"func", [np.isfinite, np.isinf, np.isnan, np.signbit], ids=lambda x: x.__name__
)
def test_numpy_ufuncs_other(index, func, request):
# test ufuncs of numpy, see:
# https://numpy.org/doc/stable/reference/ufuncs.html
if isinstance(index, (DatetimeIndex, TimedeltaIndex)):
if (
Reported by Pylint.
Line: 88
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
if func in (np.isfinite, np.isinf, np.isnan):
# numpy 1.18 changed isinf and isnan to not raise on dt64/tfd64
result = func(index)
assert isinstance(result, np.ndarray)
else:
with tm.external_error_raised(TypeError):
func(index)
elif isinstance(index, PeriodIndex):
Reported by Bandit.
Line: 100
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
elif isinstance(index, NumericIndex):
# Results in bool array
result = func(index)
assert isinstance(result, np.ndarray)
assert not isinstance(result, Index)
else:
if len(index) == 0:
pass
else:
Reported by Bandit.
Line: 101
Suggestion:
https://bandit.readthedocs.io/en/latest/plugins/b101_assert_used.html
# Results in bool array
result = func(index)
assert isinstance(result, np.ndarray)
assert not isinstance(result, Index)
else:
if len(index) == 0:
pass
else:
with tm.external_error_raised(TypeError):
Reported by Bandit.
scripts/use_pd_array_in_core.py
8 issues
Line: 25
Column: 1
)
class Visitor(ast.NodeVisitor):
def __init__(self, path: str) -> None:
self.path = path
def visit_ImportFrom(self, node: ast.ImportFrom) -> None:
# If array has been imported from somewhere in pandas,
Reported by Pylint.
Line: 29
Column: 5
def __init__(self, path: str) -> None:
self.path = path
def visit_ImportFrom(self, node: ast.ImportFrom) -> None:
# If array has been imported from somewhere in pandas,
# check it's aliased as pd_array.
if (
node.module is not None
and node.module.startswith("pandas")
Reported by Pylint.
Line: 29
Column: 5
def __init__(self, path: str) -> None:
self.path = path
def visit_ImportFrom(self, node: ast.ImportFrom) -> None:
# If array has been imported from somewhere in pandas,
# check it's aliased as pd_array.
if (
node.module is not None
and node.module.startswith("pandas")
Reported by Pylint.
Line: 44
Column: 5
sys.exit(1)
super().generic_visit(node)
def visit_Attribute(self, node: ast.Attribute) -> None:
if (
isinstance(node.value, ast.Name)
and node.value.id == "pd"
and node.attr == "array"
):
Reported by Pylint.
Line: 44
Column: 5
sys.exit(1)
super().generic_visit(node)
def visit_Attribute(self, node: ast.Attribute) -> None:
if (
isinstance(node.value, ast.Name)
and node.value.id == "pd"
and node.attr == "array"
):
Reported by Pylint.
Line: 58
Column: 1
super().generic_visit(node)
def use_pd_array(content: str, path: str) -> None:
tree = ast.parse(content)
visitor = Visitor(path)
visitor.visit(tree)
Reported by Pylint.
Line: 64
Column: 1
visitor.visit(tree)
def main(argv: Sequence[str] | None = None) -> None:
parser = argparse.ArgumentParser()
parser.add_argument("paths", nargs="*")
args = parser.parse_args(argv)
for path in args.paths:
Reported by Pylint.
Line: 70
Column: 46
args = parser.parse_args(argv)
for path in args.paths:
with open(path, encoding="utf-8") as fd:
content = fd.read()
use_pd_array(content, path)
if __name__ == "__main__":
Reported by Pylint.
pandas/tests/strings/test_get_dummies.py
8 issues
Line: 1
Column: 1
import numpy as np
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
_testing as tm,
)
Reported by Pylint.
Line: 12
Column: 1
)
def test_get_dummies(any_string_dtype):
s = Series(["a|b", "a|c", np.nan], dtype=any_string_dtype)
result = s.str.get_dummies("|")
expected = DataFrame([[1, 1, 0], [1, 0, 1], [0, 0, 0]], columns=list("abc"))
tm.assert_frame_equal(result, expected)
Reported by Pylint.
Line: 13
Column: 5
def test_get_dummies(any_string_dtype):
s = Series(["a|b", "a|c", np.nan], dtype=any_string_dtype)
result = s.str.get_dummies("|")
expected = DataFrame([[1, 1, 0], [1, 0, 1], [0, 0, 0]], columns=list("abc"))
tm.assert_frame_equal(result, expected)
s = Series(["a;b", "a", 7], dtype=any_string_dtype)
Reported by Pylint.
Line: 18
Column: 5
expected = DataFrame([[1, 1, 0], [1, 0, 1], [0, 0, 0]], columns=list("abc"))
tm.assert_frame_equal(result, expected)
s = Series(["a;b", "a", 7], dtype=any_string_dtype)
result = s.str.get_dummies(";")
expected = DataFrame([[0, 1, 1], [0, 1, 0], [1, 0, 0]], columns=list("7ab"))
tm.assert_frame_equal(result, expected)
Reported by Pylint.
Line: 24
Column: 1
tm.assert_frame_equal(result, expected)
def test_get_dummies_index():
# GH9980, GH8028
idx = Index(["a|b", "a|c", "b|c"])
result = idx.str.get_dummies("|")
expected = MultiIndex.from_tuples(
Reported by Pylint.
Line: 35
Column: 1
tm.assert_index_equal(result, expected)
def test_get_dummies_with_name_dummy(any_string_dtype):
# GH 12180
# Dummies named 'name' should work as expected
s = Series(["a", "b,name", "b"], dtype=any_string_dtype)
result = s.str.get_dummies(",")
expected = DataFrame([[1, 0, 0], [0, 1, 1], [0, 1, 0]], columns=["a", "b", "name"])
Reported by Pylint.
Line: 38
Column: 5
def test_get_dummies_with_name_dummy(any_string_dtype):
# GH 12180
# Dummies named 'name' should work as expected
s = Series(["a", "b,name", "b"], dtype=any_string_dtype)
result = s.str.get_dummies(",")
expected = DataFrame([[1, 0, 0], [0, 1, 1], [0, 1, 0]], columns=["a", "b", "name"])
tm.assert_frame_equal(result, expected)
Reported by Pylint.
Line: 44
Column: 1
tm.assert_frame_equal(result, expected)
def test_get_dummies_with_name_dummy_index():
# GH 12180
# Dummies named 'name' should work as expected
idx = Index(["a|b", "name|c", "b|name"])
result = idx.str.get_dummies("|")
Reported by Pylint.