@@ -219,7 +219,7 @@ def to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False,
219
219
exact : boolean, True by default
220
220
- If True, require an exact format match.
221
221
- If False, allow the format to match anywhere in the target string.
222
- unit : unit of the arg (D,s,ms,us,ns) denote the unit in epoch
222
+ unit : unit of the arg (D,s,ms,us,ns,julian ) denote the unit in epoch
223
223
(e.g. a unix timestamp), which is an integer/float number.
224
224
infer_datetime_format : boolean, default False
225
225
If no `format` is given, try to infer the format based on the first
@@ -271,6 +271,11 @@ def to_datetime(arg, errors='raise', dayfirst=False, yearfirst=False,
271
271
>>> pd.to_datetime('13000101', format='%Y%m%d', errors='coerce')
272
272
NaT
273
273
"""
274
+ if unit == 'julian' :
275
+ from pandas .core .api import Timestamp
276
+ unit = 'D'
277
+ arg = arg - Timestamp (0 ).to_julian_date ()
278
+
274
279
return _to_datetime (arg , errors = errors , dayfirst = dayfirst , yearfirst = yearfirst ,
275
280
utc = utc , box = box , format = format , exact = exact ,
276
281
unit = unit , infer_datetime_format = infer_datetime_format )
0 commit comments