Speed of vectorized operation dependent of number of columns of data.frame

前端 未结 3 1165
伪装坚强ぢ
伪装坚强ぢ 2021-01-19 16:04

Why does it take longer to operate a comparison on a data.frame with the same number of elements, but arranged in more columns on vectorized operations? Take this simple exa

3条回答
  •  失恋的感觉
    2021-01-19 16:57

    when comparing df1 to df2 to df3: by changing the number of rows yet holding the total number of elements constant you are consequently changing the number of columns.

    each column in a data.frame is a list. Each data.frame in your example has an order of magnitude more columns, hence and order of magnitude more operations, and thus time.

提交回复
热议问题