what is the fastest way in python to convert a string with formatted numbers in an numpy array

前端 未结 2 1971
情深已故
情深已故 2021-01-22 08:17

I have a large ASCII file (~100GB) which consists of roughly 1.000.000 lines of known formatted numbers which I try to process with python. The file is too large to read in comp

2条回答
  •  走了就别回头了
    2021-01-22 08:27

    The np.genfromtxt function is a speed champion if you can get it to match you input format.

    If not, then you may already be using the fastest method. Your line-by-line split-into-array approach exactly matches the SciPy Cookbook examples.

提交回复
热议问题