Skip to content

BUG: [pyarrow] TypeError: '<' not supported between instances of 'datetime.datetime' and 'str' #53645

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 of 3 tasks
randolf-scholz opened this issue Jun 13, 2023 · 1 comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@randolf-scholz
Copy link
Contributor

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 numpy as np
import pandas as pd

t = pd.date_range("2023-01-01", "2023-01-04", freq="1h")
x = np.random.randn(len(t))
df = pd.DataFrame(x, index=t, columns=["values"])

df.to_parquet("frame.parquet")
df2 = pd.read_parquet("frame.parquet", dtype_backend="pyarrow")

df["2023-01-01":"2023-01-02"]  # ✔
df2["2023-01-01":"2023-01-02"]  # ✘ TypeError: '<' not supported between instances of 'datetime.datetime' and 'str'

Issue Description

Slicing a DataFrame with index type timestamp[us][pyarrow] does not work with strings.

Expected Behavior

The operation should do the same thing regardless of the dtype backend.

Installed Versions

INSTALLED VERSIONS
------------------
commit           : 965ceca9fd796940050d6fc817707bba1c4f9bff
python           : 3.11.3.final.0
python-bits      : 64
OS               : Linux
OS-release       : 5.19.0-43-generic
Version          : #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon May 22 13:39:36 UTC 2
machine          : x86_64
processor        : x86_64
byteorder        : little
LC_ALL           : None
LANG             : en_US.UTF-8
LOCALE           : en_US.UTF-8

pandas           : 2.0.2
numpy            : 1.23.5
pytz             : 2023.3
dateutil         : 2.8.2
setuptools       : 67.7.2
pip              : 23.1.2
Cython           : 0.29.34
pytest           : 7.3.1
hypothesis       : None
sphinx           : 7.0.0
blosc            : None
feather          : None
xlsxwriter       : None
lxml.etree       : 4.9.2
html5lib         : None
pymysql          : 1.0.3
psycopg2         : None
jinja2           : 3.1.2
IPython          : 8.13.2
pandas_datareader: None
bs4              : 4.12.2
bottleneck       : None
brotli           : None
fastparquet      : 2023.4.0
fsspec           : 2023.5.0
gcsfs            : None
matplotlib       : 3.7.1
numba            : 0.57.0
numexpr          : 2.8.4
odfpy            : None
openpyxl         : 3.1.2
pandas_gbq       : None
pyarrow          : 12.0.0
pyreadstat       : None
pyxlsb           : None
s3fs             : None
scipy            : 1.10.1
snappy           : None
sqlalchemy       : 1.4.48
tables           : 3.8.0
tabulate         : 0.9.0
xarray           : 2023.4.2
xlrd             : None
zstandard        : None
tzdata           : 2023.3
qtpy             : None
pyqt5            : None
@randolf-scholz randolf-scholz added Bug Needs Triage Issue that has not been reviewed by a pandas team member labels Jun 13, 2023
@mroeschke
Copy link
Member

Thanks for the report. This is essentially a duplicate of #53154 so closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

2 participants