Skip to content

Faster Alternative to 01_Getting_&_Knowing_Your_Data - World Food Facts Step 11 #139

@yusufuyanik1

Description

@yusufuyanik1

My propesed solution for step 11 is:
food.iloc[:, 7][18]
instead of:
food.values[18][7]

Picking an index from a Series works much faster than picking it from an numpy.ndarray
We can first pick the product_name column as a series and then find the product at the requested index.
You can find the processing time difference on my system below:
Screen Shot 2022-09-29 at 16 54 06

Note:
I wanted to create a PR instead of an issue but when I checked the differences on such a small PR, I see a lot of differences in json format, which is difficult to read.
Does anyone know if we should post PR's like that on an .ipynb file or is there a cleaner way to do so?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions