-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsample.py
More file actions
64 lines (45 loc) · 1.12 KB
/
sample.py
File metadata and controls
64 lines (45 loc) · 1.12 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
'''
pandas
pip install pandas
!pip install pandas
'''
'''
Data
structured data: tables, csv, ipl points table
unstructured data wahtsap conversations
semi structured data tweet -> text, retweets, likes , id
'''
'''
import structured data
perform data cleaning conversations
business analysis
'''
import pandas as pd #nickname for pandas as pd
#Step 1: importing data to the environment using pandas
#formats : json, csv, tsv, xlsx, xls,
#csv, tsv
data = pd.read_csv('datasets/store.csv')
print(data)
#how many android devices has been sold
#pivot
#categorical column : text,
#numerical column: number of
#datetime: date
#data datatype is dataframe
grouped_data = data.groupby(['Region', 'Store'])['Price'].sum()
grouped_data = pd.DataFrame(grouped_data)
grouped_data = grouped_data.reset_index()
grouped_data = grouped_data.sort_values(by='Price', ascending=False)
#filter a dataframe
# print(grouped_data[grouped_data['Region'].isin(['West'])])
print(data.iloc[50]) #index location
'''
data frame
table
columns
values
rows
indexes
'''
# for every region show me sum of price
# print(grouped_data)