0% found this document useful (0 votes)
5 views

Programming Reviewer

Programming
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Programming Reviewer

Programming
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 12

FUNCTIONS sequence in the reverse order.

A lambda function in Python is a small, zip() Method


anonymous function. This means it's • Python zip() method takes iterable
defined without a formal name using containers and returns a single
the lambda keyword. iterator object, having mapped values
Lambda functions are handy for short, from all the containers.
in-line functions that are used only once or hash() method - a built-in function and
within another function. returns the hash value of an
object if it has one. The hash value is an
integer that is used to quickly
lambda arguments: expression
compare dictionary keys while looking at a
• arguments (comma-separated) -
dictionary.
represent the parameters the lambda
bin() - returns the binary string of a given
function can
integer
accept. • oct() - returns the octal string of a given
• expression - represents the code to be integer
executed when the lambda function is • hex() - used to convert an integer
called. This number into its corresponding
expression should ideally be a single line. hexadecimal form
*map() function returns a map all() - returns true if all the elements
object(which is an iterator) of a given iterable (List, Dictionary,
• Applies a given function to all elements Tuple, set, etc.) are True otherwise it
of an iterable (like a list, tuple, returns False. It also returns True if
or string) and returns a new iterable with the iterable object is empty.
the results. any() - returns True if any of the
• It's useful when you want to perform the elements of a given iterable( List,
Dictionary, Tuple, set, etc) are True
same operation on every
else it returns False.
element in a sequence.
next() method - returns the next
• Syntax: map(function, iterable)
item of an iterator.
*The filter() method filters • iter() method - returns the iterator
the given sequence with object, it is used to convert an
the help of a function that iterable to the iterator.
tests each element in the
slice() method - we are using the slice
sequence to be true or not.
function to slice the string
*Reduce Function
• Applies a function
LIST,TUPLE,SET OPERATIONS
cumulatively to the items of
an iterable, reducing it to a LIST
single value. • The list is a most versatile data type
• It's helpful for aggregating available in Python which can be
data (like finding the sum, written as a list of comma-separated
product, etc.). values (items) between square
brackets []
sum() function in Python
• Python provides an inbuilt function sum() Slice Operation
which sums up the • Slice operation is performed on Lists
numbers in the list. with the use of a colon(:).
• To print elements from beginning to a
sorted() Function
range use:
• Python sorted() function returns a
• [: Index]
sorted list. It is not only defined for
• To print elements from end-use:
the list and it accepts any iterable (list,
• [:-Index]
tuple, string, etc.).
• To print elements from a specific Index
reversed() Method till the end use
• Python reversed() method returns an • [Index:]
iterator that accesses the given
• To print the whole list in reverse order, sets. Similar to finding
use differences in the linked list.
• [::-1] This is done through
Tuple difference() or – operator.
• A collection of Python Programming Removing Elements from the Set
objects much like a list. • Using remove() Method or
• The sequence of values stored in a discard() Method
tuple can be of any type, and they • Using pop() Method
are indexed by integers. • Using clear() Method
• Tuples are created by placing a
sequence of values separated by DICTIONARIES AND FILE HANDLING
‘comma’ with or without the use of Dictionary
parentheses for grouping the data Dictionary is “a collection of
sequence. unordered data, which is stored in key-
Deleting a Tuple valued pairs.”
• Tuples are immutable and hence
A key-valued pair is a set of
they do not allow deletion of a
valued associated with each other.
part of it. The entire tuple gets
deleted by the use of del() A key is a unique identifier for
method. some item of data
Set A value is the data that is
• A Set in Python programming is an identified or a pointer to the location of
unordered collection data type that data.
that is iterable, mutable and has no
duplicate elements. Each key is separated from its
• Set are represented by { } (values value by a colon (:), the items are
enclosed in curly braces) separated by commas, and the whole
• Python set is an unordered datatype, dictionary is enclosed in curly braces {}.
which means we cannot know An empty dictionary without any
in which order the elements of the set are items is written with just two curly braces,
stored. like this: {}.Keys are unique within a
Methods for Sets dictionary while values may not be.
• Adding elements to Python Sets File Handling
• Insertion in the set is done Allows the user to read, write,
through the set.add() function, update, and delete files
where an appropriate record
value is created to store in the Built-in functions for file
hash table. handling:open() -to open a file and
Union operation returns a file object
• Two sets can be read(), readline() -read content of
merged using the file
union() write() -to write to an existing file
function or |
operator. close() -close the file
Intersection operation remove() -remove files
• This can be done through
intersection() or & operator. "r" -Read -Opens a file for reading,
• Common Elements are error if the file does not exist
selected. "a" -Append -Opens a file for
• They are similar to iteration appending, creates the file if it does not
over the Hash lists and exist
combining the same values
on both the Table "w" -Write -Opens a file for writing,
Finding Differences creates the file if it does not exist
• To find differences between
"x" -Create -Creates the specified an actual instance of a class.
file, returns an error if the file exists Class
“r+”: To read and write data into Objects with similar characteristics
the file. The previous data in the file will can fall under one class.
be overridden.
Example:
“w+”: To write and read data. It
will override existing data. Dog represents all breeds of dogs:
“a+”: To append and read data bulldog, poodle, chihuahua, etc.
from the file. It won’t override existing Each dog breed can be “derived” or
data. “built from” a general class called Dog.
File Handling Class
file handling using loop In object-oriented terms, the Dog
duplicating a file getting the file path class is the template or blueprint from
OBJECT-ORIENTED which bulldog, poodle and chihuahua are
PROGRAMMING derived.

Object-Oriented Programming (OOP) A class is a template or a


Object Oriented Programming or blueprint, while an object is an instance
OOP is a methodology to design a of a class.
program using classes and objects. It A class is made up of attributes
simplifies the software development and and behavior.State or Attributes of the
maintenance by providing some concepts: class are represented by variables called
Object fields.
Class behavior is revealed
Class through methods.
Encapsulation
Class Members
Inheritance Class members are declarations
made inside the body of the class.
Polymorphism
The following are class members:
Abstraction FIELDSAlso referred to as attributes.
Object These are data used by the class.
a software component whose
structure is similar to objects in the real They are variables declared
world. inside the class body.
an entity that has a state, behavior METHODSAlso referred to as the
and identity with a well-defined role in behavior(s).
problem space, both tangible and
intangible These are program statements
grouped together to perform a specific
composed of a set of data function
(properties/attributes) variables Creating Objects
describing the essential characteristics of Since classes are templates,
the object, they provide the benefit of
reusability.A class can be
and it also consists of a set of used over and over to create
methods (behavior) describes how an many objects.
object behaves
can only be invoked by sending An object created out of a
messages to an object. class will contain the same
Behavior is shared among objects. variables that the class has.
However, the values of the
variables are specific to the Private Access Modifiers
object created. The members of a class that are
Creating an object out of a declared private are accessible within the
class is called class class only, private access modifier is the
instantiation. most secure access modifier. Data
members of a class are declared private
The __init__() Function by adding a double underscore ‘__’
The __init__() function is called symbol before the data member of that
automatically every time the class.
class is being used to create a Protected Access Modifiers
new object. The members of a class that are
declared protected are only accessible
Also known as Constructor in within the class and to a class derived
other programming from it. Data members of a class are
declared protected by adding a single
The self parameter is a underscore ‘_’ symbol before the data
reference to the current member of that class.
instance of the class, and is Inheritance
used to access variables Inheritance is when an object or
that belong to the class. class is based on another object
using the same implementation
Encapsulation or specifying a new
Encapsulation is one of the key implementation to maintain the
features of object-oriented same behavior
programming. Encapsulation refers to
the bundling of attributes and methods Such an inherited class is called a
inside a single class. subclass (Child) of its parent
class or super class (Parent)
It prevents outer classes from
accessing and changing attributes and This idea was first adopted in the
methods of a class. This also helps to Simula 67 programming language.
achieve data hiding. Types of Inheritance in Python
Access Modifiers Single Inheritance
Python uses ‘_’ symbol to Multiple Inheritance
determine the access control for a
specific data member or a member Multilevel Inheritance
function of a class. Access specifiers in
Python have an important role to play in Hierarchical Inheritance
securing data from unauthorized Single Inheritance
access and in preventing it from being Single inheritance enables a
exploited. derived class to inherit properties
from a single parent class, thus
A Class in Python has three types enabling code reusability and the
of access modifiers: addition of new features to existing
Public Access Modifier code.
Multiple Inheritance
Protected Access Modifier When a class can be derived from
Private Access Modifier more than one base class this
type of inheritance is called multiple
Public Access Modifiers inheritance. In multiple inheritance,
The members of a class that are all the features of the base classes
declared public are easily accessible are inherited into the derived class.
from any part of the program. All data Multilevel Inheritance
members and member functions of a In multilevel inheritance, features
class are public by default. of the base class and the derived
class are further inherited into • These events or errors usually occur
the new derived class. This is during runtime.
similar to a relationship • Example of exceptions:
representing a child and • Division by zero
grandfather. • Invalid input
Hierarchical Inheritance • File not found
When more than one derived Kinds of Exceptions – CHECKED
classes are created from a single EXCEPTION
base this type of inheritance is • All exceptions, except for Runtime
called hierarchical inheritance. In Exception, are checked
this program, we have a parent exceptions.
(base) class and three child • Exceptions are “checked” because they
(derived) classes. are subject to the Catch
Polymorphism or Specify Requirement. Otherwise, the
Polymorphism is another important program code will not
concept of object-oriented compile.
programming. It simply means • Checked exceptions are errors that the
more than one form. program can deal with.
Kinds of Exceptions - ERRORS
That is, the same entity (method or
• Errors are generally beyond the
operator or object) can perform
control of the program.
different operations in different
• These are situations that cannot be
scenarios.
anticipated and for which the
Method Overriding
program cannot recover from.
Like in other programming
• Example:
languages, the child classes in
• Unreadable file
Python also inherit methods and
• Hardware malfunction
attributes from the parent class. We
• Errors are not subject to the Catch or
can redefine certain methods and
Specify requirement, and are
attributes specifically to fit the child
often referred to as unchecked
class, which is known as Method
exceptions.
Overriding.
Kinds of Exceptions - RUNTIME
Polymorphism allows us to EXCEPTION
access these overridden • Like errors, Runtime Exceptions are not
methods and attributes that have subject to the Catch or
the same name as the parent Specify Requirement and are, also,
class. unchecked exceptions.
• These exceptions are the result of
ERROR HANLDING AND DEBUGGING programming flaws such as:
Exception Handling • Example:
• Error in Python can be of two types i.e. • dividing by zero
Syntax errors and • using null pointers or references
Exceptions. • or going beyond an array’s
• Errors are problems in a program due to boundaries
which the program will HANDLING EXCEPTIONS
stop the execution. • The try block lets you test a block of
• On the other hand, Exceptions are code for errors.
raised when some internal • The except block will be executed if the
events occur which change the normal try block raises an error
flow of the program. HANDLING EXCEPTIONS
What are Exceptions? • You can use the else keyword to define
• Events or errors that disrupt the normal a block of code to be executed
flow of execution of a program. if no errors were raised
• It prevents the program from reaching a HANDLING EXCEPTIONS
normal end.
• A try statement can have more than be a company’s most valuable asset.
one except clause, to specify Data Analysis in Python
handlers for different exceptions. Please • Data is raw information, and analysis of
note that at most one data is the systematic process of
handler will be executed. interpreting and transforming that data
HANDLING EXCEPTIONS into meaningful insights.
• The finally block, if specified, will be • In a data-driven world, analysis involves
executed regardless if the try block raises applying statistical,
an error or not. mathematical, or computational
Raising Exception techniques to extract patterns, trends,
• The raise statement allows the and correlations from datasets.
programmer to force a specific • Data analysis is the process of
exception to occur. The sole inspecting, cleaning, transforming, and
argument in raise indicates modeling data to discover useful
the exception to be raised. information, draw conclusions, and
This must be either an support decision-making.
exception instance or an • It involves the application of various
exception class (a class that techniques and tools to extract
derives from Exception). meaningful insights from raw data, helping
MODULES AND LIBRARIES in understanding patterns,
MODULES trends, and relationships within a dataset.
• A module is simply a file containing Why Data Analysis is important?
python code, it may • Informed Decision-Making - Analysis
contain functions, classes etc. of data provides a basis for informed
• Advantages of using a module decision-making by
• Logically organize your Python code offering insights into past performance,
• Code is easier to understand and use current trends, and potential future
MODULES outcomes.
• You can use any Python source file as a • Business Intelligence - Analyzed data
module by helps organizations gain a competitive
executing an import statement in some edge by identifying
other Python market trends, customer preferences, and
source file areas for improvement.
BUILT-IN MODULE • Problem Solving - It aids in identifying
• Built-in modules are and solving problems within a system or
written in C and process by
interpreted using the revealing patterns or anomalies that
Python interpreter require attention.
BUILT-IN MODULE • Performance Evaluation - Analysis of
• Math - This module provides access to data enables the assessment of
the mathematical functions performance metrics,
defined by the C standard. allowing organizations to measure
• Random - This module implements success, identify areas for improvement,
pseudo-random number and set realistic goals.
generators for various distributions. • Risk Management - Understanding
• DateTime - This module work with dates patterns in data helps in predicting and
as date objects. managing risks,
allowing organizations to mitigate potential
DATA ANALYSIS IN PYTHON
challenges.
Data Analysis in Python
• Optimizing Processes - Data analysis
• Data is Everywhere, in sheets, in social
identifies inefficiencies in processes,
media platforms, in product
allowing for
reviews and feedback, everywhere. In this
optimization and cost reduction.
latest information age it’s
Types of Data Analysis
created at blinding speeds and, when data
• Descriptive Analysis
is analyzed correctly, can
• A Descriptive Analysis looks at data You might have noticed that whenever
and analyzes past events for insight as you buy any product from Amazon, on the
to how to approach future events. It looks payment side it shows you a
at the past performance and recommendation saying the customer who
understands the performance by mining purchased this has also purchased this
historical data to understand the product that recommendation is based on
cause of success or failure in the past. the customer purchase behavior in the
Almost all management reporting past. By looking at customer past
such as sales, marketing, operations, and purchase behavior analyst creates an
finance uses this type of analysis association between each product and
• Example: Let’s take the example of that’s the reason it shows
DMart, we can look at the product’s recommendation when you buy any
history and find out which products have product.
been sold more or which Types of Data Analysis
products have large demand by looking at • Prescriptive Analysis
the product sold trends, and • This is an advanced method of
based on their analysis we can further Predictive Analysis. Prescriptive Analysis
make the decision of putting a stock helps to find which is the best option to
of that item in large quantity for the make it happen or work. As
coming year. predictive Analysis forecast future data,
Types of Data Analysis Prescriptive Analysis on the other
• Diagnostic Analysis hand helps to make it happen whatever
• Diagnostic analysis works hand in we have forecasted. Prescriptive
hand with Descriptive Analysis. As Analysis is the highest level of Analysis
descriptive Analysis finds out what that is used for choosing the best
happened in the past, diagnostic optimal solution by looking at descriptive,
Analysis, on the other hand, finds out diagnostic, and predictive data.
why did that happen or what • Example: The best example would be
measures were taken at that time, or Google’s self-driving car, by looking at
how frequently it has happened. it the past trends and forecasted data it
basically gives a detailed explanation of a identifies when to turn or when to
particular scenario by slow down, which works much like a
understanding behavior patterns. human driver.
• Example: Let’s take the example of Types of Data Analysis
Dmart again. Now if we want to find out • Statistical Analysis
why a particular product has a lot of • Statistical Analysis is a statistical
demand, is it because of their brand approach or technique for analyzing
or is it because of quality. All this data sets in order to summarize their
information can easily be identified using important and main
diagnostic Analysis. characteristics generally by using some
Types of Data Analysis visual aids. This approach can
• Predictive Analysis be used to gather knowledge about the
• Information we have received from following aspects of data:
descriptive and diagnostic analysis, we • Main characteristics or features of the
can data.
use that information to predict future data. • The variables and their relationships.
Predictive analysis basically finds out • Finding out the important variables that
what is likely to happen in the future. can be used in our problem.
By looking at the past trends and Types of Data Analysis
behavioral • Regression Analysis
patterns we are forecasting that it might • Regression analysis is a statistical
happen in the future. method extensively used in data analysis
• Example: The best example would be to model the relationship between a
Amazon and Netflix recommender dependent variable and one or more
systems.
independent variables. It provides a • Factor Analysis
quantitative assessment of the impact • Factor analysis is a statistical method
of independent variables on the that explores underlying
dependent variable, enabling predictions relationships among a set of observed
and trend variables. It identifies latent
identification. factors that contribute to observed
• The process involves fitting a regression patterns, simplifying complex data
equation to the observed data, structures. This technique is invaluable in
determining coefficients that optimize the reducing dimensionality,
model’s fit. This analysis aids in revealing hidden patterns, and aiding in
understanding the strength and nature of the interpretation of large
relationships, making it a valuable tool datasets. Commonly used in social
for decision-making, forecasting, and risk sciences, psychology, and market
assessment. By extrapolating patterns research, factor analysis enables
within the data, regression analysis researchers and analysts to extract
empowers organizations to make meaningful insights and make informed
informed decisions based on the
strategic choices and optimize outcomes identified underlying factors.
in various fields, including finance, Types of Data Analysis
economics, and scientific research. • Text Analysis
Types of Data Analysis • Text analysis involves extracting
• Cohort Analysis valuable information from unstructured
• Cohort analysis involves the textual data. Utilizing natural language
examination of groups of individuals who processing and machine learning
share a common characteristic or techniques, it enables the extraction of
experience within a defined time sentiments, key themes, and
frame. This method provides insights patterns within large volumes of text.
into user behavior, enabling Applications range from sentiment
businesses to understand and improve analysis in customer feedback to
customer retention, identifying trends in social media
engagement, and overall satisfaction. By discussions. Text analysis enhances
tracking cohorts over time, decision-making processes, providing
organizations can tailor strategies to actionable insights from textual data, and
specific user segments, is crucial for businesses seeking
optimizing marketing efforts and product to understand and respond to the vast
development to enhance amount of unstructured information
long-term customer relationships. available in today’s digital landscape.
Types of Data Analysis The Process of Data Analysis
• Time Series Analysis 1. Define Objectives and Questions:
• Time series analysis is a statistical Clearly define the goals of the
technique used to examine data analysis and the specific questions you
points collected over sequential time aim to answer. Establish a
intervals. It involves identifying clear understanding of what insights or
patterns, trends, and seasonality within decisions the analyzed data
temporal data, aiding in should inform.
forecasting future values. Widely 2. Data Collection: Gather relevant data
employed in finance, economics, from various sources. Ensure
and other domains, time series analysis data integrity, quality, and completeness.
informs decision-making Organize the data in a
processes by offering a comprehensive format suitable for analysis. There are two
understanding of data types of data:
evolution over time, facilitating strategic qualititative and quantitative data.
planning and risk The Process of Data Analysis
management. 3. Data Cleaning and Preprocessing:
Types of Data Analysis Address missing values, handle
outliers, and transform the data into a • Generative AI
usable format. Cleaning and • Federated Learning
preprocessing steps are crucial for • Focus on Explainability and Causality
ensuring the accuracy and • Causal Inference
reliability of the analysis. • Counterfactual Analysis
4. Exploratory Data Analysis (EDA): • Interpretable Models
Conduct exploratory analysis to • Edge Computing and Real-time
understand the characteristics of the Insights
data. Visualize distributions, • Distributed Analytics
identify patterns, and calculate • Streaming Analytics
summary statistics. EDA helps in • Internet of Things (IoT) Integration
formulating hypotheses and refining the Python Libraries for Data Science
analysis approach. • Data Pre-Processing and Data
The Process of Data Analysis Manipulation
5. Statistical Analysis or Modeling: • Statistics
Apply appropriate statistical • Numpy
methods or modeling techniques to • Pandas
answer the defined questions. • SciPy
This step involves testing hypotheses, • Data Visualization
building predictive models, or • Matplotlib
performing any analysis required to • Seaborn
derive meaningful insights from • Plotly
the data. • Data Modeling
6. Interpretation and Communication: • Scikit-Learn
Interpret the results in the • TensorFlow
context of the original objectives. Numpy
Communicate findings through • NumPy – It means Numerical Python. It
reports, visualizations, or presentations. performs scientific operations
Clearly articulate insights, and all the stuff related to single or
conclusions, and recommendations based higher dimensional arrays. It
on the analysis to consists of a multidimensional array of
support informed decision-making. objects and a collection of
Top Data Analysis Tools routines to perform those operations. This
• SAS library is fast and versatile,
• Microsoft Excel the NumPy vectorization, indexing, and
•R broadcasting concepts are the
• Python de-facto standards of array computing
• Tableau Public today.
• RapidMiner SciPy
• Knime • SciPy is an open-source library that is
Applications of Data Analysis used for solving scientific,
• Business Intelligence mathematical, and technical problems.
• Healthcare Optimization SciPy is built on top of the
• Financial Forecasting python Numpy extension. It contains a
• Marketing and Customer Insights variety of sub-packages for
• Fraud Detection and Security different applications. We can say it is an
• Predictive Maintenance in Manufacturing advanced version of Numpy
Future Trends in Data Analysis which has some additional features like it
• Democratization of Data Analysis contains a fully-featured
• No-code/Low-code Platforms version of linear algebra. Scipy is fast and
• Embedded Analytics having high computation
• Natural Language Processing (NLP) power.
• Artificial Intelligence (AI) and Pandas
Machine Learning (ML) • It is an open-source library which is
• Explainable AI (XAI) extensively being used by data
scientist all over the globe to perform charts. It has a wide range of spectrum
data analysis and data manipulation, it includes bar plot, scatter plot,
is built histogram, line charts, etc.
on top of python programming language. Line graphs are commonly used to
Pandas is fast, flexible, and very visualize trends over time or relationships
powerful. Following are some application between variables.
of the pandas library in the world Matplotlib
of data science: • A stem plot, also known as a stem-and-
• Can read files like CSV, excel, ,SQL etc leaf plot, is a type of plot used to
• Handle high-performance datasets. display data along a number line. Stem
• According to need, we can perform data plots are particularly useful for
segmentation and segregation visualizing discrete data sets, where the
• Dataset cleaning, handling missing values are represented as “stems”
values, handling outliers, etc. extending from a baseline, with data
Pandas points indicated as “leaves” along the
• When working with tabular data, such as stems. let’s understand the components of
data stored in spreadsheets a typical stem plot:
or databases, pandas is the right tool for • Stems: The stems represent the main
you. pandas will help you to values of the data and are typically
explore, clean, and process your data. In drawn vertically along the y-axis.
pandas, a data table is called • Leaves: The leaves correspond to the
a DataFrame. individual data points and are plotted
Pandas horizontally along the stems.
• Pandas supports the integration with • Baseline: The baseline serves as the
many file formats or data reference line along which the stems
sources out of the box (csv, excel, sql, are drawn.
json, parquet,…). Importing Matplotlib
data from each of these data sources is • A bar plot or bar chart is a graph that
provided by function with the represents the category of data
prefix read_*. Similarly, the to_* methods with rectangular bars with lengths and
are used to store data. heights that is proportional to
Pandas the values which they represent. The
• Methods for slicing, filtering, selecting, bar plots can be plotted
and extracting the data you horizontally or vertically. A bar chart
need are available in pandas. describes the comparisons
Pandas between the discrete categories. It can be
• pandas provides plotting your data created using the bar()
out of the box, using the power of method.
Matplotlib. You can pick the plot type Matplotlib
(scatter, bar, boxplot,…) • A histogram is basically used to
corresponding to your data. represent data in the form of some
Matplotlib groups. It is a type of bar plot where the
• Matplotlib was introduced by John X-axis represents the bin
Hunter in 2002. It is an amazing ranges while the Y-axis gives
visualization library in Python for 2D plots information about frequency. To create
of arrays. It is one of the a histogram the first step is to create a bin
most worldwide used data visualization of the ranges, then distribute
libraries. It is simple and easy the whole range of the values into a series
to use. It is a multi-platform data of intervals, and count the
visualization library built on NumPy values which fall into each of the intervals.
arrays and designed to work with the Bins are clearly identified
broader SciPy stack. as consecutive, non-overlapping intervals
• One of the greatest use of matplotlib is of variables.
that it has a large number of Matplotlib
• Scatter plots are ideal for
visualizing the seaborn
relationship between two • Help in visualizing linear regression
continuous variables. models.
We’ll see how scatter • Works well with NumPy arrays and
plots help identify pandas data frames.
patterns, correlations, or Plotly
clusters within data • Plotly an open-source python library that
points. can be used for data
Matplotlib visualization and understanding data
• Stackplot, also known as a stacked easily and simply. It supports
area plot, is a type of plot that various types of plots like scatter plots,
displays the contribution of different line charts, histograms,
categories or components to bubble charts, contour plots, cox plots
the total value over a continuous easily.
range, typically time. It is • Why you should use plotly:
particularly useful for illustrating changes • It produces interactive graphs
in the distribution of • Graphs and very attractive.
data across multiple categories or groups. • It provides the feature of customization
Matplotlib of our graphs
• A box plot, also known as a box-and- TensorFlow
whisker plot, provides a visual • TensorFlow is an open-source end-to-
summary of the distribution of a end platform for creating Machine
dataset. It represents key statistical Learning applications. It is a symbolic
measures such as the median, quartiles, math library that uses
and potential outliers in a dataflow and differentiable programming
concise and intuitive manner. Box plots to perform various tasks
are particularly useful for focused on training and inference of deep
comparing distributions across different neural networks. It allows
groups or identifying developers to create machine learning
anomalies in the data. applications using various
Matplotlib tools, libraries, and community
• A Pie Chart is a circular statistical plot resources.
that can display only one series • Currently, the most famous deep
of data. The area of the chart is the total learning library in the world is
percentage of the given Google’s TensorFlow. Google product
data. The area of slices of the pie uses machine learning in all of
represents the percentage of the its products to improve the search engine,
parts of the data. The slices of pie are translation, image
called wedges. The area of the captioning, or recommendations.
wedge is determined by the length of the Scikit Learn
arc of the wedge. • Scikit Learn is the most useful library for
Seaborn Machine Learning in Python.
• Seaborn is a python library for data It is an industry-standard for most data
visualization. It is built on top of science projects. It is a simple
matplotlib. It provides a high-level and very fast tool for predictive data
interface for drawing attractive and analysis and statistically
informative statistical graphics. The modeling. This library is built using
main advantage of seaborn over python on top of NumPy, SciPy,
matplotlib is that firstly it resolves the and matplotlib. Some of the scikit learn
problem of default matplotlib features include Regression,
parameters and secondary working with Classification, Clustering, Dimensionality
data frames. The main features of Reduction using only a few
seaborn are: lines of code.
• Help in styling matplotlib graphs. This
feature by default is present in
1. Which type of error occurs during 15. This type of exception occurs when
the execution of the program? a variable does not exist.
=Runtime error =NameError
2. This method removes the last 16. What type of data analysis is used
inserted key-value pair. to make predictions or forecasts
=popItem() based on historical data?
3. What is the result of the following =Predictive Analysis
code: my_tuple = (1, 3, 6, 4, 5) 17. Which method is used to insert an
print(my_tuple[2])? element at a specific position in a
=6 list?
4. How can you determine the =insert()
number of elements in a list in 18. are problems in a program due to
Python? which the program will stop the
=Use len() execution.
5. What block is used to handle =Errors
exceptions that occur in the 19. Which method is used to add an
associated try block? element to the end of a list?
=except =append
6. statistical method extensively used 20. What is the output of the given
in data analysis to model the code: list = [8, 2, 10, 6] print(list[3-
relationship between a dependent 2])?
variable and one or more =2
independent variables.
=Regression Analysis
7. This method removes the element
with specified key.
=pop
8. Which file handling function reads
the content of a file?
=read()
9. What keyword is used to execute a
block of code if no errors were
raised in the try block?
=else
10. Which exception is raised when
trying to access a list element that
does not exist?
=IndexError
11. What symbol is used to enclose a
list in Python?
=Square brackets []
12. Which of the following correctly
defines a lambda function that adds
two numbers?
=lambda x, y: x + y
13. How can you check if a list is empty
in Python?
=Using ‘empty’ method
14. In Python, how do you define a
class named Animal?
=class Animal:

You might also like