-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Dividing None Series with Timedelta fails with pandas 1.0.1 #31869
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
@pquentin Thanks for the report! |
Thanks, I'll try to patch this in the next couple days. |
So there are a couple of tricky issues here.
@pquentin is the problem with |
@jbrockmendel Our code is doing We'd be happy to update our code if what we're doing should never have been supported in the first place, however. |
I'm working on a patch that will fix |
Ah yes I understand your question now. So s1 contains start dates, s2 contains end dates, and we encode "no end date" using None. We can add a condition to use different code in that case. Thanks! |
pandas support for |
Sure, but how would that help? Ultimately we want to compute the duration in days, here's the actual code:
When |
If you use datetime objects, then pandas will case |
Thanks! I ended up using duration = df.end_date.apply(pd.Timestamp) - df.start_date.apply(pd.Timestamp)
df["duration_days"] = duration / pd.Timedelta(days=1) |
Code Sample
Problem description
With pandas 1.0.0, this was working fine and putting
NaN
in theSeries
.With pandas 1.0.1, I get the following traceback:
I run
git bisect
and the new behavior has been introduced in a8aff6c.What is the correct behavior?
Output of
pd.show_versions()
INSTALLED VERSIONS
commit : None
python : 3.6.8.final.0
python-bits : 64
OS : Darwin
OS-release : 19.3.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 : 1.0.1
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 40.6.2
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None
The text was updated successfully, but these errors were encountered: