12

I'm trying to crunch some numbers in:

Open High Low Close Sample Data

I have tested a few variations of importing data but failed. Really appreciate some advise. Thanks!

path = 'Data/Price.numbers'
with open(path) as file:    
file.readline()
for line in file:
    values = map(float, line.split())
    test.append(values)

Key Objectives:

  1. Efficiently store the table data in a format that I can easily manipulate and apply calculations > I'm thinking of a Dict{} > Any comments?

  2. Optimized for quick calculations as I need to crunch data for multiple securities > I estimate about 1,000,000 to 2,000,000 datapoint.

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
pappusenpai
  • 131
  • 1
  • 1
  • 5

2 Answers2

12

The numbers-parser library can be used to parse .numbers files. From the example on the Github page:

from numbers_parser import Document
doc = Document("my-spreasdsheet.numbers")
sheets = doc.sheets()
tables = sheets[0].tables()
rows = tables[0].rows()
Kyle
  • 121
  • 1
  • 3
2

Open your Numbers file, go to the "File" > "export" > "To CSV" tab.

You will get your CSV file with which you can interact with Python

Enjoy