Improve error message for DataFrame.append() · Issue #30871 · pandas-dev/pandas (original) (raw)
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 "", line 1, in 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]