Open hisakatha opened 1 year ago
Thanks for the report! My expectation would be that
df = df.assign(x=obj)
is equivalent to
df["x"] = obj
with the exception for when obj
is callable (where there is some special behavior). This is already the implementation of assign. I'm +1 on accepting any values and updating the documentation in this manner.
Pandas version checks
main
hereLocation of the documentation
https://pandas.pydata.org/docs/dev/reference/api/pandas.DataFrame.assign.html
Documentation problem
pandas.DataFrame.assign seems to take dict (dictionary) objects and assign new columns consisting of the dictionary values corresponding to the DataFrame's index. However, I cannot find the documentation of the behavior.
Suggested fix for documentation
I would like to use stable and documented features. Therefore, If this result is expected, I would like the developers to include the behavior in the documentation. If not, I would like to get a warning (or error) from the function.