Python for Finance: Analyze Big Financial Data

(Elle) #1
                                    -rw––-  1   yhilpisch   16000080    Sep 28  18:20   data/data.npy
-rw––- 1 yhilpisch 3948600 Sep 28 18:20 data/data.xlsx
-rw––- 1 yhilpisch 5828 Sep 28 18:18 data/new_book_1.xlsx
-rw––- 1 yhilpisch 6688 Sep 28 18:18 data/new_book_2.xlsx
-rw––- 1 yhilpisch 6079 Sep 28 18:18 data/oxl_book.xlsx
-rw––- 1 yhilpisch 5632 Sep 28 18:18 data/workbook.xls
-rw––- 1 yhilpisch 6049 Sep 28 18:18 data/workbook.xlsx

Fourth, read it from disk. This is significantly faster than writing it:


In  [ 64 ]: %time df    =   pd.read_excel(path  +   ‘data.xlsx’,    ‘data_sheet’)
Out[64]: CPU times: user 6.53 s, sys: 44 ms, total: 6.58 s
Wall time: 6.51 s

However, see again the speed difference compared to native storage:


In  [ 65 ]: %time data  =   np.load(path    +   ‘data.npy’)
Out[65]: CPU times: user 16 ms, sys: 8 ms, total: 24 ms
Wall time: 40.5 ms
In [ 66 ]: data, df = 0.0, 0.0
!rm $path*
Free download pdf