Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
a972881
Replace zoneinfo as default string inference, fix imports
mroeschke Jan 23, 2024
4b6ab5d
Adjust docs and tests
mroeschke Jan 24, 2024
b57f2ce
Make pytz optional, docs
mroeschke Jan 24, 2024
69ca55f
Bumpy pytz
mroeschke Jan 24, 2024
a2adcf1
Add whatsnew, more docs
mroeschke Jan 24, 2024
2cf6ecd
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Jan 24, 2024
91c69ec
FIx test errors
mroeschke Jan 24, 2024
60c3f91
FIx some tests
mroeschke Jan 24, 2024
99ed33b
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Jan 25, 2024
40900de
Fix more tests
mroeschke Jan 25, 2024
b8edf3d
A few more tests
mroeschke Jan 25, 2024
dd9b8fa
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Jan 30, 2024
e45b390
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Jan 31, 2024
c7b6a13
Fix doc and typing warnings
mroeschke Jan 31, 2024
d06fbb0
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Jan 31, 2024
f144e00
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Jan 31, 2024
a7a6395
Fix typing
mroeschke Jan 31, 2024
1e9f3e0
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Jan 31, 2024
e5d6ec7
Remove ignores
mroeschke Feb 1, 2024
33f386a
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Feb 1, 2024
58b6271
Fix pylint, timezone test
mroeschke Feb 1, 2024
2a09819
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Feb 6, 2024
7958aa3
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Feb 12, 2024
0911f0a
Address pytz UTC usage
mroeschke Feb 12, 2024
6221c6e
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Feb 22, 2024
918c0c5
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Mar 14, 2024
3d43558
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Mar 19, 2024
8a75e61
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Apr 9, 2024
2ef88be
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Apr 15, 2024
fcf9ced
Fix typo
mroeschke Apr 15, 2024
235429f
Add see also
mroeschke Apr 15, 2024
79c03c8
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Apr 15, 2024
7f3bd1d
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Apr 24, 2024
5acac89
Merge remote-tracking branch 'upstream/main' into ref/tz/zoneinfo
mroeschke Jun 14, 2024
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make pytz optional, docs
  • Loading branch information
mroeschke committed Jan 24, 2024
commit b57f2ce9bf51d679623fbb9da824901f89324c30
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
/opt/python/cp311-cp311/bin/python -m venv ~/virtualenvs/pandas-dev
. ~/virtualenvs/pandas-dev/bin/activate
python -m pip install --no-cache-dir -U pip wheel setuptools meson-python==0.13.1 meson[ninja]==1.2.1
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 hypothesis>=6.46.1
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytest>=7.3.2 pytest-xdist>=2.2.0 hypothesis>=6.46.1
python -m pip install --no-cache-dir --no-build-isolation -e . --config-settings=setup-args="--werror"
python -m pip list --no-cache-dir
- run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ jobs:
. ~/virtualenvs/pandas-dev/bin/activate
python -m pip install --no-cache-dir -U pip wheel setuptools meson[ninja]==1.2.1 meson-python==0.13.1
python -m pip install numpy --config-settings=setup-args="-Dallow-noblas=true"
python -m pip install --no-cache-dir versioneer[toml] cython python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 hypothesis>=6.46.1
python -m pip install --no-cache-dir versioneer[toml] cython python-dateutil pytest>=7.3.2 pytest-xdist>=2.2.0 hypothesis>=6.46.1
python -m pip install --no-cache-dir --no-build-isolation -e . --config-settings=setup-args="--werror"
python -m pip list --no-cache-dir
export PANDAS_CI=1
Expand Down Expand Up @@ -312,7 +312,7 @@ jobs:
/opt/python/cp311-cp311/bin/python -m venv ~/virtualenvs/pandas-dev
. ~/virtualenvs/pandas-dev/bin/activate
python -m pip install --no-cache-dir -U pip wheel setuptools meson-python==0.13.1 meson[ninja]==1.2.1
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 hypothesis>=6.46.1
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytest>=7.3.2 pytest-xdist>=2.2.0 hypothesis>=6.46.1
python -m pip install --no-cache-dir --no-build-isolation -e . --config-settings=setup-args="--werror"
python -m pip list --no-cache-dir

Expand All @@ -333,7 +333,7 @@ jobs:
# In general, this will remain frozen(present, but not running) until:
# - The next unreleased Python version has released beta 1
# - This version should be available on GitHub Actions.
# - Our required build/runtime dependencies(numpy, pytz, Cython, python-dateutil)
# - Our required build/runtime dependencies(numpy, Cython, python-dateutil)
# support that unreleased Python version.
# To unfreeze, comment out the ``if: false`` condition, and make sure you update
# the name of the workflow and Python version in actions/setup-python ``python-version:``
Expand Down Expand Up @@ -385,7 +385,7 @@ jobs:
python -m pip install --upgrade pip setuptools wheel meson[ninja]==1.2.1 meson-python==0.13.1
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
python -m pip install versioneer[toml]
python -m pip install python-dateutil pytz tzdata cython hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-cov
python -m pip install python-dateutil tzdata cython hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-cov
python -m pip install -ve . --no-build-isolation --no-index --no-deps --config-settings=setup-args="--werror"
python -m pip list

Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ details, see the commit logs at https://github.com/pandas-dev/pandas.
## Dependencies
- [NumPy - Adds support for large, multi-dimensional arrays, matrices and high-level mathematical functions to operate on these arrays](https://www.numpy.org)
- [python-dateutil - Provides powerful extensions to the standard datetime module](https://dateutil.readthedocs.io/en/stable/index.html)
- [pytz - Brings the Olson tz database into Python which allows accurate and cross platform timezone calculations](https://github.com/stub42/pytz)

See the [full installation instructions](https://pandas.pydata.org/pandas-docs/stable/install.html#dependencies) for minimum supported versions of required, recommended and optional dependencies.

Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies:
# required dependencies
- python-dateutil
- numpy
- pytz

# optional dependencies
- beautifulsoup4>=4.11.2
Expand All @@ -47,6 +46,7 @@ dependencies:
- pyreadstat>=1.2.0
- pytables>=3.8.0
- python-calamine>=0.1.7
- pytz>=2020.1
- pyxlsb>=1.0.10
- s3fs>=2022.11.0
- scipy>=1.10.0
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-311-downstream_compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ dependencies:
# required dependencies
- python-dateutil
- numpy
- pytz

# optional dependencies
- beautifulsoup4>=4.11.2
Expand All @@ -48,6 +47,7 @@ dependencies:
- pyreadstat>=1.2.0
- pytables>=3.8.0
- python-calamine>=0.1.7
- pytz>=2020.1
- pyxlsb>=1.0.10
- s3fs>=2022.11.0
- scipy>=1.10.0
Expand Down
1 change: 0 additions & 1 deletion ci/deps/actions-311-numpydev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies:

# pandas dependencies
- python-dateutil
- pytz
- pip

- pip:
Expand Down
1 change: 0 additions & 1 deletion ci/deps/actions-311-pyarrownightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ dependencies:
# required dependencies
- python-dateutil
- numpy
- pytz
- pip

- pip:
Expand Down
1 change: 0 additions & 1 deletion ci/deps/actions-311-sanitizers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ dependencies:
# required dependencies
- python-dateutil
- numpy
- pytz

# pandas dependencies
- pip
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-311.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies:
# required dependencies
- python-dateutil
- numpy
- pytz

# optional dependencies
- beautifulsoup4>=4.11.2
Expand All @@ -47,6 +46,7 @@ dependencies:
- pyreadstat>=1.2.0
- pytables>=3.8.0
- python-calamine>=0.1.7
- pytz>=2020.1
- pyxlsb>=1.0.10
- s3fs>=2022.11.0
- scipy>=1.10.0
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-312.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies:
# required dependencies
- python-dateutil
- numpy
- pytz

# optional dependencies
- beautifulsoup4>=4.11.2
Expand All @@ -47,6 +46,7 @@ dependencies:
- pyreadstat>=1.2.0
# - pytables>=3.8.0
- python-calamine>=0.1.7
- pytz>=2020.1
- pyxlsb>=1.0.10
- s3fs>=2022.11.0
- scipy>=1.10.0
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-39-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ dependencies:
# required dependencies
- python-dateutil=2.8.2
- numpy=1.23.5
- pytz=2020.1

# optional dependencies
- beautifulsoup4=4.11.2
Expand All @@ -49,6 +48,7 @@ dependencies:
- pyreadstat=1.2.0
- pytables=3.8.0
- python-calamine=0.1.7
- pytz=2020.1
- pyxlsb=1.0.10
- s3fs=2022.11.0
- scipy=1.10.0
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies:
# required dependencies
- python-dateutil
- numpy
- pytz

# optional dependencies
- beautifulsoup4>=4.11.2
Expand All @@ -47,6 +46,7 @@ dependencies:
- pyreadstat>=1.2.0
- pytables>=3.8.0
- python-calamine>=0.1.7
- pytz>=2020.1
- pyxlsb>=1.0.10
- s3fs>=2022.11.0
- scipy>=1.10.0
Expand Down
1 change: 0 additions & 1 deletion ci/deps/actions-pypy-39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ dependencies:
# required
- numpy
- python-dateutil
- pytz
- pip:
- tzdata>=2022.7
2 changes: 1 addition & 1 deletion ci/deps/circle-310-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ dependencies:
# required dependencies
- python-dateutil
- numpy
- pytz

# optional dependencies
- beautifulsoup4>=4.11.2
Expand All @@ -47,6 +46,7 @@ dependencies:
- pyreadstat>=1.2.0
- pytables>=3.8.0
- python-calamine>=0.1.7
- pytz>=2020.1
- pyxlsb>=1.0.10
- s3fs>=2022.11.0
- scipy>=1.10.0
Expand Down
1 change: 0 additions & 1 deletion ci/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ requirements:
- numpy >=1.21.6 # [py<311]
- numpy >=1.23.2 # [py>=311]
- python-dateutil >=2.8.2
- pytz >=2020.1
- python-tzdata >=2022.7

test:
Expand Down
12 changes: 11 additions & 1 deletion doc/source/getting_started/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ Package Minimum support
================================================================ ==========================
`NumPy <https://numpy.org>`__ 1.23.5
`python-dateutil <https://dateutil.readthedocs.io/en/stable/>`__ 2.8.2
`pytz <https://pypi.org/project/pytz/>`__ 2020.1
`tzdata <https://pypi.org/project/tzdata/>`__ 2022.7
================================================================ ==========================

Expand Down Expand Up @@ -428,3 +427,14 @@ Dependency Minimum Version pip extra Notes
========================= ================== =================== =============================================================
dataframe-api-compat 0.1.7 consortium-standard Consortium Standard-compatible implementation based on pandas
========================= ================== =================== =============================================================

Timezone
^^^^^^^^

Installable with ``pip install "pandas[timezone]"``

========================= ================== =================== =============================================================
Dependency Minimum Version pip extra Notes
========================= ================== =================== =============================================================
pytz 2020.1 timezone Alternative timezone library to ``zoneinfo``.
========================= ================== =================== =============================================================
2 changes: 1 addition & 1 deletion doc/source/user_guide/io.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5096,7 +5096,7 @@ Caveats
convenience you can use ``store.flush(fsync=True)`` to do this for you.
* Once a ``table`` is created columns (DataFrame)
are fixed; only exactly the same columns can be appended
* Be aware that timezones (e.g., ``pytz.timezone('US/Eastern')``)
* Be aware that timezones (e.g., ``zoneinfo.ZoneInfo('US/Eastern')``)
are not necessarily equal across timezone versions. So if data is
localized to a specific timezone in the HDFStore using one version
of a timezone library and that data is updated with another version, the data
Expand Down
6 changes: 3 additions & 3 deletions doc/source/user_guide/timeseries.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2358,9 +2358,9 @@ To return ``dateutil`` time zone objects, append ``dateutil/`` before the string

import dateutil

# pytz
rng_pytz = pd.date_range("3/6/2012 00:00", periods=3, freq="D", tz="Europe/London")
rng_pytz.tz
# zoneinfo
rng_zinfo = pd.date_range("3/6/2012 00:00", periods=3, freq="D", tz="Europe/London")
rng_zinfo.tz

# dateutil
rng_dateutil = pd.date_range("3/6/2012 00:00", periods=3, freq="D")
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ dependencies:
# required dependencies
- python-dateutil
- numpy<2
- pytz

# optional dependencies
- beautifulsoup4>=4.11.2
Expand All @@ -49,6 +48,7 @@ dependencies:
- pyreadstat>=1.2.0
- pytables>=3.8.0
- python-calamine>=0.1.7
- pytz>=2020.1
- pyxlsb>=1.0.10
- s3fs>=2022.11.0
- scipy>=1.10.0
Expand Down
2 changes: 1 addition & 1 deletion pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
__docformat__ = "restructuredtext"

# Let users know if they're missing any of our hard dependencies
_hard_dependencies = ("numpy", "pytz", "dateutil")
_hard_dependencies = ("numpy", "dateutil")
_missing_dependencies = []

for _dependency in _hard_dependencies:
Expand Down
3 changes: 1 addition & 2 deletions pandas/_testing/_hypothesis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from hypothesis import strategies as st
from hypothesis.extra.dateutil import timezones as dateutil_timezones
from hypothesis.extra.pytz import timezones as pytz_timezones

from pandas.compat import is_platform_windows

Expand Down Expand Up @@ -56,7 +55,7 @@
DATETIME_JAN_1_1900_OPTIONAL_TZ = st.datetimes(
min_value=pd.Timestamp(1900, 1, 1).to_pydatetime(), # pyright: ignore[reportGeneralTypeIssues]
max_value=pd.Timestamp(1900, 1, 1).to_pydatetime(), # pyright: ignore[reportGeneralTypeIssues]
timezones=st.one_of(st.none(), dateutil_timezones(), pytz_timezones()),
timezones=st.one_of(st.none(), dateutil_timezones(), st.timezones()),
)

DATETIME_IN_PD_TIMESTAMP_RANGE_NO_TZ = st.datetimes(
Expand Down
1 change: 1 addition & 0 deletions pandas/compat/_optional.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"pyarrow": "10.0.1",
"pyreadstat": "1.2.0",
"pytest": "7.3.2",
"pytz": "2020.1",
"python-calamine": "0.1.7",
"pyxlsb": "1.0.10",
"s3fs": "2022.11.0",
Expand Down
12 changes: 6 additions & 6 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ def tz(self) -> tzinfo | None:

Returns
-------
datetime.tzinfo, pytz.tzinfo.BaseTZInfo, dateutil.tz.tz.tzfile, or None
zoneinfo.ZoneInfo, datetime.tzinfo, pytz.tzinfo.BaseTZInfo, dateutil.tz.tz.tzfile, or None
Returns None when the array is tz-naive.

Examples
Expand All @@ -615,7 +615,7 @@ def tz(self) -> tzinfo | None:
... "2/1/2020 11:00:00+00:00"])
>>> idx.tz
datetime.timezone.utc
"""
""" # noqa: E501
# GH 18595
return getattr(self.dtype, "tz", None)

Expand Down Expand Up @@ -863,7 +863,7 @@ def tz_convert(self, tz) -> Self:

Parameters
----------
tz : str, pytz.timezone, dateutil.tz.tzfile, datetime.tzinfo or None
tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile, datetime.tzinfo or None
Time zone for time. Corresponding timestamps would be converted
to this time zone of the Datetime Array/Index. A `tz` of None will
convert to UTC and remove the timezone information.
Expand Down Expand Up @@ -920,7 +920,7 @@ def tz_convert(self, tz) -> Self:
'2014-08-01 08:00:00',
'2014-08-01 09:00:00'],
dtype='datetime64[ns]', freq='h')
"""
""" # noqa: E501
tz = timezones.maybe_get_tz(tz)

if self.tz is None:
Expand Down Expand Up @@ -952,7 +952,7 @@ def tz_localize(

Parameters
----------
tz : str, pytz.timezone, dateutil.tz.tzfile, datetime.tzinfo or None
tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile, datetime.tzinfo or None
Time zone to convert timestamps to. Passing ``None`` will
remove the time zone information preserving local time.
ambiguous : 'infer', 'NaT', bool array, default 'raise'
Expand Down Expand Up @@ -1078,7 +1078,7 @@ def tz_localize(
0 2015-03-29 03:30:00+02:00
1 2015-03-29 03:30:00+02:00
dtype: datetime64[ns, Europe/Warsaw]
"""
""" # noqa: E501
nonexistent_options = ("raise", "NaT", "shift_forward", "shift_backward")
if nonexistent not in nonexistent_options and not isinstance(
nonexistent, timedelta
Expand Down
1 change: 0 additions & 1 deletion pandas/util/_print_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def _get_dependency_info() -> dict[str, JSONSerializable]:
"pandas",
# required
"numpy",
"pytz",
"dateutil",
# install / build,
"setuptools",
Expand Down
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ dependencies = [
"numpy>=1.23.5; python_version<'3.12'",
"numpy>=1.26.0; python_version>='3.12'",
"python-dateutil>=2.8.2",
"pytz>=2020.1",
"tzdata>=2022.7"
]
classifiers = [
Expand Down Expand Up @@ -85,6 +84,7 @@ output-formatting = ['jinja2>=3.1.2', 'tabulate>=0.9.0']
clipboard = ['PyQt5>=5.15.9', 'qtpy>=2.3.0']
compression = ['zstandard>=0.19.0']
consortium-standard = ['dataframe-api-compat>=0.1.7']
timezone = ['pytz>=2020.1']
all = ['adbc-driver-postgresql>=0.8.0',
'adbc-driver-sqlite>=0.8.0',
'beautifulsoup4>=4.11.2',
Expand Down Expand Up @@ -113,6 +113,7 @@ all = ['adbc-driver-postgresql>=0.8.0',
'pytest>=7.3.2',
'pytest-xdist>=2.2.0',
'python-calamine>=0.1.7',
'pytz>=2020.1',
'pyxlsb>=1.0.10',
'qtpy>=2.3.0',
'scipy>=1.10.0',
Expand Down
Loading