File tree 2 files changed +14
-2
lines changed
2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 19
19
20
20
import numpy as np
21
21
22
- from pandas .core .algorithms import take
23
22
from pandas ._config .config import get_option
24
23
25
24
from pandas ._libs import (
66
65
ScalarIndexer ,
67
66
Self ,
68
67
SequenceIndexer ,
68
+ TakeIndexer ,
69
69
TimeAmbiguous ,
70
70
TimeNonexistent ,
71
- TakeIndexer ,
72
71
npt ,
73
72
)
74
73
from pandas .compat .numpy import function as nv
118
117
from pandas .core .algorithms import (
119
118
isin ,
120
119
map_array ,
120
+ take ,
121
121
unique1d ,
122
122
)
123
123
from pandas .core .array_algos import datetimelike_accumulations
@@ -2357,6 +2357,7 @@ def take(
2357
2357
axis = axis ,
2358
2358
)
2359
2359
result = self ._from_backing_data (new_data )
2360
+
2360
2361
indices = np .asarray (indices , dtype = np .intp )
2361
2362
maybe_slice = lib .maybe_indices_to_slice (indices , len (self ))
2362
2363
Original file line number Diff line number Diff line change @@ -122,3 +122,14 @@ def test_values_loses_freq_of_underlying_index():
122
122
midx .values
123
123
assert idx .freq is not None
124
124
tm .assert_index_equal (idx , expected )
125
+
126
+
127
+ def test_get_level_values_gets_frequency_correctly ():
128
+ # GH#57949 GH#58327
129
+ datetime_index = pd .date_range (start = pd .to_datetime ("1/1/2018" ),
130
+ periods = 4 ,
131
+ freq = 'YS' )
132
+ other_index = ["A" ]
133
+ multi_index = pd .MultiIndex .from_product ([datetime_index , other_index ])
134
+
135
+ assert multi_index .get_level_values (0 ).freq is datetime_index .freq
You can’t perform that action at this time.
0 commit comments