Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Analytics

Download as pdf or txt
Download as pdf or txt
You are on page 1of 33

Experiment- 01

Aim:- Implementation of Pandas DataFrame -> Load a CSV into a Pandas


DataFrame and clean the data by handling missing values.

Load a CSV into a Pandas DataFrame.


Code:
import pandas as pd
import numpy as np
df = pd.read_csv(r"C:\Users\Win 11\OneDrive\Documents\sample.csv")
df

Output:

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Clean the data by handling missing values.
1. clean the data by handling missing values:

df.isnull().sum()

2. Drop rows with missing values:

df.dropna()

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


3. Fill missing values with a specific value:

df.fillna('value')

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Experiment:02
Aim:- Implementation of merging function -> merge two DataFrames from
different sources and analyze the combined data.

Code :
D={'Name':['shivam','ron','Ram','Robert','Rina','Henry'],'Age':[24,67,19,28,21,30],'City':['goa',
'behraich','dholakpur','bhotakpur','pehalvanpur','gurgao'],'Laptop':['H.
P','Lenevo','MAC','Dell','Asus','Acer']}
df=pd.DataFrame(D)

D={'Name':['shivam','ron','Ram','Robert','Rina','Henry'], 'A':[30,35,17,73,12,20],
'place':['Mumbai','Lucknow','Disney','Barabanki','Kanpur','Hyderabad'],'Food':['Chola','Puri','
Samosa' ,'Coconut','Khasta','Cake']}
df_new = pd.DataFrame(D)
Merge=pd.merge(df,df_new,on="Name",how="inner")

Output:

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Experiment :-03
Aim :- Create a line graph and scatter plot using Matplotlib, customizing the
style and labels.
Code :-(Line Graph)
import matplotlib.pyplot as plt

import numpy as np

x = [1,2,5,7,9]
y = [ 6,7,3,0,5]
plt.plot(x,y,marker='P' , mfc= 'red',mec="blue",ls="--" ,lw=2, ms=10)
plt.title("Plotting")

plt.xlabel("x-axis")
plt.ylabel("y-axis")

Output:

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Code:(scatter)
o=[1,2,5,8,9,17,18,20,28,39]
p=[90,1000,1200,1400,1800,2700,2900,3000,3800,4020]

colors=[10,20,30,40,50,60,70,80,90,100]
plt.scatter(o,p,c=colors,cmap='Accent')
plt.colorbar()
plt.xlabel("Strength")

plt.ylabel("Units")
plt.title("Graph")

plt.show()

Output:

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Experiment :- 04
Aim :- Design multiple subplots to compare different visualizations of the same
dataset, adding annotations for clarity.
Code:
q=np.array([56,75,35,23])
p=np.array([11,66,33,88])
plt.subplot(3,2,1)
plt.plot(q,p,"o-",mfc="red")

q=np.array([5,2,7,10])
p=np.array([75,34,23,12])
plt.subplot(3,2,2)
plt.plot(q,p,"o--",mfc="green")

q=np.array([54,23,54,87])
p=np.array([20,10,8,6])
plt.subplot(3,2,3)
plt.plot(q,p,"o:",mfc="brown")

q=np.array([76,87,45,65])
p=np.array([1000,100,10,0])
plt.subplot(3,2,4)
plt.plot(q,p,"o-",mfc="black")

q=np.array([4,5,8,10])

p=np.array([54,65,87,98])
plt.subplot(3,2,5)
plt.plot(q,p,"o--",mfc="blue",lw=2,color="red")

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


q=np.array([12,24,36,48,60])
p=np.array([11,76,54,55,76])

plt.subplot(3,2,6)
plt.plot(q,p,"o:",mfc="brown")
plt.show()

Output:

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Experiment :- 05

Aim :-
A:Create a report from the sample data source data set using IBM Cognos.

Working/Perform: -
 Open IBM Cognos
 Launch Cognos Analytics on Cloud for Students
 Click on New and Select Report
 Create a blank template
 Click on Source and select a sample dataset (Great Outdoor data module)
 Add relevant parameters in rows and columns and run the report.

Outcomes/Learning: To create a report

Required Tool: IBM Cognos

Steps:-
1. Launch Cognos Analytics on Cloud.

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


2. Open the menu bar and create a new report.

3. Select the blank template.

4. Choose the Select Source option and open the Great Outdoor data module

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


5. Add the parameters and run the list.

Output:

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


B: Create the report form the personal data source.

Step 1 : Importing CSV file in System


 Download CSV file from website “Kaggle.com” .
 Then Unziped Archieve file.

Step 1: Import Data Source

1. Open IBM Cognos Analytics.


2. Select "Data modules" and upload your personal data source (e.g., Excel file, CSV file)
and save the data .

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Step 2: Create a New Report
1. Navigate to "Reports" > "Create Report".

2. Choose "Blank Report" or a suitable template.

3. Choose the Select Source option and select the personal uploaded data file.

4. Add the parameters and run the list.

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Output:

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Experiment :- 06

Aim:-
A:Create a report using filters, detail filter on fact data in a report.

Step1: Create Report


1. Log in to IBM Cognos Analytics.
2. Click "Reports" > "Create Report".
3. Choose "Blank Report" or a template.

Step2: Add Data

1. Drag and drop tables from the data module to the query pane.
2. Select columns (fields) to include in your report.

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Step3: Apply Filters

1. Click "Filters" in the query pane.


2. Choose Create Custom Filter.

3. Give the condition.

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Output:

Step4: Apply Detail Filters


1. Create the new report
2. Drag and drop fact data (e.g., year, sales, etc) to the detail filter pane.

3. Select the edit filter option.

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


4. Set detail filter condition (e.g., "year" > 2016).

5. Click "Ok".

Output:

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


B: Create complex Crosstab reports.

Step: 1 Create Report


1. Log in to IBM Cognos Analytics.
2. Click "Reports" > "Create Report".
3. Choose "Blank Report" or a template.
4. Now Select Crosstab Widget Type.
5. Select source => Sample>Data>Great Outdoor Data Module

Step : 2 Add Data


 Now , Drag and Drop the data from the Data Module by Columns>Rows>Measures.

 Now Run the Data.

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Output :

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Experiment :- 07

Aim :
A : Create a gauge report and a pie chart report.

Step1: Create Report


1. Log in to IBM Cognos Analytics.
2. Click "Reports" > "Create Report".
3. Choose "Blank Report" or a template.

Step 2:
a) Now Select Table of 1 rows and 2 column.
b) And now select the source .
c) In first table select Visualization , then select Chart from drop down menue.

d) Now then select Gauge report.


e) Fill the items.

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


f) Now for, pie chart select 11.1 Visualization from drop down menu .
g) Then select Pie .
h) Fill the items .

I) Run the table.

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Output :-

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


B : Create a promt by adding a parameter , add value and select-search
prompt in a report

Step1: Create Report


1. Log in to IBM Cognos Analytics.
2. Click "Reports" > "Create Report".
3. Choose "Blank Report" or a template.

Step2:
i. Select List from Widget Type .
ii. Select source .
iii. Fill the items.

iv. Now add Advance filter by selecting Year.

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Output :-

 Then select ok

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33
Experiment No. :- 08

Aim : Implementation of Workbook basics and Data Import.

Steps :
 Open Microsoft Office Excel
 Go to blank Workbook .

 Import Data.

 Apply Sum Funtions.

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33
Experiment No. :-09

Aim :- Implementation of table management, Customization and data analysis.

Steps :-
 Open Microsoft Office Excel
 Go to blank Workbook .

 Now go to Insert option next to the Home Tab in Ribbon.

 Then Click on Table option.

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


 Then, put the table format till where you want to select it.

 Now , you can give any colour to table.


 And import data.

 To format any table , Just select the row or column which you want to format and then just
click on Conditional Formatting , Present on Home tab.

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


 Then Select the HIGHLIGHT CELLS RULES which you want to select .
 Then give your condition .
 Then you can observe that , the selected row will automatic get change in colour.

 To Analysis the data , there is an option of Filter which is present on DATA tab .

 Click on any section present on your Data then select Drop down Section .

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


 Then choose your Formatting option From Number Filters .

 Then put the data to be filter and then select ok.

 You will observe that filter is has been done and only those value will show which are been
filtered.

Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33


Name – Shashank Awasthi Roll No. - 202310101150070 Group - 33

You might also like