File tree Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Expand file tree Collapse file tree 1 file changed +20
-2
lines changed Original file line number Diff line number Diff line change 14
14
"metadata" : {},
15
15
"outputs" : [],
16
16
"source" : [
17
+ " import os\n " ,
17
18
" import pandas as pd\n " ,
18
19
" import numpy as np\n " ,
19
20
" import plotly.graph_objs as go\n " ,
26
27
"metadata" : {},
27
28
"outputs" : [],
28
29
"source" : [
29
- " df = pd.read_pickle('data/nyc_taxi.pkl')\n " ,
30
+ " pkl_path = 'data/nyc_taxi.pkl'\n " ,
31
+ " if os.path.exists(pkl_path):\n " ,
32
+ " print('Loading saved dataset file... ', end='')\n " ,
33
+ " df = pd.read_pickle(pkl_path)\n " ,
34
+ " print('done')\n " ,
35
+ " else:\n " ,
36
+ " print('Downloading and saving dataset (thanks to the datashader project for making this example dataset available!)... ', end='')\n " ,
37
+ " df = pd.read_csv('http://s3.amazonaws.com/datashader-data/nyc_taxi.zip', compression='zip')\n " ,
38
+ " df.to_pickle(pkl_path)\n " ,
39
+ " print('done')"
40
+ ]
41
+ },
42
+ {
43
+ "cell_type" : " code" ,
44
+ "execution_count" : null ,
45
+ "metadata" : {},
46
+ "outputs" : [],
47
+ "source" : [
30
48
" df.head()"
31
49
]
32
50
},
244
262
"name" : " python" ,
245
263
"nbconvert_exporter" : " python" ,
246
264
"pygments_lexer" : " ipython3" ,
247
- "version" : " 3.6.6 "
265
+ "version" : " 3.6.5 "
248
266
}
249
267
},
250
268
"nbformat" : 4 ,
You can’t perform that action at this time.
0 commit comments