-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: drop on axis with duplicate values doesn't raise when label is absent #19186
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
@vinu2003 Thanks for the report! As you mentioned on the mailing list, this is triggered by the fact there is a duplicate index and is indeed a bug. I reformatted your post a bit, please make sure in the future to use correct markdown syntax (so it 'looks' good, github provides some help if you edit/post a comment) |
Reproducible example:
|
I'm going to take a look since I don't see any other PR's for this issue. |
Thanks Joris. |
Hi Alex,
Correct me if I am wrong.
It should be "ValueError" as it raises with drop with axis=0 without duplicate index.
So with duplicate as well, I thought it should raise "ValueError".
Please correct me if I am kissing something here.
Kind regards,
Vinodhini Balusamy
…Sent from my iPhone
On 14 Jan 2018, at 12:19 am, Alexander Michael Schade ***@***.***> wrote:
@jorisvandenbossche Should this raise KeyError though?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I just saw your code changes Alex.
So for both axis 0 and 1 , you are making as "KeyError" instead of "ValueError".
…Sent from my iPhone
On 15 Jan 2018, at 4:06 pm, Vinodhini Balusamy ***@***.***> wrote:
Hi Alex,
Correct me if I am wrong.
It should be "ValueError" as it raises with drop with axis=0 without duplicate index.
So with duplicate as well, I thought it should raise "ValueError".
Please correct me if I am kissing something here.
Kind regards,
Vinodhini Balusamy
Sent from my iPhone
> On 14 Jan 2018, at 12:19 am, Alexander Michael Schade ***@***.***> wrote:
>
> @jorisvandenbossche Should this raise KeyError though?
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub, or mute the thread.
>
|
Yes, there is discussion in the PR (#19230 (comment)) that KeyError would actually be better as ValueError |
Yes. That makes sense.
…Sent from my iPhone
On 15 Jan 2018, at 7:49 pm, Joris Van den Bossche ***@***.***> wrote:
Yes, there is discussion in the PR (#19230 (comment)) that KeyError would actually be better as ValueError
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Code Sample, a copy-pastable example if possible
CASE 1 : axis set to column and given a value which is not available in the structure. Gives ValueError.
CASE 2 : axis set to row, and given a value which is not available in structure should behave in the same way as the above case does.
Instead it just prints the structure table. Shouldn’t it be throwing ValueError ?
Problem description
When provided invalid column name(axis=1) it throws "ValueError". Same happens with row as well(axis=0). But when there are duplicate indices in the DataFrame it doesn't.
Expected Output
Output of
pd.show_versions()
pandas: 0.22.0
pytest: None
pip: 9.0.1
setuptools: 36.5.0
Cython: 0.27.3
numpy: 1.13.3
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: