Skip to content

Commit 0c5f670

Browse files
committed
BLD: store labels as platform int in MultiIndex
1 parent 7c20c58 commit 0c5f670

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

pandas/core/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ def __new__(cls, levels=None, labels=None, sortorder=None, names=None):
11691169
return Index(levels[0], name=name).take(labels[0])
11701170

11711171
levels = [_ensure_index(lev) for lev in levels]
1172-
labels = [np.asarray(labs, dtype=np.int64) for labs in labels]
1172+
labels = [np.asarray(labs, dtype=np.int_) for labs in labels]
11731173

11741174
values = [ndtake(np.asarray(lev), lab)
11751175
for lev, lab in zip(levels, labels)]

pandas/src/datetime.pyx

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1394,40 +1394,40 @@ cdef int apply_accessor(accessor func, int64_t value, int freq,
13941394
return func(value, freq)
13951395

13961396
cpdef int get_period_year(int64_t value, int freq, int64_t mult) except -1:
1397-
return apply_accessor(pyear, value, freq, mult)
1397+
return apply_accessor(&pyear, value, freq, mult)
13981398

13991399
cpdef int get_period_qyear(int64_t value, int freq, int64_t mult) except -1:
1400-
return apply_accessor(pqyear, value, freq, mult)
1400+
return apply_accessor(&pqyear, value, freq, mult)
14011401

14021402
cpdef int get_period_quarter(int64_t value, int freq, int64_t mult) except -1:
1403-
return apply_accessor(pquarter, value, freq, mult)
1403+
return apply_accessor(&pquarter, value, freq, mult)
14041404

14051405
cpdef int get_period_month(int64_t value, int freq, int64_t mult) except -1:
1406-
return apply_accessor(pmonth, value, freq, mult)
1406+
return apply_accessor(&pmonth, value, freq, mult)
14071407

14081408
cpdef int get_period_day(int64_t value, int freq, int64_t mult) except -1:
1409-
return apply_accessor(pday, value, freq, mult)
1409+
return apply_accessor(&pday, value, freq, mult)
14101410

14111411
cpdef int get_period_hour(int64_t value, int freq, int64_t mult) except -1:
1412-
return apply_accessor(phour, value, freq, mult)
1412+
return apply_accessor(&phour, value, freq, mult)
14131413

14141414
cpdef int get_period_minute(int64_t value, int freq, int64_t mult) except -1:
1415-
return apply_accessor(pminute, value, freq, mult)
1415+
return apply_accessor(&pminute, value, freq, mult)
14161416

14171417
cpdef int get_period_second(int64_t value, int freq, int64_t mult) except -1:
1418-
return apply_accessor(psecond, value, freq, mult)
1418+
return apply_accessor(&psecond, value, freq, mult)
14191419

14201420
cpdef int get_period_dow(int64_t value, int freq, int64_t mult) except -1:
1421-
return apply_accessor(pday_of_week, value, freq, mult)
1421+
return apply_accessor(&pday_of_week, value, freq, mult)
14221422

14231423
cpdef int get_period_week(int64_t value, int freq, int64_t mult) except -1:
1424-
return apply_accessor(pweek, value, freq, mult)
1424+
return apply_accessor(&pweek, value, freq, mult)
14251425

14261426
cpdef int get_period_weekday(int64_t value, int freq, int64_t mult) except -1:
1427-
return apply_accessor(pweekday, value, freq, mult)
1427+
return apply_accessor(&pweekday, value, freq, mult)
14281428

14291429
cpdef int get_period_doy(int64_t value, int freq, int64_t mult) except -1:
1430-
return apply_accessor(pday_of_year, value, freq, mult)
1430+
return apply_accessor(&pday_of_year, value, freq, mult)
14311431

14321432
# same but for arrays
14331433

@@ -1448,40 +1448,40 @@ cdef ndarray[int64_t] apply_accessor_arr(accessor func,
14481448
return out
14491449

14501450
def get_period_year_arr(ndarray[int64_t] arr, int freq, int64_t mult):
1451-
return apply_accessor_arr(pyear, arr, freq, mult)
1451+
return apply_accessor_arr(&pyear, arr, freq, mult)
14521452

14531453
def get_period_qyear_arr(ndarray[int64_t] arr, int freq, int64_t mult):
1454-
return apply_accessor_arr(pqyear, arr, freq, mult)
1454+
return apply_accessor_arr(&pqyear, arr, freq, mult)
14551455

14561456
def get_period_quarter_arr(ndarray[int64_t] arr, int freq, int64_t mult):
1457-
return apply_accessor_arr(pquarter, arr, freq, mult)
1457+
return apply_accessor_arr(&pquarter, arr, freq, mult)
14581458

14591459
def get_period_month_arr(ndarray[int64_t] arr, int freq, int64_t mult):
1460-
return apply_accessor_arr(pmonth, arr, freq, mult)
1460+
return apply_accessor_arr(&pmonth, arr, freq, mult)
14611461

14621462
def get_period_day_arr(ndarray[int64_t] arr, int freq, int64_t mult):
1463-
return apply_accessor_arr(pday, arr, freq, mult)
1463+
return apply_accessor_arr(&pday, arr, freq, mult)
14641464

14651465
def get_period_hour_arr(ndarray[int64_t] arr, int freq, int64_t mult):
1466-
return apply_accessor_arr(phour, arr, freq, mult)
1466+
return apply_accessor_arr(&phour, arr, freq, mult)
14671467

14681468
def get_period_minute_arr(ndarray[int64_t] arr, int freq, int64_t mult):
1469-
return apply_accessor_arr(pminute, arr, freq, mult)
1469+
return apply_accessor_arr(&pminute, arr, freq, mult)
14701470

14711471
def get_period_second_arr(ndarray[int64_t] arr, int freq, int64_t mult):
1472-
return apply_accessor_arr(psecond, arr, freq, mult)
1472+
return apply_accessor_arr(&psecond, arr, freq, mult)
14731473

14741474
def get_period_dow_arr(ndarray[int64_t] arr, int freq, int64_t mult):
1475-
return apply_accessor_arr(pday_of_week, arr, freq, mult)
1475+
return apply_accessor_arr(&pday_of_week, arr, freq, mult)
14761476

14771477
def get_period_week_arr(ndarray[int64_t] arr, int freq, int64_t mult):
1478-
return apply_accessor_arr(pweek, arr, freq, mult)
1478+
return apply_accessor_arr(&pweek, arr, freq, mult)
14791479

14801480
def get_period_weekday_arr(ndarray[int64_t] arr, int freq, int64_t mult):
1481-
return apply_accessor_arr(pweekday, arr, freq, mult)
1481+
return apply_accessor_arr(&pweekday, arr, freq, mult)
14821482

14831483
def get_period_doy_arr(ndarray[int64_t] arr, int freq, int64_t mult):
1484-
return apply_accessor_arr(pday_of_year, arr, freq, mult)
1484+
return apply_accessor_arr(&pday_of_year, arr, freq, mult)
14851485

14861486
def get_abs_time(freq, dailyDate, originalDate):
14871487
return getAbsTime(freq, dailyDate, originalDate)

0 commit comments

Comments
 (0)