Skip to content

ERR: more helpful error message on invalid access with a timestamp-like #7211

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
jreback opened this issue May 22, 2014 · 7 comments
Closed
Labels
Closing Candidate May be closeable, needs more eyeballs Datetime Datetime data dtype Error Reporting Incorrect or improved errors from pandas Indexing Related to indexing on series/frames, not to indexes themselves

Comments

@jreback
Copy link
Contributor

jreback commented May 22, 2014

related #7209

Might be a nicer error message (gist of this)

Hey you are trying to access a single element on AXIS 1, you can do it with a slice if you want, or use .loc to access the frame by row

In [3]: df = DataFrame(1,index=pd.date_range('20130101',periods=5),columns=['value'])

In [4]: df['20130102']
KeyError: '20130102'

In [5]: df['20130102':]
Out[5]: 
            value
2013-01-02      1
2013-01-03      1
2013-01-04      1
2013-01-05      1
@jreback jreback added this to the 0.14.1 milestone May 22, 2014
@jreback jreback modified the milestones: 0.15.0, 0.14.1 Jun 17, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
@datapythonista datapythonista modified the milestones: Contributions Welcome, Someday Jul 8, 2018
@ryankarlos
Copy link
Contributor

I would like to take this but is there a link to a script where the original error message is being generated from ?

@jreback
Copy link
Contributor Author

jreback commented Oct 20, 2018

see #7209 (comment) and comment above

@dsm2173
Copy link

dsm2173 commented Oct 21, 2018

Hey Jeff, @jmp392 and I are taking a stab at this. We traced the error to a .pxi file and were able to edit what the raised exception stated to be more informative but .pxi files are listed in gitignore, this is our first PR, we assume these filetypes are in the gitignore for a reason, should we remove the .pxi from the gitignore and submit a PR? we do not see any other way to bypass this issue

@jreback
Copy link
Contributor Author

jreback commented Oct 21, 2018

edit the .pxi.in as the .pxi are generated from these

dsm2173 pushed a commit to dsm2173/pandas that referenced this issue Nov 1, 2018
…ormative in this particular common error type
@jbrockmendel jbrockmendel added the Indexing Related to indexing on series/frames, not to indexes themselves label Feb 22, 2020
@ShaharNaveh
Copy link
Member

take

@jbrockmendel
Copy link
Member

This type of indexing is deprecated, not sure this is worth the trouble

@jbrockmendel jbrockmendel added the Closing Candidate May be closeable, needs more eyeballs label Oct 15, 2020
@mroeschke
Copy link
Member

Agreed, closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Closing Candidate May be closeable, needs more eyeballs Datetime Datetime data dtype Error Reporting Incorrect or improved errors from pandas Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

No branches or pull requests

9 participants