ZTWHHH commited on
Commit
285bc6d
·
verified ·
1 Parent(s): c4001bf

Add files using upload-large-folder tool

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_add_prefix_suffix.cpython-310.pyc +0 -0
  2. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_align.cpython-310.pyc +0 -0
  3. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_asof.cpython-310.pyc +0 -0
  4. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_assign.cpython-310.pyc +0 -0
  5. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_astype.cpython-310.pyc +0 -0
  6. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_at_time.cpython-310.pyc +0 -0
  7. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_between_time.cpython-310.pyc +0 -0
  8. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_combine.cpython-310.pyc +0 -0
  9. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_combine_first.cpython-310.pyc +0 -0
  10. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_compare.cpython-310.pyc +0 -0
  11. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_convert_dtypes.cpython-310.pyc +0 -0
  12. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_copy.cpython-310.pyc +0 -0
  13. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_cov_corr.cpython-310.pyc +0 -0
  14. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_describe.cpython-310.pyc +0 -0
  15. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_dot.cpython-310.pyc +0 -0
  16. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_droplevel.cpython-310.pyc +0 -0
  17. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_dropna.cpython-310.pyc +0 -0
  18. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_dtypes.cpython-310.pyc +0 -0
  19. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_duplicated.cpython-310.pyc +0 -0
  20. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_equals.cpython-310.pyc +0 -0
  21. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_filter.cpython-310.pyc +0 -0
  22. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_first_valid_index.cpython-310.pyc +0 -0
  23. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_infer_objects.cpython-310.pyc +0 -0
  24. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_interpolate.cpython-310.pyc +0 -0
  25. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_isetitem.cpython-310.pyc +0 -0
  26. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_map.cpython-310.pyc +0 -0
  27. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_matmul.cpython-310.pyc +0 -0
  28. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_pct_change.cpython-310.pyc +0 -0
  29. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_quantile.cpython-310.pyc +0 -0
  30. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_reindex_like.cpython-310.pyc +0 -0
  31. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_rename.cpython-310.pyc +0 -0
  32. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_reorder_levels.cpython-310.pyc +0 -0
  33. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_replace.cpython-310.pyc +0 -0
  34. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_round.cpython-310.pyc +0 -0
  35. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_select_dtypes.cpython-310.pyc +0 -0
  36. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_set_axis.cpython-310.pyc +0 -0
  37. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_shift.cpython-310.pyc +0 -0
  38. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_size.cpython-310.pyc +0 -0
  39. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_sort_index.cpython-310.pyc +0 -0
  40. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_sort_values.cpython-310.pyc +0 -0
  41. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_to_dict.cpython-310.pyc +0 -0
  42. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_to_dict_of_blocks.cpython-310.pyc +0 -0
  43. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_to_numpy.cpython-310.pyc +0 -0
  44. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_to_period.cpython-310.pyc +0 -0
  45. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_to_records.cpython-310.pyc +0 -0
  46. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_truncate.cpython-310.pyc +0 -0
  47. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_tz_localize.cpython-310.pyc +0 -0
  48. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/test_add_prefix_suffix.py +49 -0
  49. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/test_asof.py +198 -0
  50. vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/test_at_time.py +132 -0
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_add_prefix_suffix.cpython-310.pyc ADDED
Binary file (2.29 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_align.cpython-310.pyc ADDED
Binary file (14 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_asof.cpython-310.pyc ADDED
Binary file (5.33 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_assign.cpython-310.pyc ADDED
Binary file (3.79 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_astype.cpython-310.pyc ADDED
Binary file (27 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_at_time.cpython-310.pyc ADDED
Binary file (4.97 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_between_time.cpython-310.pyc ADDED
Binary file (7.13 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_combine.cpython-310.pyc ADDED
Binary file (1.67 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_combine_first.cpython-310.pyc ADDED
Binary file (15.6 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_compare.cpython-310.pyc ADDED
Binary file (6.76 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_convert_dtypes.cpython-310.pyc ADDED
Binary file (6.55 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_copy.cpython-310.pyc ADDED
Binary file (2.06 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_cov_corr.cpython-310.pyc ADDED
Binary file (15.4 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_describe.cpython-310.pyc ADDED
Binary file (11.4 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_dot.cpython-310.pyc ADDED
Binary file (5.65 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_droplevel.cpython-310.pyc ADDED
Binary file (1.3 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_dropna.cpython-310.pyc ADDED
Binary file (9.01 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_dtypes.cpython-310.pyc ADDED
Binary file (5 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_duplicated.cpython-310.pyc ADDED
Binary file (3.02 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_equals.cpython-310.pyc ADDED
Binary file (2.31 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_filter.cpython-310.pyc ADDED
Binary file (4.8 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_first_valid_index.cpython-310.pyc ADDED
Binary file (2.97 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_infer_objects.cpython-310.pyc ADDED
Binary file (1.25 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_interpolate.cpython-310.pyc ADDED
Binary file (16.6 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_isetitem.cpython-310.pyc ADDED
Binary file (1.84 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_map.cpython-310.pyc ADDED
Binary file (7.47 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_matmul.cpython-310.pyc ADDED
Binary file (2.29 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_pct_change.cpython-310.pyc ADDED
Binary file (5.21 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_quantile.cpython-310.pyc ADDED
Binary file (23.6 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_reindex_like.cpython-310.pyc ADDED
Binary file (1.82 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_rename.cpython-310.pyc ADDED
Binary file (11.7 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_reorder_levels.cpython-310.pyc ADDED
Binary file (2.31 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_replace.cpython-310.pyc ADDED
Binary file (44.9 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_round.cpython-310.pyc ADDED
Binary file (6.12 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_select_dtypes.cpython-310.pyc ADDED
Binary file (14.6 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_set_axis.cpython-310.pyc ADDED
Binary file (4.78 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_shift.cpython-310.pyc ADDED
Binary file (23 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_size.cpython-310.pyc ADDED
Binary file (758 Bytes). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_sort_index.cpython-310.pyc ADDED
Binary file (25.9 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_sort_values.cpython-310.pyc ADDED
Binary file (24.9 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_to_dict.cpython-310.pyc ADDED
Binary file (15 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_to_dict_of_blocks.cpython-310.pyc ADDED
Binary file (2.45 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_to_numpy.cpython-310.pyc ADDED
Binary file (2 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_to_period.cpython-310.pyc ADDED
Binary file (3.03 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_to_records.cpython-310.pyc ADDED
Binary file (11.8 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_truncate.cpython-310.pyc ADDED
Binary file (4.96 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/__pycache__/test_tz_localize.cpython-310.pyc ADDED
Binary file (2.3 kB). View file
 
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/test_add_prefix_suffix.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pytest
2
+
3
+ from pandas import Index
4
+ import pandas._testing as tm
5
+
6
+
7
+ def test_add_prefix_suffix(float_frame):
8
+ with_prefix = float_frame.add_prefix("foo#")
9
+ expected = Index([f"foo#{c}" for c in float_frame.columns])
10
+ tm.assert_index_equal(with_prefix.columns, expected)
11
+
12
+ with_suffix = float_frame.add_suffix("#foo")
13
+ expected = Index([f"{c}#foo" for c in float_frame.columns])
14
+ tm.assert_index_equal(with_suffix.columns, expected)
15
+
16
+ with_pct_prefix = float_frame.add_prefix("%")
17
+ expected = Index([f"%{c}" for c in float_frame.columns])
18
+ tm.assert_index_equal(with_pct_prefix.columns, expected)
19
+
20
+ with_pct_suffix = float_frame.add_suffix("%")
21
+ expected = Index([f"{c}%" for c in float_frame.columns])
22
+ tm.assert_index_equal(with_pct_suffix.columns, expected)
23
+
24
+
25
+ def test_add_prefix_suffix_axis(float_frame):
26
+ # GH 47819
27
+ with_prefix = float_frame.add_prefix("foo#", axis=0)
28
+ expected = Index([f"foo#{c}" for c in float_frame.index])
29
+ tm.assert_index_equal(with_prefix.index, expected)
30
+
31
+ with_prefix = float_frame.add_prefix("foo#", axis=1)
32
+ expected = Index([f"foo#{c}" for c in float_frame.columns])
33
+ tm.assert_index_equal(with_prefix.columns, expected)
34
+
35
+ with_pct_suffix = float_frame.add_suffix("#foo", axis=0)
36
+ expected = Index([f"{c}#foo" for c in float_frame.index])
37
+ tm.assert_index_equal(with_pct_suffix.index, expected)
38
+
39
+ with_pct_suffix = float_frame.add_suffix("#foo", axis=1)
40
+ expected = Index([f"{c}#foo" for c in float_frame.columns])
41
+ tm.assert_index_equal(with_pct_suffix.columns, expected)
42
+
43
+
44
+ def test_add_prefix_suffix_invalid_axis(float_frame):
45
+ with pytest.raises(ValueError, match="No axis named 2 for object type DataFrame"):
46
+ float_frame.add_prefix("foo#", axis=2)
47
+
48
+ with pytest.raises(ValueError, match="No axis named 2 for object type DataFrame"):
49
+ float_frame.add_suffix("foo#", axis=2)
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/test_asof.py ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import pytest
3
+
4
+ from pandas._libs.tslibs import IncompatibleFrequency
5
+
6
+ from pandas import (
7
+ DataFrame,
8
+ Period,
9
+ Series,
10
+ Timestamp,
11
+ date_range,
12
+ period_range,
13
+ to_datetime,
14
+ )
15
+ import pandas._testing as tm
16
+
17
+
18
+ @pytest.fixture
19
+ def date_range_frame():
20
+ """
21
+ Fixture for DataFrame of ints with date_range index
22
+
23
+ Columns are ['A', 'B'].
24
+ """
25
+ N = 50
26
+ rng = date_range("1/1/1990", periods=N, freq="53s")
27
+ return DataFrame({"A": np.arange(N), "B": np.arange(N)}, index=rng)
28
+
29
+
30
+ class TestFrameAsof:
31
+ def test_basic(self, date_range_frame):
32
+ # Explicitly cast to float to avoid implicit cast when setting np.nan
33
+ df = date_range_frame.astype({"A": "float"})
34
+ N = 50
35
+ df.loc[df.index[15:30], "A"] = np.nan
36
+ dates = date_range("1/1/1990", periods=N * 3, freq="25s")
37
+
38
+ result = df.asof(dates)
39
+ assert result.notna().all(1).all()
40
+ lb = df.index[14]
41
+ ub = df.index[30]
42
+
43
+ dates = list(dates)
44
+
45
+ result = df.asof(dates)
46
+ assert result.notna().all(1).all()
47
+
48
+ mask = (result.index >= lb) & (result.index < ub)
49
+ rs = result[mask]
50
+ assert (rs == 14).all(1).all()
51
+
52
+ def test_subset(self, date_range_frame):
53
+ N = 10
54
+ # explicitly cast to float to avoid implicit upcast when setting to np.nan
55
+ df = date_range_frame.iloc[:N].copy().astype({"A": "float"})
56
+ df.loc[df.index[4:8], "A"] = np.nan
57
+ dates = date_range("1/1/1990", periods=N * 3, freq="25s")
58
+
59
+ # with a subset of A should be the same
60
+ result = df.asof(dates, subset="A")
61
+ expected = df.asof(dates)
62
+ tm.assert_frame_equal(result, expected)
63
+
64
+ # same with A/B
65
+ result = df.asof(dates, subset=["A", "B"])
66
+ expected = df.asof(dates)
67
+ tm.assert_frame_equal(result, expected)
68
+
69
+ # B gives df.asof
70
+ result = df.asof(dates, subset="B")
71
+ expected = df.resample("25s", closed="right").ffill().reindex(dates)
72
+ expected.iloc[20:] = 9
73
+ # no "missing", so "B" can retain int dtype (df["A"].dtype platform-dependent)
74
+ expected["B"] = expected["B"].astype(df["B"].dtype)
75
+
76
+ tm.assert_frame_equal(result, expected)
77
+
78
+ def test_missing(self, date_range_frame):
79
+ # GH 15118
80
+ # no match found - `where` value before earliest date in index
81
+ N = 10
82
+ # Cast to 'float64' to avoid upcast when introducing nan in df.asof
83
+ df = date_range_frame.iloc[:N].copy().astype("float64")
84
+
85
+ result = df.asof("1989-12-31")
86
+
87
+ expected = Series(
88
+ index=["A", "B"], name=Timestamp("1989-12-31"), dtype=np.float64
89
+ )
90
+ tm.assert_series_equal(result, expected)
91
+
92
+ result = df.asof(to_datetime(["1989-12-31"]))
93
+ expected = DataFrame(
94
+ index=to_datetime(["1989-12-31"]), columns=["A", "B"], dtype="float64"
95
+ )
96
+ tm.assert_frame_equal(result, expected)
97
+
98
+ # Check that we handle PeriodIndex correctly, dont end up with
99
+ # period.ordinal for series name
100
+ df = df.to_period("D")
101
+ result = df.asof("1989-12-31")
102
+ assert isinstance(result.name, Period)
103
+
104
+ def test_asof_all_nans(self, frame_or_series):
105
+ # GH 15713
106
+ # DataFrame/Series is all nans
107
+ result = frame_or_series([np.nan]).asof([0])
108
+ expected = frame_or_series([np.nan])
109
+ tm.assert_equal(result, expected)
110
+
111
+ def test_all_nans(self, date_range_frame):
112
+ # GH 15713
113
+ # DataFrame is all nans
114
+
115
+ # testing non-default indexes, multiple inputs
116
+ N = 150
117
+ rng = date_range_frame.index
118
+ dates = date_range("1/1/1990", periods=N, freq="25s")
119
+ result = DataFrame(np.nan, index=rng, columns=["A"]).asof(dates)
120
+ expected = DataFrame(np.nan, index=dates, columns=["A"])
121
+ tm.assert_frame_equal(result, expected)
122
+
123
+ # testing multiple columns
124
+ dates = date_range("1/1/1990", periods=N, freq="25s")
125
+ result = DataFrame(np.nan, index=rng, columns=["A", "B", "C"]).asof(dates)
126
+ expected = DataFrame(np.nan, index=dates, columns=["A", "B", "C"])
127
+ tm.assert_frame_equal(result, expected)
128
+
129
+ # testing scalar input
130
+ result = DataFrame(np.nan, index=[1, 2], columns=["A", "B"]).asof([3])
131
+ expected = DataFrame(np.nan, index=[3], columns=["A", "B"])
132
+ tm.assert_frame_equal(result, expected)
133
+
134
+ result = DataFrame(np.nan, index=[1, 2], columns=["A", "B"]).asof(3)
135
+ expected = Series(np.nan, index=["A", "B"], name=3)
136
+ tm.assert_series_equal(result, expected)
137
+
138
+ @pytest.mark.parametrize(
139
+ "stamp,expected",
140
+ [
141
+ (
142
+ Timestamp("2018-01-01 23:22:43.325+00:00"),
143
+ Series(2, name=Timestamp("2018-01-01 23:22:43.325+00:00")),
144
+ ),
145
+ (
146
+ Timestamp("2018-01-01 22:33:20.682+01:00"),
147
+ Series(1, name=Timestamp("2018-01-01 22:33:20.682+01:00")),
148
+ ),
149
+ ],
150
+ )
151
+ def test_time_zone_aware_index(self, stamp, expected):
152
+ # GH21194
153
+ # Testing awareness of DataFrame index considering different
154
+ # UTC and timezone
155
+ df = DataFrame(
156
+ data=[1, 2],
157
+ index=[
158
+ Timestamp("2018-01-01 21:00:05.001+00:00"),
159
+ Timestamp("2018-01-01 22:35:10.550+00:00"),
160
+ ],
161
+ )
162
+
163
+ result = df.asof(stamp)
164
+ tm.assert_series_equal(result, expected)
165
+
166
+ def test_is_copy(self, date_range_frame):
167
+ # GH-27357, GH-30784: ensure the result of asof is an actual copy and
168
+ # doesn't track the parent dataframe / doesn't give SettingWithCopy warnings
169
+ df = date_range_frame.astype({"A": "float"})
170
+ N = 50
171
+ df.loc[df.index[15:30], "A"] = np.nan
172
+ dates = date_range("1/1/1990", periods=N * 3, freq="25s")
173
+
174
+ result = df.asof(dates)
175
+
176
+ with tm.assert_produces_warning(None):
177
+ result["C"] = 1
178
+
179
+ def test_asof_periodindex_mismatched_freq(self):
180
+ N = 50
181
+ rng = period_range("1/1/1990", periods=N, freq="h")
182
+ df = DataFrame(np.random.default_rng(2).standard_normal(N), index=rng)
183
+
184
+ # Mismatched freq
185
+ msg = "Input has different freq"
186
+ with pytest.raises(IncompatibleFrequency, match=msg):
187
+ df.asof(rng.asfreq("D"))
188
+
189
+ def test_asof_preserves_bool_dtype(self):
190
+ # GH#16063 was casting bools to floats
191
+ dti = date_range("2017-01-01", freq="MS", periods=4)
192
+ ser = Series([True, False, True], index=dti[:-1])
193
+
194
+ ts = dti[-1]
195
+ res = ser.asof([ts])
196
+
197
+ expected = Series([True], index=[ts])
198
+ tm.assert_series_equal(res, expected)
vllm/lib/python3.10/site-packages/pandas/tests/frame/methods/test_at_time.py ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import time
2
+
3
+ import numpy as np
4
+ import pytest
5
+ import pytz
6
+
7
+ from pandas._libs.tslibs import timezones
8
+
9
+ from pandas import (
10
+ DataFrame,
11
+ date_range,
12
+ )
13
+ import pandas._testing as tm
14
+
15
+
16
+ class TestAtTime:
17
+ @pytest.mark.parametrize("tzstr", ["US/Eastern", "dateutil/US/Eastern"])
18
+ def test_localized_at_time(self, tzstr, frame_or_series):
19
+ tz = timezones.maybe_get_tz(tzstr)
20
+
21
+ rng = date_range("4/16/2012", "5/1/2012", freq="h")
22
+ ts = frame_or_series(
23
+ np.random.default_rng(2).standard_normal(len(rng)), index=rng
24
+ )
25
+
26
+ ts_local = ts.tz_localize(tzstr)
27
+
28
+ result = ts_local.at_time(time(10, 0))
29
+ expected = ts.at_time(time(10, 0)).tz_localize(tzstr)
30
+ tm.assert_equal(result, expected)
31
+ assert timezones.tz_compare(result.index.tz, tz)
32
+
33
+ def test_at_time(self, frame_or_series):
34
+ rng = date_range("1/1/2000", "1/5/2000", freq="5min")
35
+ ts = DataFrame(
36
+ np.random.default_rng(2).standard_normal((len(rng), 2)), index=rng
37
+ )
38
+ ts = tm.get_obj(ts, frame_or_series)
39
+ rs = ts.at_time(rng[1])
40
+ assert (rs.index.hour == rng[1].hour).all()
41
+ assert (rs.index.minute == rng[1].minute).all()
42
+ assert (rs.index.second == rng[1].second).all()
43
+
44
+ result = ts.at_time("9:30")
45
+ expected = ts.at_time(time(9, 30))
46
+ tm.assert_equal(result, expected)
47
+
48
+ def test_at_time_midnight(self, frame_or_series):
49
+ # midnight, everything
50
+ rng = date_range("1/1/2000", "1/31/2000")
51
+ ts = DataFrame(
52
+ np.random.default_rng(2).standard_normal((len(rng), 3)), index=rng
53
+ )
54
+ ts = tm.get_obj(ts, frame_or_series)
55
+
56
+ result = ts.at_time(time(0, 0))
57
+ tm.assert_equal(result, ts)
58
+
59
+ def test_at_time_nonexistent(self, frame_or_series):
60
+ # time doesn't exist
61
+ rng = date_range("1/1/2012", freq="23Min", periods=384)
62
+ ts = DataFrame(np.random.default_rng(2).standard_normal(len(rng)), rng)
63
+ ts = tm.get_obj(ts, frame_or_series)
64
+ rs = ts.at_time("16:00")
65
+ assert len(rs) == 0
66
+
67
+ @pytest.mark.parametrize(
68
+ "hour", ["1:00", "1:00AM", time(1), time(1, tzinfo=pytz.UTC)]
69
+ )
70
+ def test_at_time_errors(self, hour):
71
+ # GH#24043
72
+ dti = date_range("2018", periods=3, freq="h")
73
+ df = DataFrame(list(range(len(dti))), index=dti)
74
+ if getattr(hour, "tzinfo", None) is None:
75
+ result = df.at_time(hour)
76
+ expected = df.iloc[1:2]
77
+ tm.assert_frame_equal(result, expected)
78
+ else:
79
+ with pytest.raises(ValueError, match="Index must be timezone"):
80
+ df.at_time(hour)
81
+
82
+ def test_at_time_tz(self):
83
+ # GH#24043
84
+ dti = date_range("2018", periods=3, freq="h", tz="US/Pacific")
85
+ df = DataFrame(list(range(len(dti))), index=dti)
86
+ result = df.at_time(time(4, tzinfo=pytz.timezone("US/Eastern")))
87
+ expected = df.iloc[1:2]
88
+ tm.assert_frame_equal(result, expected)
89
+
90
+ def test_at_time_raises(self, frame_or_series):
91
+ # GH#20725
92
+ obj = DataFrame([[1, 2, 3], [4, 5, 6]])
93
+ obj = tm.get_obj(obj, frame_or_series)
94
+ msg = "Index must be DatetimeIndex"
95
+ with pytest.raises(TypeError, match=msg): # index is not a DatetimeIndex
96
+ obj.at_time("00:00")
97
+
98
+ @pytest.mark.parametrize("axis", ["index", "columns", 0, 1])
99
+ def test_at_time_axis(self, axis):
100
+ # issue 8839
101
+ rng = date_range("1/1/2000", "1/5/2000", freq="5min")
102
+ ts = DataFrame(np.random.default_rng(2).standard_normal((len(rng), len(rng))))
103
+ ts.index, ts.columns = rng, rng
104
+
105
+ indices = rng[(rng.hour == 9) & (rng.minute == 30) & (rng.second == 0)]
106
+
107
+ if axis in ["index", 0]:
108
+ expected = ts.loc[indices, :]
109
+ elif axis in ["columns", 1]:
110
+ expected = ts.loc[:, indices]
111
+
112
+ result = ts.at_time("9:30", axis=axis)
113
+
114
+ # Without clearing freq, result has freq 1440T and expected 5T
115
+ result.index = result.index._with_freq(None)
116
+ expected.index = expected.index._with_freq(None)
117
+ tm.assert_frame_equal(result, expected)
118
+
119
+ def test_at_time_datetimeindex(self):
120
+ index = date_range("2012-01-01", "2012-01-05", freq="30min")
121
+ df = DataFrame(
122
+ np.random.default_rng(2).standard_normal((len(index), 5)), index=index
123
+ )
124
+ akey = time(12, 0, 0)
125
+ ainds = [24, 72, 120, 168]
126
+
127
+ result = df.at_time(akey)
128
+ expected = df.loc[akey]
129
+ expected2 = df.iloc[ainds]
130
+ tm.assert_frame_equal(result, expected)
131
+ tm.assert_frame_equal(result, expected2)
132
+ assert len(result) == 4