-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: add warning to append about inefficiency #16956
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
Conversation
shanral
commented
Jul 15, 2017
•
edited
Loading
edited
- closes DOC: add warning to append about inefficiency #16418
- adds clarifying description and example for proper use of append
- passes git diff upstream/master -u -- "*.py" | flake8 --diff
Hello @shanral! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on July 16, 2017 at 16:02 Hours UTC |
Codecov Report
@@ Coverage Diff @@
## master #16956 +/- ##
==========================================
+ Coverage 90.98% 90.99% +<.01%
==========================================
Files 161 161
Lines 49288 49288
==========================================
+ Hits 44846 44849 +3
+ Misses 4442 4439 -3
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #16956 +/- ##
==========================================
- Coverage 90.98% 90.97% -0.02%
==========================================
Files 161 161
Lines 49288 49293 +5
==========================================
- Hits 44846 44844 -2
- Misses 4442 4449 +7
Continue to review full report at Codecov.
|
for nb, content in contents.items(): | ||
with open(nb, 'wt') as f: | ||
f.write(content) | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this try
-except
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was to fix an issue if a doc build failed halfway through due to a missing dependency or ^C. I worked on this fix with @TomAugspurger, but am no longer to reproduce it's success. I am removing it from further pull requests.
pandas/core/series.py
Outdated
----- | ||
Iteratively appending to a series can be more computationally intense | ||
than a single concatenate. A better solution is to append values to a | ||
list then concatenate the list with the original series all at once. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
series --> Series
intense --> intensive
"list then" --> "list and then"
pandas/core/frame.py
Outdated
Iteratively appending rows to a Dataframe can be more computationally | ||
intense than a single concatenate. A better solution is to append those | ||
rows to a list then concatenate the list with the original Dataframe | ||
all at once. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
intense --> intensive
"list then" --> "list and then"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you show some pseudo code
@@ -4653,6 +4653,32 @@ def append(self, other, ignore_index=False, verify_integrity=False): | |||
2 5 6 | |||
3 7 8 | |||
|
|||
The following, while not a recommended method for generating a | |||
DataFrame, illustrates how to efficiently generate a DataFrame from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't call this "efficient" since you just said it wasn't efficient.
multiple data sources. | ||
|
||
Less efficient: | ||
>>> df = pd.DataFrame(columns=['A']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a newline between "Less efficient" and ">>> df = ..."
pandas/core/series.py
Outdated
than a single concatenate. A better solution is to append values to a | ||
list then concatenate the list with the original series all at once. | ||
list and then concatenate the list with the original series all at |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
series --> Series