Skip to content

Commit 5774290

Browse files
authored
DOC: Add to_julian_date to DatetimeIndex methods listing (#62090)
1 parent e68817b commit 5774290

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

doc/source/reference/indexing.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,7 @@ Conversion
390390
DatetimeIndex.to_pydatetime
391391
DatetimeIndex.to_series
392392
DatetimeIndex.to_frame
393+
DatetimeIndex.to_julian_date
393394

394395
Methods
395396
~~~~~~~

pandas/core/arrays/datetimes.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2254,9 +2254,26 @@ def isocalendar(self) -> DataFrame:
22542254

22552255
def to_julian_date(self) -> npt.NDArray[np.float64]:
22562256
"""
2257-
Convert Datetime Array to float64 ndarray of Julian Dates.
2258-
0 Julian date is noon January 1, 4713 BC.
2257+
Convert TimeStamp to a Julian Date.
2258+
2259+
This method returns the number of days as a float since noon January 1, 4713 BC.
2260+
22592261
https://en.wikipedia.org/wiki/Julian_day
2262+
2263+
Returns
2264+
-------
2265+
ndarray or Index
2266+
Float values that represent each date in Julian Calendar.
2267+
2268+
See Also
2269+
--------
2270+
Timestamp.to_julian_date : Equivalent method on ``Timestamp`` objects.
2271+
2272+
Examples
2273+
--------
2274+
>>> idx = pd.DatetimeIndex(["2028-08-12 00:54", "2028-08-12 02:06"])
2275+
>>> idx.to_julian_date()
2276+
Index([2461995.5375, 2461995.5875], dtype='float64')
22602277
"""
22612278

22622279
# http://mysite.verizon.net/aesir_research/date/jdalg2.htm

pandas/core/indexes/datetimes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ class DatetimeIndex(DatetimeTimedeltaMixin):
222222
to_pydatetime
223223
to_series
224224
to_frame
225+
to_julian_date
225226
month_name
226227
day_name
227228
mean

0 commit comments

Comments
 (0)