-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdf.py
More file actions
66 lines (64 loc) · 3.04 KB
/
df.py
File metadata and controls
66 lines (64 loc) · 3.04 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
65
66
df.info()
import pandas as pd
import numpy as np
pip install matplotlib==3.7.1
pip install seaborn==0.13.1
10 columns, 6 rows
df = pd.DataFrame(columns=['A', 'B', 'C', 'D', 'E', 'F', 'G', '''H', 'I', 'J']) '
a= order_id: Unique ID of the order'
'b= customer_id: Unique ID of the customer''
'c= order_date: Date of the order''
'd= order_status: Status of the order (e.g., shipped, delivered, canceled)''
'e= product_id: Unique ID of the product'''
'f= product_name: Name of the product'''
'g= product_category: Category of the product'''
'h= product_price: Price of the product'''
'i= quantity: Quantity of the product ordered'''
'j= total_price: Total price of the order (product_price * quantity)'''
6 rows = pd.DataFrame({
'A': [1, 2, 3, 4, 5, 6],
'B': [101, 1df02, 103, 104, 105, 106],
'C': ['2023-01-01', '2023-01-02', '2023-01-03', '2023-01-04', '2023-01-05', '2023-01-06'],
'D': ['shipped', 'delivered', 'canceled', 'shipped', 'delivered', 'canceled'],
'E': [201, 202, 203, 204, 205, 206],
'F': ['Product A', 'Product B', 'Product C', 'Product D', 'Product E', 'Product F'],
'G': ['Category X', 'Category Y', 'Category Z', 'Category X', 'Category Y', 'Category Z'],
'H': [10.99, 20.99, 30.99, 40.99, 50.99, 60.99],
'I': [1, 2, 1, 3, 2, 1],
'J': [10.99 * 1, 20.99 * 2, 30.99 * 1, 40.99 * 3, 50.99 * 2, 60.99 * 1]
})
df['C'] = pd.to_datetime(df['C'])
# uncomment and run t following lines for google colab
# read the data
df =pd.read_csv('https://'foodhub_orders.csv') '
# Return the first 5 rows of the DataFrame
df.head()
# Check the shape of the Dataset
(function)_foodhub_orders: Any
df.info()
# Checking for missing values
df.isnull().sum()
#Write the appropriate function print the sum of null values for each column
# Get the summary statistics of the numerical data df.'___'
# #write the appropriate function to get the summary statistics of the numerical data
df['order_id'].nunique()
# check unique customer ID
df['customer_id'].'___' ## Complete the code to find out number of unique customer IDs
# check unique Restaurant name
df['restaurant_name']. '__'
# # Complete the code to find out the unique restaurant name
# check unique cuisine type
df['cuisine_type'].'__' ## Complete the code to find out number of unique cuisine type
plt.figure(figsize=(15, 5))
sns.countplot(data=df, x='cuisine_type')
# # Check the unique values
df['day_of_week']."__"
## Complete the code to check unique values for the "day_of_week" column
sns.countplot(data=df, x='day_of_week') ## complete the code to plot a bar graph for 'day_of_week' column
# check the unique values
df['rating'].'__'## Complete the code to check unique values for the "rating" column
sns.counterplot(data=df, x='rating') ## complete the code to plot a bar graph for 'rating' column
code to plot bar graph for 'rating' column
# using pd.read_csv()Function will work without any path if the notebook and data set are in the folder
# data =pd.read__csvp('foodhub_orders.csv')
print('Data loaded successfully')