Comparison of Pandas lookup times

前端 未结 2 1143
谎友^
谎友^ 2021-02-07 02:03

After experimenting with timing various types of lookups on a Pandas (0.17.1) DataFrame I am left with a few questions.

Here is the set up...

import pan         


        
2条回答
  •  误落风尘
    2021-02-07 02:49

    (1) pandas currently has no knowledge of the sortedness of a column.
    If you want to take advantage of sorted data, you could use df2.letter.searchsorted See @unutbu's answer for an explanation of what's actually causing the difference in time here.

    (2) The hash table that sits underneath the index is lazily created, then cached.

提交回复
热议问题