Python Week+1 New
Python Week+1 New
PYTHON
Table of Content
• Why Python
• Applications of Python
• Python and its features
• Packages overview
– NumPy
– Pandas
– Scikit Learn
– Matplotlib
– Seaborn
– TensorFlow
• Installation steps
• Jupyter Notebook for Python and shortcuts
Python’s Benevolent Dictator For Life
“Python is an experiment in how much freedom programmers need. Too much freedom and
nobody can read another's code; too little and expressiveness is endangered.”
- Guido van Rossum
Why Python
• Easy to understand
• Free and open source
• Huge community support
• Robust standard libraries
• Wide range of applications
• Fast edit-test-debug cycle
• Portable
• Scalable
Application Of Python
Software
development
GUI
Web
Game development
development
Application Of Python
• Interpreted language
• High-level programming
• Dynamic semantics
‘python’
Text Str
“python”
int, float,
10, 10.67, 10+2j
complex
Numeric
List [1,”A”,[2,4]]
Python data
types Sequence
Tuple (1,2,3,4)
Keywords
Operators Literals
List, Tuples, Dictionary & Set
Apart from data types like int, string, float Python has the
Tuples Sets
below data types which are very useful for data science -
several modules.
NumPy
• Has Build-in modules & Open source
modules. Scikit Learn
Reading various
Manipulating the
forms Datasets Reshaping Datasets
data
(CSV, Excel, etc)
• An open source web application that you can use to create and share
documents that contain live code, equations, visualizations, and text.
• Anaconda navigator comes with Jupyter notebook.
Jupyter Notebook Shortcuts
Summary
• Packages in Python
• Editor and Jupyter
Numpy & Pandas
• NumPy in Python
• NumPy arrays
• Functions to create array
• NumPy Matrix
• Indexing and slicing
• Selection techniques
• Pandas in Python
• Series
• Dataframe
• Indexing
• Loading and saving dataframes
• Summary
Numpy
Arithmetic
• Installation – conda install numpy operations
Random
module Broad-
casting
In built
functions
Functions To Create Specific Arrays
• zeros()
• ones()
• empty()
• eye()
• identity()
• empty_like()
• zeros_like()
• onces_like()
• asarray()
• full()
• full_like()
Numpy Matrix
NOTE: Matrix class is deprecated for future. Instead use Numpy arrays
Indexing And Slicing
Field
access
Slicing
Indexing
Integer
Advance
indexing
Boolean
Numpy Selection Techniques
• where()
• choose()
• select()
• random.choice()
• invert()
Common Numpy Functions
Function Description
np.random.randn() Return a sample (or samples) from the “standard normal” distribution.
np.savez() Save several arrays into a single file in uncompressed .npz format.
Pandas
Pandas In Python
• df.to_pickle(filename)
• pd.read_pickle(filename)
• csv file : can save Dataframe using
csv file
• df.to_csv(filename)
• pd.read_csv(filename)
Summary
• Discussed Numpy arrays
• Functions to create numpy arrays
• Difference between numpy array and numpy matrix
• Indexing and slicing
• Numpy selection methods
• Pandas in Python
• Series and methods associated with it
• Dataframe and methods associated with it
• Indexing in Dataframe
• Dataframe loading and saving
Thank you!
Happy Learning :)