Skip to content

Conversation

@jbrockmendel
Copy link
Member

make _set_value not return anything (the DataFrame docstring in particular is misleading)

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

This is all just internal right?

def _set_labels(self, key, value):
key = com.asarray_tuplesafe(key)
indexer = self.index.get_indexer(key)
indexer: np.ndarray = self.index.get_indexer(key)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't need to annotate like this; if anything should set the return of get_indexer to np.ndarray

Copy link
Member Author

Choose a reason for hiding this comment

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

yah, im trying to pin down what gets passed to _set_values below. The check on L1075 is never True, so id like to see if we can rip it out

@WillAyd WillAyd added the Clean label Feb 7, 2020
@jbrockmendel
Copy link
Member Author

This is all just internal right?

Yes

@jreback jreback added this to the 1.1 milestone Feb 9, 2020
@jreback jreback added the Indexing Related to indexing on series/frames, not to indexes themselves label Feb 9, 2020
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

small assert; i think you can do it in this PR. ping on green.

raise

if not isinstance(key, (list, np.ndarray, Series, Index)):
if not isinstance(key, (list, np.ndarray, ExtensionArray, Series, Index)):
Copy link
Contributor

Choose a reason for hiding this comment

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

we likely don't have many tests which do this on EAs FYI

assert res.index[-1] == "foobar"
assert res._get_value("foobar", "B") == 0
float_frame._set_value("foobar", "B", 0)
assert float_frame.index[-1] == "foobar"
Copy link
Contributor

Choose a reason for hiding this comment

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

you could assert the return value is None

assert res is s
assert res.index[-1] == "foobar"
assert res["foobar"] == 0
s._set_value("foobar", 0)
Copy link
Contributor

Choose a reason for hiding this comment

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

same here, assert return value is None

@jbrockmendel
Copy link
Member Author

ping

@jreback jreback merged commit c5fb994 into pandas-dev:master Feb 9, 2020
@jreback
Copy link
Contributor

jreback commented Feb 9, 2020

thanks

@jbrockmendel jbrockmendel deleted the unreachable branch February 9, 2020 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Clean Indexing Related to indexing on series/frames, not to indexes themselves

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants