Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
156 views
in Technique[技术] by (71.8m points)

python - Why does the Pandas documentation have a problem with this piece of code?

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.

enter image description here

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...