Skip to content
This repository was archived by the owner on Sep 28, 2022. It is now read-only.

Commit 6f195c1

Browse files
authored
Merge pull request #145 from asvetlik/master
Edited example so it will run properly
2 parents 63a0b96 + 8180b57 commit 6f195c1

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

docs/imports.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ ROW_ID,COLUMN_ID,TIMESTAMP
1717
Note that, each line corresponds to a single bit and the lines end with a new line (`\n` or `\r\n`).
1818
The target index and field must have been created before hand.
1919

20-
Here's some sample code that uses `csv_row_id_column_id` formatter:
20+
Here's some sample code that uses `csv_row_id_column_id` formatter along with a timestamp:
2121
```python
2222
import pilosa
2323
from pilosa.imports import csv_column_reader, csv_row_id_column_id
24+
import time
2425

2526
try:
2627
# python 2.7 and 3
@@ -30,12 +31,13 @@ except ImportError:
3031
from StringIO import StringIO
3132

3233
text = u"""
33-
1,10,683793200
34-
5,20,683793300
35-
3,41,683793385
36-
10,10485760,683793385
34+
1,10,2019-11-30T02:00
35+
5,20,2020-09-29T03:30
36+
3,41,2017-09-23T03:08
37+
10,10485760,2018-09-23T03:05
3738
"""
38-
reader = csv_column_reader(StringIO(text), csv_row_id_column_id)
39+
time_func = lambda s: int(time.mktime(time.strptime(s, "%Y-%m-%dT%H:%M")))
40+
reader = csv_column_reader(StringIO(text), timefunc=time_func)
3941
client = pilosa.Client()
4042
schema = client.schema()
4143
index = schema.index("sample-index")

0 commit comments

Comments
 (0)