Create multiple columns in Pandas Dataframe from one function

前端 未结 3 1910
失恋的感觉
失恋的感觉 2021-02-08 00:10

I\'m a python newbie, so I hope my two questions are clear and complete. I posted the actual code and a test data set in csv format below.

I\'ve been able to construct t

3条回答
  •  失恋的感觉
    2021-02-08 01:04

    As far as the performance with numba is concerned, numba doesn't know anything about pandas dataframes and cannot compile operations on them down to fast machine code. Your best bet is to profile what part of your method is slow (using line_profiler for example), and then offload that part to another method that you construct the inputs using the .values attributes of the dataframe columns, which gives you access to the underlying numpy array. Otherwise numba is just going to operate mostly in "object mode" (see the numba glossary) and won't improve performance drastically

提交回复
热议问题