You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a=j['FECHAENVIO'][-1:]
print(j['FECHAENVIO'][0] ==a) #False print(j[j['FECHAENVIO'] ==a]) #ValueError: Can only compare identically-labeled Series objects
Problem description
I have part of a dataframe groupby REFERENCIA, and now I wanted to get all rows with the last day in FECHAENVIO, for that I tried to get the last date in FECHAENVIO, save it in a, and then compare all the column with this date.
After checking SO and not able to find anything related to it, I found the issue #17965 and I think is relate to it, but not sure.
After 2 hours I did a workaround using FECHAENVIO as the index and using j.last('1D'), but I thought it was better to inform of the possible bug.
Expected Output
A dataframe with rows in which FECHAENVIO is equals to the variable a.
Output of pd.show_versions()
[paste the output of pd.show_versions() here below this line]
INSTALLED VERSIONS
commit: None
python: 3.7.0.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 142 Stepping 9, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
I just tried it but no, if I use only j['FECHAENVIO'][-1] gives an error of KeyError: -1, I also tried to use j['FECHAENVIO'].tail(1) but it gives the same error as with j['FECHAENVIO'][-1:], but I think it is because they are equivalent.
Nevermind, doing other things I discovered that this was my error, the thing is a = j['FECHAENVIO'][-1:] and tail do the same, they don't return the value itself, but doing a = j['FECHAENVIO'].iloc[-1] gives you the value.
So I close this, since it wasn't a bug, sorry for the inconvenience.
Code Sample, a copy-pastable example if possible
content of dataframe j
REFERENCIA FECHAPROGRAMA FECHAENVIO NECESIDAD
0 81007104 2015-04-04 2016-01-04 1038.0
1 81007104 2015-04-11 2016-01-04 1281.0
4 81007104 2015-04-18 2016-01-04 1172.0
...
1228 81007104 2015-12-05 2016-01-28 180.0
...
1541 81007104 2016-01-02 2016-01-29 180.0
1639 81007104 2016-01-09 2016-01-29 360.0
1734 81007104 2016-01-16 2016-01-29 360.0
1833 81007104 2016-01-23 2016-01-29 360.0
and the code is
Problem description
I have part of a dataframe groupby REFERENCIA, and now I wanted to get all rows with the last day in FECHAENVIO, for that I tried to get the last date in FECHAENVIO, save it in a, and then compare all the column with this date.
After checking SO and not able to find anything related to it, I found the issue #17965 and I think is relate to it, but not sure.
After 2 hours I did a workaround using FECHAENVIO as the index and using j.last('1D'), but I thought it was better to inform of the possible bug.
Expected Output
A dataframe with rows in which FECHAENVIO is equals to the variable a.
Output of
pd.show_versions()
[paste the output of
pd.show_versions()
here below this line]INSTALLED VERSIONS
commit: None
python: 3.7.0.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 142 Stepping 9, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.23.4
pytest: 3.8.0
pip: 18.1
setuptools: 40.2.0
Cython: 0.28.5
numpy: 1.15.4
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.5.0
sphinx: 1.7.9
patsy: 0.5.0
dateutil: 2.7.5
pytz: 2018.5
blosc: None
bottleneck: 1.2.1
tables: 3.4.4
numexpr: 2.6.8
feather: None
matplotlib: 2.2.3
openpyxl: 2.5.6
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.1.0
lxml: 4.2.5
bs4: 4.6.3
html5lib: 1.0.1
sqlalchemy: 1.2.11
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: