理想情况下,您应该将运动数据记录为某种标准格式。假设它是 CSV 格式。
walking,jumping,sitting
82,309635,1
82,309635,1
25,18265403,1
30,18527312,8
30,17977769,40
30,18375422,37
30,18292441,38
30,303092,7
85,18449654,3
您可以使用任何文件阅读器读取文件。为了简化你的生活,pandas 或 sframe 可能会拯救你。
In [14]: import turicreate as tc
In [15]: sf = tc.SFrame.read_csv('/tmp/activity.csv')
Finished parsing file /tmp/activity.csv
Parsing completed. Parsed 9 lines in 0.13823 secs.
------------------------------------------------------
Inferred types from first 100 line(s) of file as
column_type_hints=[int,int,int]
If parsing fails due to incorrect types, you can correct
the inferred type list above and pass it to read_csv in
the column_type_hints argument
------------------------------------------------------
Finished parsing file /tmp/activity.csv
Parsing completed. Parsed 9 lines in 0.113868 secs.
In [16]: sf.head()
Out[16]:
Columns:
walking int
jumping int
sitting int
Rows: 9
Data:
+---------+----------+---------+
| walking | jumping | sitting |
+---------+----------+---------+
| 82 | 309635 | 1 |
| 82 | 309635 | 1 |
| 25 | 18265403 | 1 |
| 30 | 18527312 | 8 |
| 30 | 17977769 | 40 |
| 30 | 18375422 | 37 |
| 30 | 18292441 | 38 |
| 30 | 303092 | 7 |
| 85 | 18449654 | 3 |
+---------+----------+---------+
[9 rows x 3 columns]