DVP PDF
DVP PDF
Prepared by: -
LAB MANUAL
MISSION:
K.S. School of Engineering and Management shall,
Establish state-of-art infrastructure to facilitate effective dissemination of technical and
Managerial knowledge.
Provide comprehensive educational experience through a combination of curricular and
experiential learning, strengthened by industry-institute- interaction.
Pursue socially relevant research and disseminate knowledge.
Inculcate leadership skills and foster entrepreneurial spirit among students.
MISSION:
To deliver high-quality education in the fields of technology and businessthrough
effective teaching-learning practices and a conducive learning environment.
To create the centre of excellence through collaborations with industries andvarious
entities, addressing the evolving demands of society.
To foster an environment that promotes innovation, multidisciplinary research,skill
enhancement and entrepreneurship.
To uphold and advocate for elevated standards of professional ethics and
transparency.
DATA VISUALIZATION WITH PYTHON (BCS358D)
2 a) Defined as a function F as Fn = Fn-1 + Fn-2. Write a Python program which accepts a value for N (where N
>0) as input and pass this value to the function. Display suitable error message if the condition for input value
is not followed.
b) Develop a python program to convert binary to decimal, octal to hexadecimal using functions.
Functions:https://www.youtube.com/watch?v=BVfCWuca9nw
Arguments:https://www.youtube.com/watch?v=ijXMGpoMkhQ Return
value: https://www.youtube.com/watch?v=nuNXiEDnM44
3 a) Write a Python program that accepts a sentence and find the number of words, digits, uppercase letters and
lowercase letters.
b) Write a Python program to find the string similarity between two given strings
4 a) Write a Python program to Demonstrate how to Draw a Bar Plot using Matplotlib.
b) Write a Python program to Demonstrate how to Draw a Scatter Plot using Matplotlib.
https://www.youtube.com/watch?v=RRHQ6Fs1b8w&list=PLjVLYmrlmjGcC0B_FP3bkJ-
JIPkV5GuZR&index=3
https://www.youtube.com/watch?v=7ABCuhWO9II&list=PLjVLYmrlmjGcC0B_FP3bkJ-
JIPkV5GuZR&index=4
5
a) Write a Python program to Demonstrate how to Draw a Histogram Plot using Matplotlib.
b) Write a Python program to Demonstrate how to Draw a Pie Chart using Matplotlib.
https://www.youtube.com/watch?v=Qk7caotaQUQ&list=PLjVLYmrlmjGcC0B_FP3bkJ-
JIPkV5GuZR&index=6
https://www.youtube.com/watch?v=PSji21jUNO0&list=PLjVLYmrlmjGcC0B_FP3bkJ-
JIPkV5GuZR&index=7
https://www.youtube.com/watch?v=UO98lJQ3QGI&list=PL-osiE80TeTvipOqomVEeZ1HRrcEvtZB_
7
Write a Python program which explains uses of customizing seaborn plots with Aesthetic functions.
https://www.youtube.com/watch?v=6GUZXDef2U0
8 Write a Python program to explain working with bokeh line graph using Annotations and Legends.
a) Write a Python program for plotting different types of plots using Bokeh.
https://www.youtube.com/watch?v=HDvxYoRadcA
https://www.youtube.com/watch?v=cCck7hCanpw&list=PLE50-dh6JzC4onX-
qkv9H3HtPbBVA8M94&index=4
https://www.youtube.com/watch?v=xnJ2TNrGYik&list=PLE50-dh6JzC4onX-
qkv9H3HtPbBVA8M94&index=5
https://www.youtube.com/watch?v=D35m2CdMhVs&list=PLE50-dh6JzC4onX-
qkv9H3HtPbBVA8M94&index=6
Python (Full Course): https://www.youtube.com/watch?v=_uQrJ0TkZlc
Pedagogy For the above experiments the following pedagogy can be considered. Problem
based learning, Active learning, MOOC, Chalk &Talk
Course outcomes (Course Skill Set):
At the end of the course the student will be able to:
CO 1. Demonstrate the use of IDLE or PyCharm IDE to create Python Applications
CO 2. Use Python programming constructs to develop programs for solving real-world problemsCO 3.
Use Matplotlib for drawing different Plots
CO 4. Demonstrate working with Seaborn, Bokeh for visualization.
CO 5. Use Plotly for drawing Time Series and Maps.
the syllabus.
● In a test, test write-up, conduction of experiment, acceptable result, and procedural knowledge
will carry a weightage of 60% and the rest 40% for viva-voce.
● The suitable rubrics can be designed to evaluate each student’s performance and learning ability.
● The marks scored shall be scaled down to 20 marks (40% of the maximum marks).
The Sum of scaled-down marks scored in the report write-up/journal and marks of a test is the total CIE
marks scored by the student.
Semester End Evaluation (SEE):
The examination schedule and names of examiners are informed to the university before
the conduction of the examination. These practical examinations are to be conducted
between the schedule mentioned in the academic calendar of the University.
All laboratory experiments are to be included for practical examination.
(Rubrics) Breakup of marks and the instructions printed on the cover page of the answer
script to be strictly adhered to by the examiners. OR based on the course requirement
evaluation rubrics shall be decided jointly by examiners.
Students can pick one question (experiment) from the questions lot prepared by the
examiners jointly.
General rubrics suggested for SEE are mentioned here, writeup-20%, Conduction
procedure and result in -60%, Viva-voce 20% of maximum marks. SEE for practical shall
be evaluated for 100 marks and scored marks shall be scaled down to 50 marks (however,
based on course type, rubrics shall be decided by the examiners)
Change of experiment is allowed only once and 15% of Marks allotted to the procedure
part are to be made zero.
The minimum duration of SEE is 02 hours
● Weightage of marks for PART A is 80% and for PART B is 20%. General rubrics
suggested to be followed for part A and part B.
● Change of experiment is allowed only once and Marks allotted to the procedure part to
be made zero (Not allowed for Part B).
● The duration of SEE is 03 hours
Rubrics suggested in Annexure-II of Regulation book
Textbooks:
1. Al Sweigart, “Automate the Boring Stuff with Python”,1stEdition, No Starch Press,
2015. (Available under CC-BY-NC-SA license at https://automatetheboringstuff.com/)
2. Reema Thareja “Python Programming Using Problem Solving Approach” Oxford University
Press.
3. Allen B. Downey, “Think Python: How to Think Like a Computer Scientist”,
2nd Edition, Green Tea Press, 2015. (Available under CC-BY-NC license
at http://greenteapress.com/thinkpython2/thinkpython2.pdf)
4. Jake VanderPlas “Python Data Science Handbook” 1st Edition, O’REILLY.
Semester End Evaluation (SEE):
SEE marks for the practical course are 50 Marks.
SEE shall be conducted jointly by the two examiners of the same institute, examiners are appointed
by the Head of the Institute.
The examination schedule and names of examiners are informed to the university before the
conduction of the examination. These practical examinations are to be conducted
between the schedule mentioned in the academic calendar of the University. All laboratory
experiments are to be included for practical examination.
(Rubrics) Breakup of marks and the instructions printed on the cover page of the answer script to be
strictly adhered to by the examiners. OR based on the course requirement evaluation rubrics shall be
decided jointly by examiners.
Students can pick one question (experiment) from the questions lot prepared by the examiners
jointly.
Evaluation of test write-up/ conduction procedure and result/viva will be conducted jointly by
examiners.
General rubrics suggested for SEE are mentioned here, writeup-20%, Conduction procedure and
result in -60%, Viva-voce 20% of maximum marks. SEE for practical shall
be evaluated for 100 marks and scored marks shall be scaled down to 50 marks (however, based on
course type, rubrics shall be decided by the examiners)
Change of experiment is allowed only once and 15% of Marks allotted to the procedure part are
to be made zero.
The minimum duration of SEE is 02 hours
● Weightage of marks for PART A is 80% and for PART B is 20%. General rubrics
suggested to be followed for part A and part B.
● Change of experiment is allowed only once and Marks allotted to the procedure part to
be made zero (Not allowed for Part B).
● The duration of SEE is 03 hours
Rubrics suggested in Annexure-II of Regulation book
Textbooks:
5. Al Sweigart, “Automate the Boring Stuff with Python”,1stEdition, No Starch Press,
2015. (Available under CC-BY-NC-SA license at https://automatetheboringstuff.com/)
6. Reema Thareja “Python Programming Using Problem Solving Approach” Oxford University
Press.
7. Allen B. Downey, “Think Python: How to Think Like a Computer Scientist”,
2nd Edition, Green Tea Press, 2015. (Available under CC-BY-NC license at
http://greenteapress.com/thinkpython2/thinkpython2.pdf)
8. Jake VanderPlas “Python Data Science Handbook” 1st Edition, O’REILLY.
CO-PO Mapping
Course: Data Visualization with Python Course Code: BCS358D
No of
Hours
Practical/Field Total Number of
Lab Hours Total hours/Week
Work/Allied LabContact
Activities Hours
2 0 2 28
Marks
CIE SEE Total Credit
s
50 50 100 01
Aim/Objectives of the Course
This laboratory course enables students to get practical experience in design, develop, implement,
analyzeand evaluation/testing of
1. Demonstrate the use Python programming constructs to develop
programsfor solving real-world problems.
2. Identify the different functions of Matplotlib for drawing different Plots.
3. Demonstrate working with Seaborn, Bokeh for visualization.
4. Discover the need of Plotly for drawing Time Series and Maps.
CO5 Apply Plotly for drawing Time Series and Maps Applying (K3)
Syllabus
Content
CO1, CO2
2 hrs
Program – 1
PO1-3
a) Write a python program to find the best of two test average marks out of PO2-3
PO3-2
three test’s marks acceptedfrom the user. PO4-1
PO5-3
PO8-2
b) Develop a Python program to check whether a given number is PO9-1
PO12 -
palindrome or not and also count the number of occurrences of each digit
1PSO1-
in the input number. 2PSO2-
2
CO1, CO2
Program – 2 2 hrs
CO1,CO2
2 hrs
Program – 3
PO1-3
a) Write a Python program that accepts a sentence and find the PO2-3
number ofwords, digits, uppercase letters andlowercase letters. PO3-2
PO4-1
PO5-3
PO8-2
b) Write a Python program to find the string similarity between two
givenstrings. PO9-1
PO12 -
1PSO1-
2PSO2-
2
Program – 4 CO3
2 hrs
a) Write a Python program to Demonstrate how to Draw a Bar Plot
usingMatplotlib. PO1-3
b) Write a Python program to Demonstrate how to Draw a Scatter Plot PO2-3
PO3-2
usingMatplotlib.
PO4-1
PO5-3
PO8-2
PO9-1
PO12 -
1PSO1-
3
PSO2-3
CO3
Program – 5 2 hrs
a) Write a Python program to Demonstrate how to Draw a Histogram PO1-3
Plotusing Matplotlib. PO2-3
b) Write a Python program to Demonstrate how to Draw a Pie Chart PO3-2
PO4-1
usingMatplotlib.
PO5-3
PO8-2
PO9-1
PO12 -1
PSO1-3
PSO2-3
CO3
Program – 6 2 hrs
CO4
Program – 7 2 hrs
PO1-3
a) Write a Python program which explains uses of customizing seaborn PO2-3
plotswith Aesthetic functions. PO3-2
PO4-1
PO5-3
PO8-2
PO9-1
PO12 -1
PSO1-3
PSO2-3
CO4
Program – 8 2 hrs
Write a Python program to explain working with bokeh line graph using PO1-3
Annotations and Legends. PO2-3
PO3-2
a) Write a Python program for plotting different types of plots using Bokeh. PO4-1
PO5-3
PO8-2
PO9-1
PO12 -1
PSO1-3
PSO2-3
CO5
Program – 9 2 hrs
Write a Python program to draw 3D Plots using Plotly Libraries. PO1-3
PO2-3
PO3-2
PO4-1
PO5-3
PO8-2
PO9-1
PO12 -1
PSO1-3
PSO2-3
CO5
Program – 10 2 hrs
a) Write a Python program to draw Time Series using Plotly Libraries. PO1-3
b) Write a Python program for creating Maps using Plotly Libraries. PO2-
PO32
PO4-1
PO5-3
PO8-2
PO9-1
PO12 -1
PSO1-3
PSO2-3
CO to PO Mapping
PSO1: Understand fundamental and advanced concepts in the core areas of Computer Science and
Engineering to analyze, design and implement the solutions for the real-world problems.
PSO2: Utilize modern technological innovations efficiently in various applications to work
towards the betterment of society and solve engineering problems.
BCS K-
304 level
CO1 K3 3 3 2 1 3 - - 2 1 - - 1 2 2
CO2 K3 3 3 2 1 3 - - 2 1 - - 1 2 2
CO3 K3 3 3 2 1 3 - - 2 1 - - 1 3 3
CO4 K3 3 3 2 1 3 - - 2 1 - - 1 3 3
CO5 K3 3 3 2 1 3 - - 2 1 - - 1 3 3
Program1a:
Write a python program to find the best of two test average marks out of three test’s marks accepted from
the user.
#Sort marks
marks.sort (reverse=1)
print("\n Marks after sorting")
print(marks)
#Find Average
avg = ((marks [0] +marks [1]))/2
print("\n The average marks of the student: ", avg)
Output:
Enter Test1 marks: 34
Enter Test2 marks: 35
Enter Test3 marks: 36
[34.0, 35.0, 36.0]
#Alternate Program
n=3 #No. of Tests
marks = []
for i in range(0,n):
test_mark = float(input("Enter the marks:"))
marks.append(test_mark)
marks.sort(reverse=True)
print("Best of two average test marks:", (marks[0] + marks[1])/2 )
Output:
Enter the marks:2
Enter the marks:4
Enter the marks:6
Best of two average test marks: 5.0
Program1b:
Develop a Python program to check whether a given number is palindrome or not and also count the number
of occurrences of each digit in the input number.
num = input("Enter a number: ")
Output:
Enter a number: 112211
Number is a Palindrome.
Number: 112211
1 appears 4 times.
2 appears 2 times.
# Alternate Program
#Read num
num = input("Enter the number: ")
#num_list = list(num)
rev_num = num[::-1] # reverse num
if num == rev_num :
print("The number is a palindrome")
else:
print("the number is not a palindrome")
#Display result
Dept of CS & BS, KSSEM 13
DATA VISUALIZATION WITH PYTHON (BCS358D)
Output:
Enter the number: 44544
The number is a palindrome
4 is found 4 times
5 is found 1 times
Program 2a:
Defined as a function F as Fn = Fn-1 + Fn-2. Write a Python program which accepts a value for N (where N
>0) as input and pass this value to the function. Display suitable error message if the condition for input
value is not followed.
def F(n):
if n == 0 or n == 1:
return 1
else:
return F(n-1) + F(n-2)
Output:
Enter the value of N: 5
Fibonacci value at nth position is: 8
Program 2b:
Develop a python program to convert binary to decimal, octal to hexadecimal using functions.
if(int(digit) == 1):
decimal_num = decimal_num + 2 ** exp;
elif(int(digit) == 0):
continue
else:
print("Invalid input.")
return -1
return decimal_num
while temp:
Dept of CS & BS, KSSEM 15
DATA VISUALIZATION WITH PYTHON (BCS358D)
last_digit = temp % 10
dec_value += last_digit * base
base = base * 8
temp = temp // 10
return dec_hex(dec_value)
while n != 0:
temp = 0
temp = n % 16
if temp < 10:
hexaDeciNum = str(temp) + hexaDeciNum
else:
hexaDeciNum = chr(temp + 87) + hexaDeciNum
n = n // 16
return hexaDeciNum
Output:
Enter a binary number: 1010
Decimal Equivalent 10
Program 3a:
Write a Python program that accepts a sentence and find the number of words, digits, uppercase letters and
lowercase letters.
sentence = input ("Enter the Sentence ")
w, d, l, u = 0, 0, 0, 0
#Print Outputs
print ("Number of words", w)
print ("Number of Digits", d)
print ("Number of Uppercase Letters", u)
print ("Number of Lowercase Letters", l)
Output:
Enter the Sentence HELLO PYTHON
Number of words 2
Number of Digits 0
Number of Uppercase Letters 11
Number of Lowercase Letters 0
#Alternate Program
sentence = input ("Enter the Sentence ")
words = sentence.split()
#print("Number of words:",len(words))
digits = []
u_letters = []
l_letters = []
spl_chars = []
for ch in sentence:
if ch.isdecimal():
digits.append(ch)
elif ch.isupper():
u_letters.append(ch)
elif ch.islower():
Dept of CS & BS, KSSEM 17
DATA VISUALIZATION WITH PYTHON (BCS358D)
l_letters.append(ch)
else:
spl_chars.append(ch)
#print(digits,u_letters,l_letters,spl_chars)
print("Number of Words : ",len(words))
print("Number of Digits : ",len(digits))
print("Number of Upper case letters : ",len(u_letters))
print("Number of Lower case letters : ",len(l_letters))
Output:
Enter the Sentence Welcome to KSSEM 01-11-2023
Number of Words : 4
Number of Digits : 8
Number of Upper case letters : 6
Number of Lower case letters : 8
Program 3b:
Write a Python program to find the string similarity between two given strings.
from difflib import SequenceMatcher
Output:
Enter the first string :hello
Enter the second string :Hello
Similarity score:
0.8
Program 4a:
Write a Python program to Demonstrate how to Draw a Bar Plot using Matplotlib.
# Profit made on product1 and Product2 on different days
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
p1_sales = [1, 2, 3, 4, 5, 6, 7]
p2_sales = [5, 3, 6, 2, 3, 6, 5]
x_axis = np.arange(len(days))
plt.xticks(x_axis, days)
#plt.set_ylim(0, 10)
Output:
#Alternate program
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
days = ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
values = [13, 89, 78, 73, 90, 23, 67]
Output:
Program 4b:
Write a Python program to Demonstrate how to Draw a Scatter Plot using Matplotlib.
Output:
Program 5a:
Write a Python program to Demonstrate how to Draw a Histogram Plot using Matplotlib.
#Create Histogram
plt.hist(student_marks, bins=20, color='skyblue', edgecolor='black')
Output:
Program 5b:
Write a Python program to Demonstrate how to Draw a Pie Chart using Matplotlib.
countries = ['Brazil','Germany','Italy','Argentina','Uruguay','France','England','Spain']
wins = [5, 4, 4, 3, 2, 2, 1, 1]
colors = ['yellow','magenta','green','blue','lightblue','red','cyan']
#Add title
plt.title('FIFA World Cup Wins')
Output:
Program 6a:
Write a Python program to illustrate Linear Plotting using Matplotlib.
Y2 = np.square(X)
print(Y2)
Y3 = np.sqrt(X)
# Line plot
plt.plot(X, Y1, 'r', X, Y2, 'b', X, Y3, 'g')
plt.legend(['X', 'X-square', 'Square-root'])
Output:
Program 6b:
Write a Python program to illustrate liner plotting with line formatting using Matplotlib.
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
X = np.linspace(1,20,10)
print(X)
Y2 = np.square(X)
print(Y2)
# Line plot
plt.plot(X, Y2, marker='X', linestyle='dashed', color='red', linewidth=2, markerfacecolor='blue', markersize=8)
Output:
Program 7:
Write a Python program which explains uses of customizing seaborn plots with Aesthetic functions.
def sinplot(n=10):
x=np.linspace(0,14,100)
for i in range(1,n+1):
plt.plot(x,np.sin(x+i*.5)*(n+2-i))
sinplot()
plt.title('Seaborn plots with Aesthetic Functions')
plt.show()
Output:
Program 8a:
Write a Python program to explain working with bokeh line graph using Annotations and Legends.
# Sample data
years = [1, 2, 3, 4, 5]
no_of_emp = [10, 40, 50, 30, 60]
sales = [20, 50, 70, 20, 80]
# Create a legend
legend = Legend(items = [LegendItem(label = "No. of Employees", renderers = [line1]),
LegendItem(label = "Sales", renderers = [line2]),
])
p.add_layout(legend)
Output:
Program 8b:
Write a Python program for plotting different types of plots using Bokeh.
#Line Graph
import numpy as np
from bokeh.plotting import figure, show
# Data
x = np.arange(0,10,1)
y1 = x ** 2
y2 = x ** 3
y3 = x ** 4
show(p);
Output:
#Bar Graph
import numpy as np
from bokeh.plotting import figure, show
# Data
x1 = [1, 2, 3, 4, 5]
y1 = [6, 7, 2, 4, 5]
show(p)
Output:
#Scatter Plots
import numpy as np
from bokeh.plotting import figure, show
x = [1,2,3,4,5,6,7,8,9]
y = [9,8,7,6,5,4,3,2,1]
show(p);
Output:
#Program 8
import numpy as np
from bokeh.plotting import figure, show, curdoc
Output:
Program 9
Write a Python program to draw 3D Plots using Plotly Libraries.
# 3 D Scatter Plot
import pandas as pd
import plotly.express as px
import plotly.offline as pyo
pyo.init_notebook_mode()
fig.show()
Output:
# 3D Line Plot
import pandas as pd
import plotly.express as px
import plotly.offline as pyo
pyo.init_notebook_mode()
import pandas as pd
import plotly.express as px
import plotly.offline as pyo
pyo.init_notebook_mode()
print(df.tail())
df = df[2:6]
df
fig = px.scatter_3d(
df,
x="total_bill",
y="tip",
z="size",
color="day"
)
Output:
total_bill tip sex smoker day time size
0 16.99 1.01 Female No Sun Dinner 2
1 10.34 1.66 Male No Sun Dinner 3
2 21.01 3.50 Male No Sun Dinner 3
3 23.68 3.31 Male No Sun Dinner 2
4 24.59 3.61 Female No Sun Dinner 4
total_bill tip sex smoker day time size
239 29.03 5.92 Male No Sat Dinner 3
240 27.18 2.00 Female Yes Sat Dinner 2
241 22.67 2.00 Male Yes Sat Dinner 2
242 17.82 1.75 Male No Sat Dinner 2
243 18.78 3.00 Female No Thur Dinner 2
Program 10:
Write a Python program to draw Time Series using Plotly Libraries.
import pandas as pd
import plotly.express as px
dollar_conv =
pd.read_csv("C:\\Users\\Lenovo\\Downloads\\CURRENCY_US_XTUP_USDINR_ONE_YEAR.csv")
#dollar_conv.head()
fig = px.line(dollar_conv, x='Date', y='Close', title='Dollar vs Rupee')
fig.show()
Output:
Program 10 b:
Write a Python program for creating Maps using Plotly Libraries.
import plotly.express as px
import pandas as pd
#data = pd.read_csv("C:\\Users\\Lenovo\\Downloads\\gap_minder_with_codes1.csv")
#data.head()
color='gdpPercap',
hover_name='country',
projection= 'natural earth', #'orthographic', # 'natural earth',
title='GDP per Capita by Country')
fig.show()
Output:
1. What is Python?
Python is an interpreted scripting language that is known for its power, interactivity, and object-oriented nature.
It utilizes English keywords extensively and has a simpler syntax compared to many other programming languages.
Lists Tuple
s
Lists are mutable, i.e., theycan Tuples possess immutability, denoting their
be
incapability of being modified like lists.
edited
Lists are usually slower Tuples are faster than lists
than tuples.
Lists consume a lot of Tuples consume less memory when compared to lists
memory
Files containing Python codes are referred to as Python modules. This code can be of different types
likeclasses, functions, or variables.
Implicit Type Conversion: This type of conversion is automatically performed bythe Python interpreter without
requiring any user intervention.
Explicit Type Conversion: This type of conversion involves the user explicitly changing the data type to the
desired type.
The following statements assist in altering the course of execution from the regularflow, which categorizes
themas loop control statements.
Python break: This statement aids in discontinuing the loop or the statement and transferring control to
the subsequent statement.
Dept of CS & BS, KSSEM 41
DATA VISUALIZATION WITH PYTHON (BCS358D)
Python continue: This statement enforces the execution of the subsequent iteration when a particular
condition is met, instead of terminating it.
Python pass: This statement allows the syntactical writing of code while intending to bypass its execution.
It is also recognized as a null operation, as no action is taken when the pass statement is executed.
sub(): This method is used to find a substring where a regex pattern matches, and then it replaces the
matched substring with a different string.
subn(): This method is similar to the sub() method, but it returns the new string, along with the
number of replacements.
• is: returns the true value when both the operands are true (Example: “x”is ‘x’)
• not: returns the inverse of the boolean value based upon the operands(example:”1” returns
“0” and vice-versa.
• In: helps to check if the element is present in a given Sequence or not.
The primary differentiation between the append () and extend () methods in Pythonis that append () is used to
adda single element to the end of a list. In contrast, open () is used to append multiple aspects, such as another
list or an iterable, to theend of a list.
41. What are some common tools used for data visualization?
There are many tools available for data visualization, but some common ones include Python libraries like
Matplotlib, Seaborn, and Plotly, as well as tools like Tableau, PowerBI, and Excel.
42. How do you choose the best visualization for your data?
The best visualization for your data depends on the type of data you have, the question you are trying to answer,
andthe audience you are presenting to. Generally, simple visualizations like bar charts and scatter plots work
well for
50. What are some common tools used for data visualization?
There are many tools available for data visualization, but some common ones include Python libraries like
Matplotlib, Seaborn, and Plotly, as well as tools like Tableau, PowerBI, and Excel.
51. How do you choose the best visualization for your data?
52. What is Matplotlib?
Matplotlib is a Python plotting library that provides a wide range of 2D and 3D plots for visualizing data. It is widely
used for creating static, interactive, and animated visualizations in Python.
59. What are some common tools used for data visualization?
There are many tools available for data visualization, but some common ones include Python libraries like
Matplotlib, Seaborn, and Plotly, as well as tools like Tableau, PowerBI, and Excel.
60. How do you choose the best visualization for your data?
61. What is Matplotlib?
Matplotlib is a Python plotting library that provides a wide range of 2D and 3D plots for visualizing data. It is widely
used for creating static, interactive, and animated visualizations in Python.
68. What are some common tools used for data visualization?
There are many tools available for data visualization, but some common ones include Python libraries like
Matplotlib, Seaborn, and Plotly, as well as tools like Tableau, PowerBI, and Excel.
69. How do you choose the best visualization for your data?
70. What is Matplotlib?
Matplotlib is a Python plotting library that provides a wide range of 2D and 3D plots for visualizing data. It is widely
used for creating static, interactive, and animated visualizations in Python.
77. What are some common tools used for data visualization?
There are many tools available for data visualization, but some common ones include Python libraries like
Matplotlib, Seaborn, and Plotly, as well as tools like Tableau, PowerBI, and Excel.
78. How do you choose the best visualization for your data?
The best visualization for your data depends on the type of data you have, the question you are trying to answer,
andthe audience you are presenting to. Generally, simple visualizations like bar charts and scatter plots work
well for
basic analysis, while more complex visualizations like heat maps and network graphs are better for advanced
analysis.
81. How do you decide whether to use a bar chart or a line chart?
A bar chart is used to compare categorical or discrete data, while a line chart is used to show trends or changes
overtime. When deciding which to use, consider the type of data you have and the question you are trying to
answer.
Matplotlib and Seaborn are both Python libraries used for data visualization, but they differ in their functionalities
and use-cases. Matplotlib is a low-level library providing extensive control over every aspect of a plot, making it
suitable for creating custom plots.
Seaborn is built on top of Matplotlib, offering a high-level interface for drawing attractive statistical graphics. It
simplifies tasks such as generating complex visualizations of multi-dimensional data and provides built-in themes
for styling matplotlib graphics.