-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
df.Truncate now fails when arguments have different tzinfo #29856
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
Comments
|
Your comment is correct. My current workaround is this: # df = df.truncate(before=before, after=after) ERROR
df = df.truncate(before=before)
df = df.truncate(after=after) So I'm still clueless as to why the oneliner that used to work in all previous versions of Pandas now suddenly doesn't. |
@JrtPec check #16785 and therein referred to for a lengthy discussion on why. It is technically very difficult and the previous behavior was unpredictable (pandas was even sometimes showing a wrong behavior) because sometimes the timezone information accidentially got ignored. In conclusion, it is a feature, not a bug ;-) |
I've faced the same issue but with the DateTime objects:
and my workaround was to change the value of |
Code Sample
Problem description
In #25263, these lines were added (line 4881):
tzinfo
is insufficient here.Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.7.3.final.0
python-bits : 64
OS : Darwin
OS-release : 18.6.0
machine : x86_64
processor : i386
byteorder : little
LC_ALL : en_US.UTF-8
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
pandas : 0.25.3
numpy : 1.16.4
pytz : 2019.1
dateutil : 2.8.0
pip : 19.2.1
setuptools : 28.8.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.3.3
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : 4.7.1
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : 4.3.3
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
s3fs : None
scipy : None
sqlalchemy : 1.3.3
tables : None
xarray : None
xlrd : 1.2.0
xlwt : None
xlsxwriter : None
The text was updated successfully, but these errors were encountered: