-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Unexpected behaviour in pandas.DataFrame.first_valid_index (and last...) #20499
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
Labels
Milestone
Comments
hmm, this seems reasonable. i suspect we don't have great testing on the DataFrame side for this. would take a PR for this (and add all of those cases as parameterized tests). |
asdf8601
added a commit
to asdf8601/pandas
that referenced
this issue
Mar 31, 2018
Removed old methods from Series and DF Added new methods into NDFrame Created new convenient method _find_first_valid
asdf8601
added a commit
to asdf8601/pandas
that referenced
this issue
Mar 31, 2018
asdf8601
added a commit
to asdf8601/pandas
that referenced
this issue
Mar 31, 2018
asdf8601
added a commit
to asdf8601/pandas
that referenced
this issue
Mar 31, 2018
Removed old methods from Series and DF Added new methods into NDFrame Created new convenient method _find_first_valid
asdf8601
added a commit
to asdf8601/pandas
that referenced
this issue
Mar 31, 2018
asdf8601
added a commit
to asdf8601/pandas
that referenced
this issue
Mar 31, 2018
4 tasks
asdf8601
added a commit
to asdf8601/pandas
that referenced
this issue
Mar 31, 2018
Removed old methods from Series and DF Added new methods into NDFrame Created new convenient method _find_first_valid
asdf8601
added a commit
to asdf8601/pandas
that referenced
this issue
Mar 31, 2018
asdf8601
added a commit
to asdf8601/pandas
that referenced
this issue
Mar 31, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code Sample
Problem description
The method implemented in
pandas.Series
it works fine for all cases. However, the method implemented inpandas.DataFrame
returns an index without the frequency when there is holes in the values.This is because the
_get_valid_indices()
returns a fancy selection of the indices with the naive mask as shown below:The problem is present since 0.19.1.
Output of
pd.show_versions()
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.4.final.0
python-bits: 64
OS: Darwin
OS-release: 17.4.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: None
LOCALE: es_ES.UTF-8
pandas: 0.22.0
pytest: 3.4.2
pip: 9.0.1
setuptools: 38.5.1
Cython: 0.27.3
numpy: 1.14.2
scipy: 1.0.0
pyarrow: 0.9.0
xarray: 0.10.2
IPython: 6.2.1
sphinx: 1.7.1
patsy: 0.5.0
dateutil: 2.7.0
pytz: 2018.3
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: 0.4.0
matplotlib: 2.2.2
openpyxl: 2.5.1
xlrd: 1.1.0
xlwt: 1.2.0
xlsxwriter: 1.0.2
lxml: 4.2.0
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.2.5
pymysql: 0.8.0
psycopg2: None
jinja2: 2.10
s3fs: 0.1.3
fastparquet: 0.1.4
pandas_gbq: None
pandas_datareader: None
Possible solution
I wonder to know if this is actually a bug or not. In the bug case, in my opinion, I will add the next functions as methods to
NDFrame
class, because It works withSeries
andDataFrames
in substitution of the current methods. I would like do the pull request if this is ok.The text was updated successfully, but these errors were encountered: