Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pandas/_libs/groupby.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ cdef inline float64_t median_linear(float64_t* a, int n) nogil:
n -= na_count

if n % 2:
result = kth_smallest_c( a, n / 2, n)
result = kth_smallest_c( a, n // 2, n)
else:
result = (kth_smallest_c(a, n / 2, n) +
kth_smallest_c(a, n / 2 - 1, n)) / 2
result = (kth_smallest_c(a, n // 2, n) +
kth_smallest_c(a, n // 2 - 1, n)) / 2

if na_count:
free(a)
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslib.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def format_array_from_datetime(ndarray[int64_t] values, object tz=None,
dts.sec)

if show_ns:
ns = dts.ps / 1000
ns = dts.ps // 1000
res += '.%.9d' % (ns + 1000 * dts.us)
elif show_us:
res += '.%.6d' % dts.us
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/ccalendar.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ cpdef int32_t get_week_of_year(int year, int month, int day) nogil:
# estimate
woy = (doy - 1) - dow + 3
if woy >= 0:
woy = woy / 7 + 1
woy = woy // 7 + 1

# verify
if woy < 0:
Expand Down
4 changes: 2 additions & 2 deletions pandas/_libs/tslibs/conversion.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -455,8 +455,8 @@ cdef _TSObject convert_str_to_tsobject(object ts, object tz, object unit,
dt = datetime(obj.dts.year, obj.dts.month, obj.dts.day,
obj.dts.hour, obj.dts.min, obj.dts.sec,
obj.dts.us, obj.tzinfo)
obj = convert_datetime_to_tsobject(dt, tz,
nanos=obj.dts.ps / 1000)
obj = convert_datetime_to_tsobject(
dt, tz, nanos=obj.dts.ps // 1000)
return obj

else:
Expand Down
4 changes: 2 additions & 2 deletions pandas/_libs/tslibs/fields.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@ def get_date_field(ndarray[int64_t] dtindex, object field):
continue

dt64_to_dtstruct(dtindex[i], &dts)
out[i] = dts.ps / 1000
out[i] = dts.ps // 1000
return out
elif field == 'doy':
with nogil:
Expand Down Expand Up @@ -522,7 +522,7 @@ def get_date_field(ndarray[int64_t] dtindex, object field):

dt64_to_dtstruct(dtindex[i], &dts)
out[i] = dts.month
out[i] = ((out[i] - 1) / 3) + 1
out[i] = ((out[i] - 1) // 3) + 1
return out

elif field == 'dim':
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/offsets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ def shift_day(other: datetime, days: int) -> datetime:

cdef inline int year_add_months(npy_datetimestruct dts, int months) nogil:
"""new year number after shifting npy_datetimestruct number of months"""
return dts.year + (dts.month + months - 1) / 12
return dts.year + (dts.month + months - 1) // 12


cdef inline int month_add_months(npy_datetimestruct dts, int months) nogil:
Expand Down
6 changes: 3 additions & 3 deletions pandas/_libs/tslibs/strptime.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def array_strptime(object[:] values, object fmt,
s += "0" * (9 - len(s))
us = long(s)
ns = us % 1000
us = us / 1000
us = us // 1000
elif parse_code == 11:
weekday = locale_time.f_weekday.index(found_dict['A'].lower())
elif parse_code == 12:
Expand Down Expand Up @@ -662,7 +662,7 @@ cdef parse_timezone_directive(object z):
gmtoff_remainder_padding = "0" * pad_number
microseconds = int(gmtoff_remainder + gmtoff_remainder_padding)

total_minutes = ((hours * 60) + minutes + (seconds / 60) +
(microseconds / 60000000))
total_minutes = ((hours * 60) + minutes + (seconds // 60) +
(microseconds // 60000000))
total_minutes = -total_minutes if z.startswith("-") else total_minutes
return pytz.FixedOffset(total_minutes)
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ cdef inline object create_timestamp_from_ts(int64_t value,
dts.sec, dts.us, tz)
ts_base.value = value
ts_base.freq = freq
ts_base.nanosecond = dts.ps / 1000
ts_base.nanosecond = dts.ps // 1000

return ts_base

Expand Down
1 change: 0 additions & 1 deletion pandas/_libs/writers.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ from numpy cimport ndarray, uint8_t

ctypedef fused pandas_string:
str
unicode
bytes


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ def get_tag(self):
# Note: if not using `cythonize`, coverage can be enabled by
# pinning `ext.cython_directives = directives` to each ext in extensions.
# github.com/cython/cython/wiki/enhancements-compilerdirectives#in-setuppy
directives = {'linetrace': False}
directives = {'linetrace': False, 'language_level': 3}
macros = []
if linetrace:
# https://pypkg.com/pypi/pytest-cython/f/tests/example-project/setup.py
Expand Down