limit how much data is read with numpy.genfromtxt for matplotlib

前端 未结 2 1838
隐瞒了意图╮
隐瞒了意图╮ 2020-12-11 02:22

I am creating a graph in python using a text file for the source data and matplotlib to plot the graph. The simple logic below works well.

But is there a way to get

2条回答
  •  借酒劲吻你
    2020-12-11 02:37

    No idea about numpy, but one possible solution would be to use the stringio class.

    That allows you to just load the data you actually need into a string with normal file IO (there's also a byte version), create a file-like object from the string and pass that to numpy.

提交回复
热议问题