Skip to content

Commit 79d63d4

Browse files
Format comments, test for NaT
1 parent 0ac786f commit 79d63d4

File tree

2 files changed

+21
-17
lines changed

2 files changed

+21
-17
lines changed

pandas/tseries/tests/test_tslib.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ def test_constructor_positional(self):
202202
repr(Timestamp(2015, 11, 12, 1, 2, 3, 999999)),
203203
repr(Timestamp('2015-11-12 01:02:03.999999')))
204204

205+
self.assertIs(Timestamp(None), pd.NaT)
206+
205207
def test_constructor_keyword(self):
206208
# GH 10758
207209
with tm.assertRaises(TypeError):

pandas/tslib.pyx

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,6 @@ cdef inline bint _is_fixed_offset(object tz):
214214
return 0
215215
return 1
216216

217-
218217
_zero_time = datetime_time(0, 0)
219218
_no_input = object()
220219

@@ -241,22 +240,22 @@ class Timestamp(_Timestamp):
241240
unit : string
242241
numpy unit used for conversion, if ts_input is int or float
243242
244-
The other two forms mimic the parameters from datetime.datetime. They can
245-
be passed by either position or keyword, but not both mixed together.
243+
The other two forms mimic the parameters from ``datetime.datetime``. They
244+
can be passed by either position or keyword, but not both mixed together.
246245
247246
:func:`datetime.datetime` Parameters
248-
------------------------------
247+
------------------------------------
249248
250249
.. versionadded:: 0.18.2
251250
252251
year : int
253252
month : int
254253
day : int
255-
hour : int [optional]
256-
minute : int [optional]
257-
second : int [optional]
258-
microsecond : int [optional]
259-
tzinfo : datetime.tzinfo [optional]
254+
hour : int, optional, default is 0
255+
minute : int, optional, default is 0
256+
second : int, optional, default is 0
257+
microsecond : int, optional, default is 0
258+
tzinfo : datetime.tzinfo, optional, default is None
260259
"""
261260

262261
@classmethod
@@ -319,17 +318,20 @@ class Timestamp(_Timestamp):
319318
# four) and positional and keyword parameter names from pydatetime.
320319
#
321320
# There are three calling forms:
321+
#
322322
# - In the legacy form, the first parameter, ts_input, is required
323-
# and may be datetime-like, str, int, or float. The second parameter,
324-
# offset, is optional and may be str or DateOffset.
323+
# and may be datetime-like, str, int, or float. The second
324+
# parameter, offset, is optional and may be str or DateOffset.
325+
#
325326
# - ints in the first, second, and third arguments indicate
326-
# pydatetime positional arguments. Only the first 8 arguments
327-
# (standing in for year, month, day, hour, minute, second,
328-
# microsecond, tzinfo) may be non-None. As a shortcut, we just check
329-
# that the second argument is an int.
327+
# pydatetime positional arguments. Only the first 8 arguments
328+
# (standing in for year, month, day, hour, minute, second,
329+
# microsecond, tzinfo) may be non-None. As a shortcut, we just
330+
# check that the second argument is an int.
331+
#
330332
# - Nones for the first four (legacy) arguments indicate pydatetime
331-
# keyword arguments. year, month, and day are required. As a
332-
# shortcut, we just check that the first argument was not passed.
333+
# keyword arguments. year, month, and day are required. As a
334+
# shortcut, we just check that the first argument was not passed.
333335
#
334336
# Mixing pydatetime positional and keyword arguments is forbidden!
335337

0 commit comments

Comments
 (0)