Skip to content
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

Improve error message for DataFrame.append(<dict-like>) #30871

Closed
simonjayhawkins opened this issue Jan 9, 2020 · 0 comments · Fixed by #30882
Closed

Improve error message for DataFrame.append(<dict-like>) #30871

simonjayhawkins opened this issue Jan 9, 2020 · 0 comments · Fixed by #30882
Labels
Error Reporting Incorrect or improved errors from pandas

Comments

@simonjayhawkins
Copy link
Member

Code Sample, a copy-pastable example if possible

>>> import pandas as pd
>>>
>>> pd.__version__
'0.26.0.dev0+1731.g3ddd495e4'
>>>
>>> df = pd.DataFrame({"Name": ["Alice"], "Gender": ["F"]})
>>> df
    Name Gender
0  Alice      F
>>>
>>> df.append({"Name": "Bob", "Gender": "M"})
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\simon\pandas\pandas\core\frame.py", line 7013, in append
    "Can only append a Series if ignore_index=True "
TypeError: Can only append a Series if ignore_index=True or if the Series has a name

>>>

Problem description

dict-like is valid type for other parameter of DataFrame.append

Expected Output

ValueError: Can only append a dict-like if ignore_index=True

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant