Skip to content

Commit 1cc4e89

Browse files
author
MomIsBestFriend
committed
Reverted some of the changes made due to the merge conflicts
1 parent 21f5020 commit 1cc4e89

File tree

2 files changed

+49
-23
lines changed

2 files changed

+49
-23
lines changed

pandas/_libs/tslib.pyx

Lines changed: 46 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -67,41 +67,65 @@ from pandas._libs.tslibs.tzconversion cimport (
6767

6868

6969
cdef inline object create_datetime_from_ts(
70-
int64_t value, npy_datetimestruct dts,
71-
object tz, object freq, bint fold):
72-
""" convenience routine to construct a datetime.datetime from its parts """
73-
return datetime(dts.year, dts.month, dts.day, dts.hour,
74-
dts.min, dts.sec, dts.us, tz, fold=fold)
70+
int64_t value,
71+
npy_datetimestruct dts,
72+
object tz,
73+
object freq,
74+
bint fold
75+
):
76+
"""
77+
Convenience routine to construct a datetime.datetime from its parts.
78+
"""
79+
return datetime(
80+
dts.year, dts.month, dts.day, dts.hour, dts.min, dts.sec, dts.us, tz, fold=fold
81+
)
7582

7683

7784
cdef inline object create_date_from_ts(
78-
int64_t value, npy_datetimestruct dts,
79-
object tz, object freq, bint fold):
80-
""" convenience routine to construct a datetime.date from its parts """
85+
int64_t value,
86+
npy_datetimestruct dts,
87+
object tz,
88+
object freq,
89+
bint fold
90+
):
91+
"""
92+
Convenience routine to construct a datetime.date from its parts.
93+
"""
8194
# GH 25057 add fold argument to match other func_create signatures
8295
return date(dts.year, dts.month, dts.day)
8396

8497

8598
cdef inline object create_time_from_ts(
86-
int64_t value, npy_datetimestruct dts,
87-
object tz, object freq, bint fold):
88-
""" convenience routine to construct a datetime.time from its parts """
99+
int64_t value,
100+
npy_datetimestruct dts,
101+
object tz,
102+
object freq,
103+
bint fold
104+
):
105+
"""
106+
Convenience routine to construct a datetime.time from its parts.
107+
"""
89108
return time(dts.hour, dts.min, dts.sec, dts.us, tz, fold=fold)
90109

91110

92111
@cython.wraparound(False)
93112
@cython.boundscheck(False)
94-
def ints_to_pydatetime(const int64_t[:] arr, object tz=None, object freq=None,
95-
bint fold=0, str box="datetime"):
113+
def ints_to_pydatetime(
114+
const int64_t[:] arr,
115+
object tz=None,
116+
object freq=None,
117+
bint fold=0,
118+
str box="datetime"
119+
):
96120
"""
97-
Convert an i8 repr to an ndarray of datetimes, date, time or Timestamp
121+
Convert an i8 repr to an ndarray of datetimes, date, time or Timestamp.
98122
99123
Parameters
100124
----------
101-
arr : array of i8
102-
tz : str, default None
125+
arr : array of i8
126+
tz : str, optional
103127
convert to this timezone
104-
freq : str/Offset, default None
128+
freq : str/Offset, optional
105129
freq to convert
106130
fold : bint, default is 0
107131
Due to daylight saving time, one wall clock time can occur twice
@@ -110,11 +134,11 @@ def ints_to_pydatetime(const int64_t[:] arr, object tz=None, object freq=None,
110134
the wall clock hits the ambiguous time
111135
112136
.. versionadded:: 1.1.0
113-
box : {'datetime', 'timestamp', 'date', 'time'}, default 'datetime'
114-
If datetime, convert to datetime.datetime
115-
If date, convert to datetime.date
116-
If time, convert to datetime.time
117-
If Timestamp, convert to pandas.Timestamp
137+
box : {'datetime', 'timestamp', 'date', 'time'}, default 'datetime'
138+
* If datetime, convert to datetime.datetime
139+
* If date, convert to datetime.date
140+
* If time, convert to datetime.time
141+
* If Timestamp, convert to pandas.Timestamp
118142
119143
Returns
120144
-------

pandas/_libs/tslibs/nattype.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,9 @@ NaT = c_NaT # Python-visible
764764
# ----------------------------------------------------------------------
765765

766766
cdef inline bint checknull_with_nat(object val):
767-
""" utility to check if a value is a nat or not """
767+
"""
768+
Utility to check if a value is a nat or not.
769+
"""
768770
return val is None or util.is_nan(val) or val is c_NaT or val is C_NA
769771

770772

0 commit comments

Comments
 (0)