Skip to content

Typo in pandas tutorial 1? #287

Open
@davidmcnamee

Description

@davidmcnamee

Hey, I was just going through the pandas tutorial and wasn't sure whether this is a typo or if I'm misunderstanding.

"Why the change? Remember that loc can index any stdlib type: strings, for example. If we have a DataFrame with index values `Apples, ..., Potatoes, ...`, and we want to select \"all the alphabetical fruit choices between Apples and Potatoes\", then it's a lot more convenient to index `df.loc['Apples':'Potatoes']` than it is to index something like `df.loc['Apples', 'Potatoet]` (`t` coming after `s` in the alphabet).\n",

it's a lot more convenient to index df.loc['Apples':'Potatoes'] than it is to index something like df.loc['Apples', 'Potatoet] (t coming after s in the alphabet)

Should the second code snippet be df.iloc['Apples':'Potatoes']? It was just explained that df.iloc[0:10] gives you indices 0,...,9 but df.loc[0:10] gives you indices 0,...,10; and then I wasn't sure how they got df.loc['Apples', 'Potatoet].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions