Skip to content

Commit 1822bed

Browse files
committed
Baseline code
0 parents  commit 1822bed

File tree

2 files changed

+1625
-0
lines changed

2 files changed

+1625
-0
lines changed
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": 9,
6+
"metadata": {},
7+
"outputs": [],
8+
"source": [
9+
"# Imports \n",
10+
"import string\n",
11+
"import pandas as pd\n",
12+
"import numpy as np\n",
13+
"import time"
14+
]
15+
},
16+
{
17+
"cell_type": "code",
18+
"execution_count": 54,
19+
"metadata": {
20+
"collapsed": true
21+
},
22+
"outputs": [],
23+
"source": [
24+
"# load the data, keep only selected columns\n",
25+
"# Read the file using super fast Pandas.read_csv\n",
26+
"def load_required_data(path, required_columns):\n",
27+
" dataframe = pd.read_json(path, lines=True)\n",
28+
" dataframe = dataframe[required_columns]\n",
29+
" return dataframe, dataframe.values"
30+
]
31+
},
32+
{
33+
"cell_type": "code",
34+
"execution_count": 55,
35+
"metadata": {},
36+
"outputs": [],
37+
"source": [
38+
"dataframe, values = load_required_data('../reviews_Apps_for_Android_5.json', [\"asin\", \"overall\", \"reviewText\", \"reviewerID\"])"
39+
]
40+
},
41+
{
42+
"cell_type": "code",
43+
"execution_count": 63,
44+
"metadata": {},
45+
"outputs": [
46+
{
47+
"data": {
48+
"text/plain": [
49+
"3"
50+
]
51+
},
52+
"execution_count": 63,
53+
"metadata": {},
54+
"output_type": "execute_result"
55+
}
56+
],
57+
"source": []
58+
},
59+
{
60+
"cell_type": "code",
61+
"execution_count": null,
62+
"metadata": {
63+
"collapsed": true
64+
},
65+
"outputs": [],
66+
"source": []
67+
}
68+
],
69+
"metadata": {
70+
"kernelspec": {
71+
"display_name": "Python 2",
72+
"language": "python",
73+
"name": "python2"
74+
},
75+
"language_info": {
76+
"codemirror_mode": {
77+
"name": "ipython",
78+
"version": 2
79+
},
80+
"file_extension": ".py",
81+
"mimetype": "text/x-python",
82+
"name": "python",
83+
"nbconvert_exporter": "python",
84+
"pygments_lexer": "ipython2",
85+
"version": "2.7.14"
86+
}
87+
},
88+
"nbformat": 4,
89+
"nbformat_minor": 2
90+
}

0 commit comments

Comments
 (0)