コード例 #1
0
 def test_strOrder_none() -> None:
     string = ['a', 'b', 'c', None]
     assert stp.str_order(string, na_last=False) == [3, 0, 1, 2]
コード例 #2
0
 def test_strOrder_natural() -> None:
     string = pd.Series(["100a10", "100a5", "2b", "2a"])
     pd.testing.assert_series_equal(stp.str_order(string, numeric=True),
                                    pd.Series([3, 2, 1, 0]))
コード例 #3
0
 def test_strOrder_series() -> None:
     string = pd.Series(["100a10", "100a5", "2b", "2a"])
     pd.testing.assert_series_equal(stp.str_order(string),
                                    pd.Series([0, 1, 3, 2]))
コード例 #4
0
 def test_strOrder_array() -> None:
     string = np.array(['this', 'is', 'happening'])
     np.testing.assert_array_equal(stp.str_order(string, decreasing=True),
                                   np.array([0, 1, 2]))
コード例 #5
0
 def test_strOrder_list() -> None:
     string = ['i', 'am', 'a', 'string']
     assert stp.str_order(string) == [2, 1, 0, 3]
コード例 #6
0
 def test_strOrder_string() -> None:
     string = 'string'
     assert stp.str_order(string) == 0