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 20
20
21
21
import numpy as np
22
22
23
- from pandas .core .algorithms import take
24
23
from pandas ._config .config import get_option
25
24
26
25
from pandas ._libs import (
67
66
ScalarIndexer ,
68
67
Self ,
69
68
SequenceIndexer ,
69
+ TakeIndexer ,
70
70
TimeAmbiguous ,
71
71
TimeNonexistent ,
72
- TakeIndexer ,
73
72
npt ,
74
73
)
75
74
from pandas .compat .numpy import function as nv
119
118
from pandas .core .algorithms import (
120
119
isin ,
121
120
map_array ,
121
+ take ,
122
122
unique1d ,
123
123
)
124
124
from pandas .core .array_algos import datetimelike_accumulations
@@ -2386,6 +2386,7 @@ def take(
2386
2386
axis = axis ,
2387
2387
)
2388
2388
result = self ._from_backing_data (new_data )
2389
+
2389
2390
indices = np .asarray (indices , dtype = np .intp )
2390
2391
maybe_slice = lib .maybe_indices_to_slice (indices , len (self ))
2391
2392
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