0% found this document useful (0 votes)
5 views41 pages

DataFrame and Visualization Techniques

The document outlines a series of labs focusing on basic functions in Python, including data manipulation with dictionaries and DataFrames using pandas, as well as data analysis using NumPy. It describes the creation of visualizations using Matplotlib, including line graphs and scatter plots, with customization options for style and labels. Additionally, it mentions creating a report using IBM Cognos, indicating a practical application of data analysis skills.

Uploaded by

ashutosh.15bvb
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views41 pages

DataFrame and Visualization Techniques

The document outlines a series of labs focusing on basic functions in Python, including data manipulation with dictionaries and DataFrames using pandas, as well as data analysis using NumPy. It describes the creation of visualizations using Matplotlib, including line graphs and scatter plots, with customization options for style and labels. Additionally, it mentions creating a report using IBM Cognos, indicating a practical application of data analysis skills.

Uploaded by

ashutosh.15bvb
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

LAB-1-Basic Function

Import Necessary libraries

Make a dictonary

[ ]: dict={
'Name':['Abhishek','Raghubar','Anish','Divyansh','Abhishek','Raghubar']
,
'Age':[21,21,19,20,21,34],
'City':['lucknow','Deoria','Mau','Basti','lucknow','Deoria'],
'Department':['CS','ME','EC','EE','CS','ME'],
'Fee':[150000,150000,135000,125000,150000,150000],
}

Chnage Dictonary into DataFrame

[ ]: Name Age City Department Fee 0


Abhishek 21 lucknow CS 150000
1 Raghubar 21 Deoria ME 150000
2 Anish 19 Mau EC 135000
3 Divyansh 20 Basti EE 125000
4 Abhishek 21 lucknow CS 150000
5 Raghubar 34 Deoria ME 150000

Use Head Function

[ ]: Name Age City Department Fee 0


Abhishek 21 lucknow CS 150000
1 Raghubar 21 Deoria ME 150000
2 Anish 19 Mau EC 135000
3 Divyansh 20 Basti EE 125000s
4 Abhishek 21 lucknow CS 150000

Print upper rows of data

Ashutosh Pandey 202210101330028


[ ]: Name Age City Department Fee 0
Abhishek 21 lucknow CS 150000
1 Raghubar 21 Deoria ME 150000

Get the all columns of data

[ ]: Index(['Name', 'Age', 'City', 'Department', 'Fee'], dtype='object')

Get the all values of the DataFrame

[ ]: array([['Abhishek', 21, 'lucknow', 'CS', 150000],


['Raghubar', 21, 'Deoria', 'ME', 150000],
['Anish', 19, 'Mau', 'EC', 135000],
['Divyansh', 20, 'Basti', 'EE', 125000],
['Abhishek', 21, 'lucknow', 'CS', 150000],
['Raghubar', 34, 'Deoria', 'ME', 150000]], dtype=object)

Get the index range of DataFrame

[ ]: RangeIndex(start=0, stop=6, step=1)

Print a Specified column Data

[ ]: 0 lucknow
1 Deoria
2 Mau
3 Basti
4 lucknow
5 Deoria
Name: City, dtype: object

Print the data of index value 1

[ ]: Name Raghubar
Age 21
City Deoria
Department ME
Fee 150000
Name: 1, dtype: object

Handling Missing Data


[ ]: Name Age City Department Fee 0
False False False False False
1 False False False False False
2 False False False False
False
3 False False False False
False
4 False False False False
False
5 False False False False
False
Duplicates Value

Drop Duplicate Values

[ ]: Name Age City Department Fee 0 Abhishek


21 lucknow CS 150000
1 Raghubar 21 Deoria ME 150000
2 Anish 19 Mau EC 135000
3 Divyansh 20 Basti EE 125000
5 Raghubar 34 Deoria ME 150000

Create Another DataFrame

0 Abhinav 20 Lucknow Law 135000


1 AKhilesh 30 Barabanki BPharma
145000
2 Anand 35 Sitapur DPharma 78000

Ashutosh Pandey 202210101330028


LAB 2-NUMPY

[ ]: {'Math': array([32, 33, 68, 59, 50, 32, 78, 96, 1, 56, 78, 33, 94,
17, 92, 75,
35,
34, 85, 15, 49, 77, 0, 59, 65, 33, 49, 78, 14, 90, 68, 45,
83, 73,
76, 44, 73, 66, 32, 89, 63, 58, 9, 83, 4, 37, 65, 15, 6, 94],
dtype=int32),
'Science': array([18, 54, 62, 30, 33, 55, 27, 21, 14, 59, 12, 37,
37, 47, 4,
68, 72,
27, 56, 8, 12, 63, 18, 58, 51, 37, 59, 74, 47, 9, 79, 74, 74,
49,
17, 41, 50, 26, 66, 38, 40, 41, 21, 49, 74, 75, 4, 58, 38,
31], dtype=int32),
'Hindi': array([ 51, 32, 18, 20, 100, 43, 91, 85, 16, 54, 84, 60,
30,
40, 10, 80, 23, 36, 36, 50, 46, 87, 14, 52, 35, 21,
65, 35, 84, 99, 40, 39, 79, 44, 45, 37, 79, 14, 23,
5, 69, 41, 28, 74, 73, 2, 71, 58, 28, 29], dtype=int32)}

[ ]: Math Science Hindi


0 32 18 51
1 33 54 32
2 68 62 18
3 59 30 20
4 50 33 100
5 32 55 43
6 78 27 91
7 96 21 85
8 1 14 16
9 56 59 54
10 78 12 84
11 33 37 60
12 94 37 30
13 17 47 40
14 92 4 10
15 75 68 80
16 35 72 23
17 34 27 36
18 85 56 36
19 15 8 50
20 49 12 46
21 77 63 87
22 0 18 14
23 59 58 52
24 65 51 35
25 33 37 21
26 49 59 65
27 78 74 35
28 14 47 84
29 90 9 99
30 68 79 40
31 45 74 39
32 83 74 79
33 73 49 44
34 76 17 45
35 44 41 37
36 73 50 79
37 66 26 14
38 32 66 23
39 89 38 5
40 63 40 69
41 58 41 41
42 9 21 28
43 83 49 74
44 4 74 73
45 37 75 2
46 65 4 71
47 15 58 58
48 6 38 28
49 94 31 29

[ ]: (50, 3)

Ashutosh Pandey 202210101330028


[ ]: Math int32
Science int32
Hindi int32
dtype: object

[ ]: Math 0
Science 0
Hindi 0 dtype:
int64

[ ]: Math Science Hindi


count 50.000000 50.00000
50.000000
mean 53.200000 42.280000 47.50000
std 28.215642 21.654089 26.20426
min 0.000000 4.000000 2.00000
25% 33.000000 26.250000 28.25000
50% 58.500000 41.000000 42.00000
75% 76.750000 58.750000 70.50000
max 96.000000 79.000000 100.00000

[ ]: np.float64(42.28)

[ ]: np.float64(58.5)

[ ]: 0 14
1 23
2 28
3 35
4 36
5 40
6 79
7 84
Name: Hindi, dtype: int32
Lab3-Numpy_PF

0 68 41 57
1 41 49 94
2 10 50 77
3 43 12 53
4 68 33 55
5 15 3 78
6 91 77 63
7 63 9 84
8 93 8 87
9 0 32 57
10 65 56 61
11 87 50 96
12 86 63 79
13 57 7 54
14 76 47 76
15 83 34 56
16 32 49 95
17 11 4 75
18 18 0 76
19 32 46 84
20 13 43 74
21 99 17 55
22 74 53 86
23 13 32 69
24 93 60 59
25 51 21 65
26 12 69 51
27 69 42 82
28 38 29 97
29 21 16 81
30 43 17 88
31 10 24 82
32 87 5 61
33 64 71 91
34 95 15 75
35 99 31 91
36 16 50 60
37 14 32 92
38 75 56 55
39 9 67 96
40 42 46 98
41 95 72 99
42 100 9 100
43 89 29 93
44 54 33 77
45 49 27 64
46 37 62 96
47 74 36 71
48 44 2 98
49 15 52 54

[ ]: (50, 3)

[ ]: Math int32
Science int32
Hindi int32
dtype: object
[ ]: np.float64(35.76)

[ ]: np.float64(52.5)

[ ]: 0 55
1 96
Name: Hindi, dtype: int32

[ ]: Math
68 2
10 2
43 2
15 2
13 2
87 2
93 2
99 2
74 2
95 2
32 2
63 1
91 1
41 1
0 1
83 1
76 1
LAB-4

Object: Create a Line Graph and Scatter Plot using Matplotlib, Customizing the style and label also design
multiple subplots to compare diffrent visualization of the same dataset , adding annotations for clarity

Create Data

Now start making linear plot

Now Customize the style and labels in Line Graph:


Customization of style: a) Adjust the graph size b) Adjust the line width c) Add marker to increse point
visibility d) Add gridllines e) Change the line styles
Customization of Lable a) Add label b) Change the Font style of lables c) Customize the colour of lables d)
Customize the Size of labels Customize the Line Style
Customize the labels
Create Scatter Plot
Now Customize the style and labels in Scatter Graph:
Customization of style: a) Adjust the graph size b) Adjust the scatter width c) Add diffrent kinds of marker
d) Add gridllines e) Change the color of markers
Customization of Lable: a) Add label b) Change the Font style of lables c) Customize the colour of lables
d) Customize the Size of labels Customization of Style
Customization of Lable

[90]: font1={'family':'Times New Roman','size':25,'style':'oblique'}


font2={'family':'cursive','size':15,'style':'italic'}
[Link](figsize=(8,4))
[Link](x,y,s=30,marker='*',c=clr,cmap=
'BrBG') [Link]("Scatter Plot",font1)
[Link]("Frequency",font2)
[Link]("Values",font2) [Link]()
var=[Link]() var.set_label('Color
Bar',fontsize=15) [Link]()
LAB 5
 Aim:
1) Create a report from a Sample Data Source Dataset using IBM Cognos.

 Working/Perform:
1) Open IBM Cognos.
2) Launch Cognos Analytics on Cloud for Students.
3) Click on New and Select Report.
4) Create a blank template.
5) Click on Source and Select a Sample Dataset whichever you want.
6) Add relevant parameters in rows and column and run the report.

 Outcome/Learning: To create a report.

 Required Tool: IBM Cognos.

 Process: (1) To Create a report from a Sample Data Source Dataset using IBM
Cognos.

1) Launch Cognos Analytics on Cloud

2) Create a New Report

Ashutosh Pandey 202210101330028


3) Select the Blank Template

4) Choose the Select Source option then select the Content type(My
Content/Team Content) then select Sample then select Data after that
choose Dataset which you want.

Ashutosh Pandey 202210101330028


5) Add the parameters in the list.

6) Run the list.

Ashutosh Pandey 202210101330028


Ashutosh Pandey 202210101330028
LAB 6
 Aim:
1) Create a report using filters, detail filter on fact data in a report.

 Working/Perform:
1) Open IBM Cognos.
2) Launch Cognos Analytics on Cloud for Students.
3) Click on New and Select Report.
4) Create a blank template.
5) Click on Source and Select a Sample Dataset whichever you want.
6) Add relevant parameters in rows and column and apply Filter on them.
7) Run the report.

 Outcome/Learning: To learn how can we apply Filters on Data Module.

 Required Tool: IBM Cognos.

 Process: (1) To create a report using filters, detail filter on fact data in a report.

1) Launch Cognos Analytics on Cloud

2) Create a New Report

Ashutosh Pandey 202210101330028


3) Select the Blank Template

4) Choose the Select Source option then select the Content type (My
Content/Team Content) then select Sample then select Data after that
choose Dataset which you want.

5) Add the parameters in the list and click on the Filter icon.

Ashutosh Pandey 202210101330028


6) Click on Edit Filters and then you have multiple options to apply various
filters on list you can explore one by one.
Here, for demo we choose keep these values, and on section we choose
Greater than and enter our desired range (1000 in my case).

7) Select the type of filters, pay attention the filter is come according to your
Datatype of column.

Ashutosh Pandey 202210101330028


8) Run the list, now the filtered output is achieved.

Ashutosh Pandey 202210101330028


LAB 7
 Aim:
1) Create a report using Advance Filter on fact data in a report.
2) Create a gauge report and Pie Chart report.
 Working/Perform:
1) Open IBM Cognos.
2) Launch Cognos Analytics on Cloud for Students.
3) Click on New and Select Report.
4) Create a blank template.
5) Click on Source and Select a Sample Dataset whichever you want.
6) Add relevant parameters in rows and column and apply Advance Filter
on them.
7) Run the report.

 Required Tool: IBM Cognos.

Process: (1) Create a report using Advance Filter on fact data in a report.
1) Follow the same steps from 1 to 4 as usual. The after adding relevant
parameter now, we apply Advance on them lets see with fig:

2) Click on filter icon then selects the Edit Filter.

Ashutosh Pandey 202210101330028


3) After this click on + icon.

4) Then select the advance option.

Ashutosh Pandey 202210101330028


5) After that click on Data Item then drop the column in Expression
Definition Box Then Enter the text which you want to Show when It ask
for value in between off ?xyz?.

6) Afterwards select the Required it is not compulsory but for practical we


select it and then click Ok.

Ashutosh Pandey 202210101330028


Page

7) Now Run the report……

Ashutosh Pandey 202210101330028


Page

8) Now you need to enter the Customer ID, after that it shows all the entry
of that particular Customer ID all details

Ashutosh Pandey 202210101330028


LAB 8
 Aim: Apply any three numeric formulas in Excel Workbook.

 Working/ Perform:

1) Open the MS Excel


2) You have multiple types of Workbook template but you have to choose
Blank Workbook. 3)Apply any three relevant formulae.

 Required Tool: MS Excel, Google Sheets.

 Process:

1) Launch MS Excel.
2) Create a New Blank Work.
3) Import the data.

Ashutosh Pandey 202210101330028


Now we’re applying the Formulas.

FILTER-1

1) Select the Column in which you want to apply filter, here we apply
Greater than filter which shows all the value in Dataset which is
greater than the applied range.
2) Select Data from the Ribbon click on Filter.
3) Now you have a Dropdown Arrow click on this after that you will
show a New Menu.
4) From that you need to select Number Filters after that you have all
Filter Menu in which you have to select your preferred filter in my
case you can choose greater than.

<

5) Now enter the value in and click ok.

Ashutosh Pandey 202210101330028


Result: Now you will have your desired result.

ASHUTOSH PANDEY 202210101330028


LAB-9
 Aim: Apply any three Numeric and String formulas in Excel Workbook.

 Working/ Perform:

1) Open the MS Excel


2) You have multiple types of Workbook template but you have to choose
Blank Workbook. 3)Apply any three relevant formulae of string and
Number.

 Outcome/Learning: To learn how can we apply numeric and String


formulas and filter the data and for precise information.

 Required Tool: MS Excel, Google Sheets.

 Process:

String Formulas
1) Follow the same step from LAB-8 Step1 to Step3.
2) Now you will have an Unstructured String data.

1) Now select a new cell in which you have to apply the formula then type
=PROPER(CELL ADDRESS) and apply.

Ashutosh Pandey 202210101330028


Now fill all the cell with Fill Series. and your result is:

ASHUTOSH PANDEY 202210101330028


LAB 10
Aim: Make a Pivot table and Pivot Chart.
Working/ Perform:
1) Open the MS Excel
2) You have multiple types of Workbook template but you have to choose
Blank Workbook. 3)Apply Pivot table and Pivot chart in workbook.

 Outcome/Learning: To learn how can we use pivot table and pivot chart to
summaries the data in visually in graphs or chart for precise information.

 Required Tool: MS Excel, Google Sheets.

 Process:

1) Follow the same steps as previous lab from step 1-step 3.

Now if you have a larger dataset or having multiple cells with same name
but with different values or you want to the which cell has max value of
its entire data then here you can use Pivot table.

2) So after importing data click on Insert from ribbon then click on Pivot table
after that you have pop up window in which you have to select the Existing
or New Workbook or select the table for pivot chart.

3) After clicking you will have to see a new workbook look like this , Choose
the field to add to report.

ASHUTOSH PANDEY 202210101330028


4) After that you have 4 area Filter, Columns, Rows, Values.

ASHUTOSH PANDEY 202210101330028


5) Click on Value Field Settings then you have a multiple calculation field here
we select Max to get max of each same cell.

6) Your Pivot table is ready.

ASHUTOSH PANDEY 202210101330028


ASHUTOSH PANDEY 202210101330028

Common questions

Powered by AI

Applying filters in spreadsheets enhances data analysis by allowing users to isolate specific data points, which increases precision in observations. Examples of filter types include numeric filters like 'Greater than' to display values exceeding a certain threshold and text filters to focus on specific descriptive parameters. These filters make it easier to analyze large datasets by focusing on relevant data subsets .

Customizing scatter plots by adjusting graph size, marker types, colors, and gridlines enhances data interpretation by making key data points more visible and distinctive. Custom labels and annotation can further highlight trends and correlations, improving the overall clarity of the visualization .

Duplicate entries in a dataset can be managed using the 'drop_duplicates()' method in Python's pandas library. This function helps in removing duplicate rows based on specific columns or all columns if none are specified .

Advanced filters in platforms like IBM Cognos allow for fine-tuning large datasets by applying complex conditions and logical expressions. This capability enables users to conduct in-depth analysis by focusing on data points of interest, significantly improving the efficiency and accuracy of data handling and decision-making .

To create a report with detailed filters in IBM Cognos, select the dataset, add parameters to the report, and apply the desired filters. Detailed filters refine the dataset by including only data that meets specific conditions. This offers precise control over the data being analyzed, enhancing the relevance and accuracy of report insights .

IBM Cognos facilitates the creation of complex data reports by enabling users to select appropriate datasets, add parameters, and apply various filters to refine data output. Filtration options include basic and advanced filters that allow the user to specifically target data segments, making it a powerful tool for precise data analysis and report generation .

Key customization options for creating a line graph using Matplotlib include adjusting graph size, line width, markers for better point visibility, gridlines, and changing the line styles. Additionally, labels can be customized by changing font style, color, and size .

Statistical functions in NumPy such as mean, standard deviation, and minimum/maximum values help summarize and understand the dataset's central tendency, dispersion, and range. Calculating these metrics can provide insights into the performance and distribution of data features .

To create a data report in IBM Cognos Analytics, start by launching Cognos Analytics, creating a new report with the blank template, selecting the desired data source, and adding relevant parameters in the rows and columns. After setting up the list, the report can be run to generate data visualizations and summaries from the selected dataset .

The process of using a pivot table involves selecting data in Excel, then using the 'Insert' tab to create a pivot table. This allows users to summarize and analyze data by dragging fields into areas such as filters, columns, rows, and values. Pivot tables are particularly useful for identifying trends and making data comparisons across various parameters .

You might also like