Skip to content

PERF: vbench for time-series index assignment in frame (GH5320) #5321

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

Merged
merged 1 commit into from
Oct 25, 2013

Conversation

jreback
Copy link
Contributor

@jreback jreback commented Oct 25, 2013

PERF: direct index assignment in a frame was doing lots of work

closes #5320

-------------------------------------------------------------------------------
Test name                                    | head[ms] | base[ms] |  ratio   |
-------------------------------------------------------------------------------
frame_assign_timeseries_index                |   0.7157 | 398.8634 |   0.0018 |

PERF: direct index assignment in a frame was doing lots of work
jreback added a commit that referenced this pull request Oct 25, 2013
PERF: vbench for time-series index assignment in frame (GH5320)
@jreback jreback merged commit a222499 into pandas-dev:master Oct 25, 2013
@jtratner
Copy link
Contributor

This introduced a bug because it didn't broadcast the value on a matching index - I'm working on a fix right now.

import pandas as pd
df = pd.DataFrame(zip(range(5), range(5), range(5), range(5)),
                  columns=['C1', 'C2', 'C1', 'C3'],
                  index=['a', 'b', 'c', 'd', 'e'])
df['C1'] = df.index # fails because doesn't broadcast the value

@jreback
Copy link
Contributor Author

jreback commented Oct 26, 2013

dups ok let me take a look (prob was not tested before)

@jtratner
Copy link
Contributor

@jreback no, the issue is that you have to apply the broadcasting logic at the end of the if clause you took it out of. I already have a fix. no big deal.

jtratner added a commit to jtratner/pandas that referenced this pull request Oct 26, 2013
And only try to broadcast if columns aren't unique or are MI.

(also in the process fix small bug from pandas-dev#5321)
@ghost
Copy link

ghost commented Oct 28, 2013

When adding cases to already hairy conditional logic It's useful to add a
comment referencing the orig issue (GH1234) to help locate the orig. discussion.
pep8 storms sometimes make using git blame inconvenient for this.

I picked this up originally from wes's code and I think it's a useful convention to adopt.

my 2c

@jtratner
Copy link
Contributor

That makes sense. Btw - I recently noticed that fugitive for vim lets you
traverse back through the history of a particular line - incredibly useful
feature. If we try to keep line widths to 79 characters, that would also
help the problem :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PERF: slow assignement of an index to a frame
2 participants