| 130 | |
| 131 | |
| 132 | def test_map_box(): |
| 133 | # ufunc will not be boxed. Same test cases as the test_map_box |
| 134 | df = DataFrame( |
| 135 | { |
| 136 | "a": [Timestamp("2011-01-01"), Timestamp("2011-01-02")], |
| 137 | "b": [ |
| 138 | Timestamp("2011-01-01", tz="US/Eastern"), |
| 139 | Timestamp("2011-01-02", tz="US/Eastern"), |
| 140 | ], |
| 141 | "c": [pd.Timedelta("1 days"), pd.Timedelta("2 days")], |
| 142 | "d": [ |
| 143 | pd.Period("2011-01-01", freq="M"), |
| 144 | pd.Period("2011-01-02", freq="M"), |
| 145 | ], |
| 146 | } |
| 147 | ) |
| 148 | |
| 149 | result = df.map(lambda x: type(x).__name__) |
| 150 | expected = DataFrame( |
| 151 | { |
| 152 | "a": ["Timestamp", "Timestamp"], |
| 153 | "b": ["Timestamp", "Timestamp"], |
| 154 | "c": ["Timedelta", "Timedelta"], |
| 155 | "d": ["Period", "Period"], |
| 156 | } |
| 157 | ) |
| 158 | tm.assert_frame_equal(result, expected) |
| 159 | |
| 160 | |
| 161 | def test_frame_map_dont_convert_datetime64(unit): |