An Exception Is An Error or Unexpected Event That Occurs During Execution of A Program
An Exception Is An Error or Unexpected Event That Occurs During Execution of A Program
Exception interrupts the flow of the program thus it needs to be handled for the program to continue
running or else the program may be forced to quit. The process of responding to exceptions is
called Exception Handling. Exception handling attempts to gracefully handle these situations so
unexpected errors can be detected and managed without crashing the program.
In python, the error handling is done through the use of exceptions that are caught in try
blocks and handled in except blocks. If an error is encountered, a try block code execution is
stopped and transferred down to the except block. In addition to using an except block after the try
block, you can also use the finally block. The code in the finally block will be executed regardless
of whether an exception occurs.
To use exception handling in Python, you first need to have a catch-all except clause. The words
"try" and "except" are Python keywords and are used to catch exceptions.
try-except [exception-name] blocks
The code within the try clause will be executed statement by statement. If an exception occurs,
the rest of the try block will be skipped and the except clause will be executed.
try:
some statements here
except:
exception handling
A list is a collection which is ordered and changeable. In Python, lists are comma-separated
values (items) between square brackets. You access the list items by referring to the index
number. The items in a list need not be of the same type.
Python for Data Science
It is one of the best languages used by data scientist for various data science projects/application.
Python provide great functionality to deal with mathematics, statistics and scientific function. It
provides great libraries to deals with data science application.
Reasons why Python is widely used for Data Science
Python has a unique attribute and is easy to use when it comes to quantitative and
analytical computing.
Data Science Python is widely used and is a favorite tool along being a flexible and open
sourced language.
Its massive libraries are used for data manipulation and are very easy to learn even for a
beginner data analyst.
Numpy: Numpy is Python library that provides mathematical function to handle large dimension
array. It provides various method/function for Array, Metrics, and linear algebra.
Pandas: Pandas is one of the most popular Python library for data manipulation and analysis.
Pandas is designed for quick and easy data manipulation, aggregation, and visualization.
Matplotlib: Matplolib is another useful Python library for Data Visualization. Matplotlib allows
to quickly make line graphs, pie charts, histograms, and other professional grade figures.
Scipy: Scipy is another popular Python library for data science and scientific computing. Scipy
provides great functionality to scientific mathematics and computing programming. SciPy
contains sub-modules for optimization, linear algebra, integration, interpolation etc.
Scikit – learn: Sklearn is Python library for machine learning. It provides easy and simple tools
for data mining and data analysis.