Skip to content

Conversation

@behrenhoff
Copy link
Contributor

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

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

Looks good!

need to convert the column name to its position using :meth:`Index.get_loc` or you need
to convert the row position to its index. Both variants as shown in the following snippet:

.. code-block:: ipython
Copy link
Member

Choose a reason for hiding this comment

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

We only use code-block when demonstrating old behavior that is no longer the case. Can you instead use .. ipython:: python (see other sections of this file for examples).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, will do!
This distinction just wasn't obvious at all - it just seemed random to me.

need to convert the column name to its position using :meth:`Index.get_loc` or you need
to convert the row position to its index. Both variants as shown in the following snippet:

.. ipython:: python
Copy link
Member

Choose a reason for hiding this comment

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

I would maybe move this example to the "Chained Assignment" section below (and we can link from here to there, indicating that writing it as a single statement has to avoid chained assignment).

Because in the end, the question here is how to write df["foo"].iloc[0] = 100 without chained assignment. I think it is good to show that as an explicit example, since I think this is a quite common use case currently of chained assignment (as it is the only way to combine positional/label based without using the workarounds shown here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DOC: Improve text for "Migrating to Copy-on-Write"

4 participants