Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions doc/source/reference/indexing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ Conversion
DatetimeIndex.to_pydatetime
DatetimeIndex.to_series
DatetimeIndex.to_frame
DatetimeIndex.to_julian_date

Methods
~~~~~~~
Expand Down
21 changes: 19 additions & 2 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2254,9 +2254,26 @@ def isocalendar(self) -> DataFrame:

def to_julian_date(self) -> npt.NDArray[np.float64]:
"""
Convert Datetime Array to float64 ndarray of Julian Dates.
0 Julian date is noon January 1, 4713 BC.
Convert TimeStamp to a Julian Date.

This method returns the number of days as a float since noon January 1, 4713 BC.

https://en.wikipedia.org/wiki/Julian_day

Returns
-------
ndarray or Index
Float values that represent each date in Julian Calendar.

See Also
--------
Timestamp.to_julian_date : Equivalent method on ``Timestamp`` objects.

Examples
--------
>>> idx = pd.DatetimeIndex(["2028-08-12 00:54", "2028-08-12 02:06"])
>>> idx.to_julian_date()
Index([2461995.5375, 2461995.5875], dtype='float64')
"""

# http://mysite.verizon.net/aesir_research/date/jdalg2.htm
Expand Down
1 change: 1 addition & 0 deletions pandas/core/indexes/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ class DatetimeIndex(DatetimeTimedeltaMixin):
to_pydatetime
to_series
to_frame
to_julian_date
month_name
day_name
mean
Expand Down
Loading