The below is an excerpt from the Pandas documentation. What the hell is it on about? It uses the word "yikes" to describe that piece of code, yet it seems perfectly sensible to me.
We have a df
. We pass it to the function. We pick our two columns of that dataframe, which we call foo
We add a new column to foo
, which now has 3 columns. We then return this 3-column dataframe in the last line of the code, return foo
.
What the hell is wrong with that? It's perfectly legitimate! I would call this code as df = do_something(df)
.
question from:
https://stackoverflow.com/questions/65559629/why-does-the-pandas-documentation-have-a-problem-with-this-piece-of-code 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…