Intro to Google Colab
Google Colab
• Free, cloud based environment
• Allows to execute python code
• Working with machine learning models, analyse data
• No need to install python and environment setup
Advantages
• Free access to CPU, GPU, TPU
• Collaborative work
• Integration with Google drive
• Pre-installed libraries
Python Libraries
• In Python, libraries are collections of pre-written code.
• Libraries provide reusable functionality for common tasks
• No need to write code from scratch
• These libraries include modules, functions, classes, and variables that
help you save time and effort.
• They cover a wide range of tasks like data manipulation, mathematical
computations, machine learning, web scraping, and more.
Important Libraries in Python for
data science
1. Numpy
• Purpose: Essential for numerical operations, including working with
arrays and matrices
• Features:
• Efficient handling of large datasets
• Supports a wide variety of mathematical functions
Important Libraries in Python for
data science…
2. Pandas
• Purpose: Data manipulation and analysis
• Features:
• DataFrames for structured data
• Handling missing data, merging/joining datasets, and reshaping
• Time series data support and efficient data filtering
Important Libraries in Python for
data science…
3. Matplotlib
• Purpose: Data Visualization
• Features:
• Create static, animated, and interactive plots
• Works well for 2D plotting (histograms, line charts, scatter plots, etc.)
Important Libraries in Python for
data science…
4. Scikit-learn
• Purpose: Machine-learning
• Features:
• Tools for classification, regression, clustering, and dimensionality reduction.
• Built-in datasets for practice.
• Simple and efficient tools for data mining and data analysis.
Google Colab
Link for Colab https://colab.research.google.com/
Colab File Options
1. Open New notebook
2. Open already existing notebook
3. Or you can upload a new notebook
Google Colab Notebook
Connect with
+ code to make a new cell for CPU or GPU
writing another code
Click this button Write code here
to execute code
Find sum of two number example
Data Entry In Python
• You can read csv/excel files (mostly used)
• Or you can enter data manually
Make a Data table
Enter following data in Python
Data entry
• Click on +code, that will make a new cell to code and write
1. Define five variables, ID, Name, Age, Country, and Score.
2. To each variables, add the given values
3. Then we’ll make a pandas dataframe from these 5 defined variables.
Enter values
1. ID is variable name,
2. Values are entered within square brackets, known as python lists.
Data Table Making
1. Here data is dataframe object of
pandas
2. Data[‘ID’] defines a new
columns, and its value are
assigned by the assignment
operator “=“
3. Same steps are repeated for the
other columns
Print data
1. Make a new code cell
2. Type “data”
3. This will print the data