python - 从 Mac .numbers 文件导入表格数据

标签 python macos python-2.7 import algorithmic-trading

我正在尝试处理一些数字:

Open High Low Close Sample Data

我测试了几种导入数据的变体,但都失败了。非常感谢一些建议。谢谢!

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

主要目标:

  1. 以我可以轻松操作和应用计算的格式高效存储表数据 > 我在考虑 Dict{} > 有什么意见吗?

  2. 针对快速计算进行了优化,因为我需要处理多种证券的数据 > 我估计大约有 1,000,000 到 2,000,000 个数据点。

最佳答案

numbers-parser库可用于解析 .numbers 文件。来自 Github 页面上的示例:

from numbers_parser import Document
doc = Document("my-spreasdsheet.numbers")
sheets = doc.sheets()
tables = sheets[0].tables()
rows = tables[0].rows()

关于python - 从 Mac .numbers 文件导入表格数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48023771/

相关文章:

macos - 使用 Protractor 运行脚本时获取 "Driver info: driver.version: unknown"

Python:如何从sqlite数据库查询utf-8字符串

python - 基于循环索引在 Python 中对列表求和

python-2.7 - Python - 列表中的 Pandas '.isin'

python - 通过 FTP 确定列表是 Python 中的目录还是文件

python - 我使用 wxPython 创建了一个 GUI,当我运行我的应用程序时,这些函数没有执行

python Pandas : apply a function with arguments to a series. 更新

python - 数组中第 n 项的 SparkSQL sql 语法

macos - 在沙箱中运行终端命令

macos - Electron ,如何使窗口从屏幕外滑动? (如通知中心)