-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestquerycsv.py
More file actions
39 lines (32 loc) · 856 Bytes
/
testquerycsv.py
File metadata and controls
39 lines (32 loc) · 856 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import pandas as pd
csv = pd.read_csv("dataset.csv")
print(csv.columns)
print(csv.category.unique())
a = 0
b = 50
c = 0
d = b-a
dat = csv[csv.category == "FOOD"].loc[:, ['headline']][a:b]
print("""-----------------
FOOD & DRINK
-----------------""")
for i in range(c, d):
print(dat.iloc[i, :].headline)
dat = csv[csv.category == "BUSINESS"].loc[:, ['headline']][a:b]
print("""-----------------
BUSINESS
-----------------""")
for i in range(c, d):
print(dat.iloc[i, :].headline)
dat = csv[csv.category == "EDUCATION"].loc[:, ['headline']][a:b]
print("""-----------------
EDUCATION
-----------------""")
for i in range(c, d):
print(dat.iloc[i, :].headline)
dat = csv[csv.category == "WORLD NEWS"].loc[:, ['headline']][a:b]
print("""-----------------
WORLD NEWS
-----------------""")
for i in range(c, d):
print(dat.iloc[i, :].headline)