Skip to content

Commit 59f29e7

Browse files
author
Josiah Baker
committed
DOC: fix PR09 doc string errors in Timestamp class
This fixes Parameter {} description should finish with "." in the Timestamp class closes pandas-dev#28673
1 parent ad3280e commit 59f29e7

File tree

1 file changed

+113
-96
lines changed

1 file changed

+113
-96
lines changed

pandas/_libs/tslibs/timestamps.pyx

+113-96
Original file line numberDiff line numberDiff line change
@@ -251,11 +251,11 @@ class Timestamp(_Timestamp):
251251
Parameters
252252
----------
253253
ordinal : int
254-
date corresponding to a proleptic Gregorian ordinal
254+
Date corresponding to a proleptic Gregorian ordinal.
255255
freq : str, DateOffset
256-
Offset which Timestamp will have
256+
Offset to apply to the Timestamp.
257257
tz : str, pytz.timezone, dateutil.tz.tzfile or None
258-
Time zone for time which Timestamp will have.
258+
Time zone for the Timestamp.
259259
"""
260260
return cls(datetime.fromordinal(ordinal),
261261
freq=freq, tz=tz)
@@ -271,7 +271,7 @@ class Timestamp(_Timestamp):
271271
Parameters
272272
----------
273273
tz : str or timezone object, default None
274-
Timezone to localize to
274+
Timezone to localize to.
275275
"""
276276
if isinstance(tz, str):
277277
tz = maybe_get_tz(tz)
@@ -289,7 +289,7 @@ class Timestamp(_Timestamp):
289289
Parameters
290290
----------
291291
tz : str or timezone object, default None
292-
Timezone to localize to
292+
Timezone to localize to.
293293
"""
294294
return cls.now(tz)
295295

@@ -445,29 +445,32 @@ class Timestamp(_Timestamp):
445445
446446
Parameters
447447
----------
448-
freq : a freq string indicating the rounding resolution
449-
ambiguous : bool, 'NaT', default 'raise'
450-
- bool contains flags to determine if time is dst or not (note
451-
that this flag is only applicable for ambiguous fall dst dates)
452-
- 'NaT' will return NaT for an ambiguous time
453-
- 'raise' will raise an AmbiguousTimeError for an ambiguous time
454-
455-
.. versionadded:: 0.24.0
456-
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
457-
default 'raise'
458-
A nonexistent time does not exist in a particular timezone
459-
where clocks moved forward due to DST.
460-
461-
- 'shift_forward' will shift the nonexistent time forward to the
462-
closest existing time
463-
- 'shift_backward' will shift the nonexistent time backward to the
464-
closest existing time
465-
- 'NaT' will return NaT where there are nonexistent times
466-
- timedelta objects will shift nonexistent times by the timedelta
467-
- 'raise' will raise an NonExistentTimeError if there are
468-
nonexistent times
469-
470-
.. versionadded:: 0.24.0
448+
freq : str
449+
Frequency string indicating the ceiling resolution.
450+
ambiguous : {'raise', 'NaT', bool}, default 'raise'
451+
The behavior is as follows:
452+
453+
* bool contains flags to determine if time is dst or not (note
454+
that this flag is only applicable for ambiguous fall dst dates).
455+
* 'NaT' will return NaT for an ambiguous time.
456+
* 'raise' will raise an AmbiguousTimeError for an ambiguous time.
457+
458+
.. versionadded:: 0.24.0.
459+
nonexistent : {'raise', 'shift_forward', 'shift_backward, 'NaT', \
460+
timedelta}, default 'raise'
461+
A nonexistent time does not exist in a particular timezone where
462+
clocks moved forward due to DST.
463+
464+
* 'shift_forward' will shift the nonexistent time forward to the
465+
closest existing time.
466+
* 'shift_backward' will shift the nonexistent time backward to the
467+
closest existing time.
468+
* 'NaT' will return NaT where there are nonexistent times.
469+
* timedelta objects will shift nonexistent times by the timedelta.
470+
* 'raise' will raise an NonExistentTimeError if there are
471+
nonexistent times.
472+
473+
.. versionadded:: 0.24.0.
471474
472475
Returns
473476
-------
@@ -487,33 +490,36 @@ default 'raise'
487490
488491
Parameters
489492
----------
490-
freq : a freq string indicating the flooring resolution
491-
ambiguous : bool, 'NaT', default 'raise'
492-
- bool contains flags to determine if time is dst or not (note
493-
that this flag is only applicable for ambiguous fall dst dates)
494-
- 'NaT' will return NaT for an ambiguous time
495-
- 'raise' will raise an AmbiguousTimeError for an ambiguous time
496-
497-
.. versionadded:: 0.24.0
498-
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
499-
default 'raise'
500-
A nonexistent time does not exist in a particular timezone
501-
where clocks moved forward due to DST.
502-
503-
- 'shift_forward' will shift the nonexistent time forward to the
504-
closest existing time
505-
- 'shift_backward' will shift the nonexistent time backward to the
506-
closest existing time
507-
- 'NaT' will return NaT where there are nonexistent times
508-
- timedelta objects will shift nonexistent times by the timedelta
509-
- 'raise' will raise an NonExistentTimeError if there are
510-
nonexistent times
511-
512-
.. versionadded:: 0.24.0
493+
freq : str
494+
Frequency string indicating the ceiling resolution.
495+
ambiguous : {'raise', 'NaT', bool}, default 'raise'
496+
The behavior is as follows:
497+
498+
* bool contains flags to determine if time is dst or not (note
499+
that this flag is only applicable for ambiguous fall dst dates).
500+
* 'NaT' will return NaT for an ambiguous time.
501+
* 'raise' will raise an AmbiguousTimeError for an ambiguous time.
502+
503+
.. versionadded:: 0.24.0.
504+
nonexistent : {'raise', 'shift_forward', 'shift_backward, 'NaT', \
505+
timedelta}, default 'raise'
506+
A nonexistent time does not exist in a particular timezone where
507+
clocks moved forward due to DST.
508+
509+
* 'shift_forward' will shift the nonexistent time forward to the
510+
closest existing time.
511+
* 'shift_backward' will shift the nonexistent time backward to the
512+
closest existing time.
513+
* 'NaT' will return NaT where there are nonexistent times.
514+
* timedelta objects will shift nonexistent times by the timedelta.
515+
* 'raise' will raise an NonExistentTimeError if there are
516+
nonexistent times.
517+
518+
.. versionadded:: 0.24.0.
513519
514520
Raises
515521
------
516-
ValueError if the freq cannot be converted
522+
ValueError if the freq cannot be converted.
517523
"""
518524
return self._round(freq, RoundTo.MINUS_INFTY, ambiguous, nonexistent)
519525

@@ -523,33 +529,36 @@ default 'raise'
523529
524530
Parameters
525531
----------
526-
freq : a freq string indicating the ceiling resolution
527-
ambiguous : bool, 'NaT', default 'raise'
528-
- bool contains flags to determine if time is dst or not (note
529-
that this flag is only applicable for ambiguous fall dst dates)
530-
- 'NaT' will return NaT for an ambiguous time
531-
- 'raise' will raise an AmbiguousTimeError for an ambiguous time
532-
533-
.. versionadded:: 0.24.0
534-
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
535-
default 'raise'
536-
A nonexistent time does not exist in a particular timezone
537-
where clocks moved forward due to DST.
538-
539-
- 'shift_forward' will shift the nonexistent time forward to the
540-
closest existing time
541-
- 'shift_backward' will shift the nonexistent time backward to the
542-
closest existing time
543-
- 'NaT' will return NaT where there are nonexistent times
544-
- timedelta objects will shift nonexistent times by the timedelta
545-
- 'raise' will raise an NonExistentTimeError if there are
546-
nonexistent times
547-
548-
.. versionadded:: 0.24.0
532+
freq : str
533+
Frequency string indicating the ceiling resolution.
534+
ambiguous : {'raise', 'NaT', bool}, default 'raise'
535+
The behavior is as follows:
536+
537+
* bool contains flags to determine if time is dst or not (note
538+
that this flag is only applicable for ambiguous fall dst dates).
539+
* 'NaT' will return NaT for an ambiguous time.
540+
* 'raise' will raise an AmbiguousTimeError for an ambiguous time.
541+
542+
.. versionadded:: 0.24.0.
543+
nonexistent : {'raise', 'shift_forward', 'shift_backward, 'NaT', \
544+
timedelta}, default 'raise'
545+
A nonexistent time does not exist in a particular timezone where
546+
clocks moved forward due to DST.
547+
548+
* 'shift_forward' will shift the nonexistent time forward to the
549+
closest existing time.
550+
* 'shift_backward' will shift the nonexistent time backward to the
551+
closest existing time.
552+
* 'NaT' will return NaT where there are nonexistent times.
553+
* timedelta objects will shift nonexistent times by the timedelta.
554+
* 'raise' will raise an NonExistentTimeError if there are
555+
nonexistent times.
556+
557+
.. versionadded:: 0.24.0.
549558
550559
Raises
551560
------
552-
ValueError if the freq cannot be converted
561+
ValueError if the freq cannot be converted.
553562
"""
554563
return self._round(freq, RoundTo.PLUS_INFTY, ambiguous, nonexistent)
555564

@@ -606,7 +615,7 @@ default 'raise'
606615
Parameters
607616
----------
608617
locale : string, default None (English locale)
609-
locale determining the language in which to return the day name
618+
Locale determining the language in which to return the day name.
610619
611620
Returns
612621
-------
@@ -623,7 +632,7 @@ default 'raise'
623632
Parameters
624633
----------
625634
locale : string, default None (English locale)
626-
locale determining the language in which to return the month name
635+
Locale determining the language in which to return the month name.
627636
628637
Returns
629638
-------
@@ -779,35 +788,43 @@ default 'raise'
779788
`ambiguous` parameter dictates how ambiguous times should be
780789
handled.
781790
782-
- bool contains flags to determine if time is dst or not (note
783-
that this flag is only applicable for ambiguous fall dst dates)
784-
- 'NaT' will return NaT for an ambiguous time
785-
- 'raise' will raise an AmbiguousTimeError for an ambiguous time
791+
The behavior is as follows:
792+
793+
* bool contains flags to determine if time is dst or not (note
794+
that this flag is only applicable for ambiguous fall dst dates).
795+
* 'NaT' will return NaT for an ambiguous time.
796+
* 'raise' will raise an AmbiguousTimeError for an ambiguous time.
786797
787798
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
788799
default 'raise'
789800
A nonexistent time does not exist in a particular timezone
790801
where clocks moved forward due to DST.
791802
792-
- 'shift_forward' will shift the nonexistent time forward to the
793-
closest existing time
794-
- 'shift_backward' will shift the nonexistent time backward to the
795-
closest existing time
796-
- 'NaT' will return NaT where there are nonexistent times
797-
- timedelta objects will shift nonexistent times by the timedelta
798-
- 'raise' will raise an NonExistentTimeError if there are
799-
nonexistent times
803+
The behavior is as follows:
800804
801-
.. versionadded:: 0.24.0
805+
* 'shift_forward' will shift the nonexistent time forward to the
806+
closest existing time.
807+
* 'shift_backward' will shift the nonexistent time backward to the
808+
closest existing time.
809+
* 'NaT' will return NaT where there are nonexistent times.
810+
* timedelta objects will shift nonexistent times by the timedelta.
811+
* 'raise' will raise an NonExistentTimeError if there are
812+
nonexistent times.
813+
814+
.. versionadded:: 0.24.0.
802815
803816
errors : 'raise', 'coerce', default None
804-
- 'raise' will raise a NonExistentTimeError if a timestamp is not
805-
valid in the specified timezone (e.g. due to a transition from
806-
or to DST time). Use ``nonexistent='raise'`` instead.
807-
- 'coerce' will return NaT if the timestamp can not be converted
817+
Determine how errors should be handled.
818+
819+
The behavior is as follows:
820+
821+
* 'raise' will raise a NonExistentTimeError if a timestamp is not
822+
valid in the specified timezone (e.g. due to a transition from
823+
or to DST time). Use ``nonexistent='raise'`` instead.
824+
* 'coerce' will return NaT if the timestamp can not be converted
808825
into the specified timezone. Use ``nonexistent='NaT'`` instead.
809826
810-
.. deprecated:: 0.24.0
827+
.. deprecated:: 0.24.0.
811828
812829
Returns
813830
-------

0 commit comments

Comments
 (0)