MCPcopy
hub / github.com/pandas-dev/pandas / test_string_slice_get_syntax

Function test_string_slice_get_syntax

pandas/tests/strings/test_strings.py:628–644  ·  view source on GitHub ↗
(any_string_dtype)

Source from the content-addressed store, hash-verified

626
627
628def test_string_slice_get_syntax(any_string_dtype):
629 ser = Series(
630 ["YYY", "B", "C", "YYYYYYbYYY", "BYYYcYYY", np.nan, "CYYYBYYY", "dog", "cYYYt"],
631 dtype=any_string_dtype,
632 )
633
634 result = ser.str[0]
635 expected = ser.str.get(0)
636 tm.assert_series_equal(result, expected)
637
638 result = ser.str[:3]
639 expected = ser.str.slice(stop=3)
640 tm.assert_series_equal(result, expected)
641
642 result = ser.str[2::-1]
643 expected = ser.str.slice(start=2, step=-1)
644 tm.assert_series_equal(result, expected)
645
646
647def test_string_slice_out_of_bounds_nested():

Callers

nothing calls this directly

Calls 3

SeriesClass · 0.90
sliceMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected