Skip to content

Remove DataFrame.append from the 10min intro #27518

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

Closed
TomAugspurger opened this issue Jul 22, 2019 · 4 comments · Fixed by #27520
Closed

Remove DataFrame.append from the 10min intro #27518

TomAugspurger opened this issue Jul 22, 2019 · 4 comments · Fixed by #27520
Labels
Milestone

Comments

@TomAugspurger
Copy link
Contributor

We show it https://pandas.pydata.org/pandas-docs/stable/getting_started/10min.html#append.

I don't think we should recommend it there, especially without providing context that the complexity of DataFrame.append is very different from list.append.

@sameshl
Copy link
Contributor

sameshl commented Jul 22, 2019

@TomAugspurger I understand what you mean. But don't you think that for a new user append function might be useful?

@TomAugspurger
Copy link
Contributor Author

TomAugspurger commented Jul 22, 2019 via email

@sameshl
Copy link
Contributor

sameshl commented Jul 22, 2019

Yeah, you are right. dataframe.append is not as trivial as list.append. I could fix this issue then

@ParfaitG
Copy link
Contributor

Agreed with @TomAugspurger . Occasionally on StackOverflow, you see new users running DataFrame.append inside a loop in same fashion as they would with list.append , leading to the hazardous quadratic copy. Therefore, leaving it out of an intro to new users may be beneficial:

# INITIALIZE AN EMPTY DATA FRAME
df = pd.DataFrame()

for i in range(5):
    # GROW DATA FRAME IN LOOP
    df = pd.DataFrame({'int': np.random.randint(1, 10, 500),
                       'num': np.random.uniform(0, 1, 500)
		       })
    df = df.append(df)

As the numpy/pandas guru, @unutbu admonishes: Never call DataFrame.append or pd.concat inside a for-loop. It leads to quadratic copying.

@jreback jreback added this to the 1.0 milestone Jul 24, 2019
TomAugspurger pushed a commit that referenced this issue Aug 2, 2019
* DOC:Remove DataFrame.append from the 10min intro

Remove the `append` section from 10 min intro doc as complexity of that is very different than `list.append`

closes #27518
quintusdias pushed a commit to quintusdias/pandas_dev that referenced this issue Aug 16, 2019
* DOC:Remove DataFrame.append from the 10min intro

Remove the `append` section from 10 min intro doc as complexity of that is very different than `list.append`

closes pandas-dev#27518
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants