Skip to content

BUG: Timestamp.to_julian_date() does not take into account timezone #54763

Open
@danmoser

Description

@danmoser

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
import pytz

ts = pd.Timestamp('1858-11-17T00:00:00.0', tzinfo=pytz.utc)
ts
# Timestamp('1858-11-17 00:00:00+0000', tz='UTC')
ts.to_julian_date()
# 2400000.5

ts = pd.Timestamp('1858-11-17T00:00:00.0', tzinfo=pytz.timezone('US/Mountain'))
ts
# Timestamp('1858-11-17 00:00:00-0700', tz='US/Mountain')
ts.to_julian_date()
# 2400000.5
# it should be 2400000.7916666665

pd.__version__
# '2.0.3'

pytz.__version__
# '2022.1'

Issue Description

Timestamp.to_julian_date() does not take into account the timezone information.

Expected Behavior

ts
# Timestamp('1858-11-17 00:00:00-0700', tz='US/Mountain')
ts.to_julian_date()
# 2400000.5
# it should be 2400000.7916666665

Installed Versions

INSTALLED VERSIONS
------------------
commit           : 0f437949513225922d851e9581723d82120684a6
python           : 3.8.13.final.0
python-bits      : 64
OS               : Linux
OS-release       : 4.18.0-372.32.1.el8_6.x86_64
Version          : #1 SMP Fri Oct 7 12:35:10 EDT 2022
machine          : x86_64
processor        : x86_64
byteorder        : little
LC_ALL           : None
LANG             : en_US.UTF-8
LOCALE           : en_US.UTF-8

pandas           : 2.0.3
numpy            : 1.23.1
pytz             : 2022.1
dateutil         : 2.8.2
setuptools       : 68.0.0
pip              : 23.2
Cython           : 0.29.15
pytest           : 7.3.1
hypothesis       : None
sphinx           : 4.3.0
blosc            : None
feather          : None
xlsxwriter       : None
lxml.etree       : 4.9.1
html5lib         : 1.1
pymysql          : None
psycopg2         : 2.9.6
jinja2           : 3.1.2
IPython          : 7.29.0
pandas_datareader: None
bs4              : 4.12.0
bottleneck       : None
brotli           : None
fastparquet      : None
fsspec           : 2023.3.0
gcsfs            : None
matplotlib       : 3.5.1
numba            : None
numexpr          : None
odfpy            : None
openpyxl         : 3.1.2
pandas_gbq       : None
pyarrow          : None
pyreadstat       : None
pyxlsb           : None
s3fs             : None
scipy            : 1.9.0
snappy           : None
sqlalchemy       : 2.0.19
tables           : None
tabulate         : 0.8.9
xarray           : None
xlrd             : None
zstandard        : None
tzdata           : 2023.3
qtpy             : None
pyqt5            : None

Metadata

Metadata

Assignees

Labels

BugTimestamppd.Timestamp and associated methodsTimezonesTimezone data dtype

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions