import table data from Mac .numbers file
Asked Answered
M

2

13

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.

Millwork answered 29/12, 2017 at 14:2 Comment(0)
B
16

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()
Behalf answered 31/12, 2021 at 22:43 Comment(0)
R
3

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

Roderickroderigo answered 23/3, 2022 at 8:6 Comment(1)
This is not particularly useful. What if there are 100, or 1000 files. This is not a programming answer.Quietude

© 2022 - 2024 — McMap. All rights reserved.