Python: handling a large set of data. Scipy or Rpy? And how?

前端 未结 6 722
我在风中等你
我在风中等你 2021-02-04 17:47

In my python environment, the Rpy and Scipy packages are already installed.

The problem I want to tackle is such:

1) A huge set of financial data are stored in

6条回答
  •  甜味超标
    2021-02-04 18:31

    How huge is your data, is it larger than your PC's memory? If it can be loaded into memory, you can use numpy.loadtxt() to load text data into a numpy array. for example:

    import numpy as np
    with file("data.csv", "rb") as f:
       title = f.readline()  # if your data have a title line.
       data = np.loadtxt(f, delimiter=",") # if your data splitted by ","
       print np.sum(data, axis=0)  # sum along 0 axis to get the sum of every column
    

提交回复
热议问题