0% found this document useful (0 votes)
10 views2 pages

Lab1 Introduction To Data Science

Uploaded by

Peaceful Life
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views2 pages

Lab1 Introduction To Data Science

Uploaded by

Peaceful Life
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Lab 1: Introduction to Data Science Using Python

Objective:
- Introduce students to the basics of Python programming
- Use simple data structures
- Perform basic data analysis using Pandas and NumPy

Instructions for Students:


1. Use Jupyter Notebook or Google Colab
2. Submit the notebook file with output.
3. Try to understand each line of code, and write comments in your own words.

Lab Tasks:

Task 1: Introduction to Python


Print your name, branch, and favorite programming language.

print("Name: Hrishabh Prajapati")


print("Branch: CSE")
print("Favorite Language: Python")

Task 2: Basic Data Structures


Create a list of 5 programming languages and print them using a loop.

languages = ['Python', 'Java', 'C++', 'JavaScript', 'SQL']


for lang in languages:
print(lang)

Task 3: Working with NumPy


Import NumPy and create a 1D array of 10 numbers. Find its mean and standard deviation.

import numpy as np

data = np.array([10, 20, 30, 40, 50, 60, 70, 80, 90, 100])
print("Mean:", np.mean(data))
print("Standard Deviation:", np.std(data))

Task 4: Basic Pandas


Create a DataFrame with 3 columns: Name, Age, and City. Add 5 rows.

import pandas as pd
data = {
'Name': ['Amit', 'Sita', 'Ravi', 'Priya', 'John'],
'Age': [21, 22, 20, 23, 21],
'City': ['Kanpur', 'Delhi', 'Lucknow', 'Mumbai', 'Pune']
}

df = pd.DataFrame(data)
print(df)

Task 5: Summary Statistics


Print the average age of students in the DataFrame.

print("Average Age:", df['Age'].mean())

Bonus Task (Optional):


Import the inbuilt dataset iris from sklearn.datasets and print first 5 rows.

from sklearn.datasets import load_iris


import pandas as pd

iris = load_iris()
df_iris = pd.DataFrame(data=iris.data, columns=iris.feature_names)
print(df_iris.head())

Expected Outcomes:
- Students get comfortable with Python syntax
- They understand how to work with basic data types and structures
- They are introduced to key libraries used in Data Science

Submission Format:
- File Name: Lab1_Intro_to_DS_<RollNumber>.ipynb
- Submit via: Google Classroom / Email / LMS (as decided by instructor)

You might also like