Skip to content

REF: be stricter about what we pass to _simple_new #31055

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 3 commits into from
Jan 18, 2020

Conversation

jbrockmendel
Copy link
Member

This will take a few passes to get rid of all the checks done in _simple_new that should be done elsewhere

Copy link
Member

@jorisvandenbossche jorisvandenbossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big +1

@jbrockmendel jbrockmendel changed the title REF: by stricter about what we pass to _simple_new REF: be stricter about what we pass to _simple_new Jan 16, 2020
@jbrockmendel jbrockmendel added the Constructors Series/DataFrame/Index/pd.array Constructors label Jan 17, 2020
@@ -420,7 +421,8 @@ def insert(self, loc, item):
new_i8s = np.concatenate(
(self[:loc].asi8, [item.view(np.int64)], self[loc:].asi8)
)
return self._shallow_copy(new_i8s, freq=freq)
tda = type(self._data)._simple_new(new_i8s, freq=freq)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doen't this copy twice?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, simple_new doesnt make a copy

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

k, that's what i thought, can you (followup ok), document this loudly in the _simple_new

@jreback jreback added this to the 1.1 milestone Jan 18, 2020
@jreback
Copy link
Contributor

jreback commented Jan 18, 2020

also I would document in simple_new what the copy guarantees are

@jreback jreback merged commit 55cfabb into pandas-dev:master Jan 18, 2020
@jreback
Copy link
Contributor

jreback commented Jan 18, 2020

thanks, followon comments

@jbrockmendel jbrockmendel deleted the ref-simple2 branch January 18, 2020 16:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Constructors Series/DataFrame/Index/pd.array Constructors
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants