0% found this document useful (0 votes)
16 views3 pages

Python Basics for Data Science Guide

The document provides an introduction to Python for Data Science, covering basics such as data types, structures, conditional statements, loops, functions, and essential libraries. It also delves into NumPy and Pandas, highlighting array operations, DataFrame creation, and data handling techniques including reading CSV files and managing missing data. Overall, it serves as a foundational guide for using Python in data analysis and machine learning.
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)
16 views3 pages

Python Basics for Data Science Guide

The document provides an introduction to Python for Data Science, covering basics such as data types, structures, conditional statements, loops, functions, and essential libraries. It also delves into NumPy and Pandas, highlighting array operations, DataFrame creation, and data handling techniques including reading CSV files and managing missing data. Overall, it serves as a foundational guide for using Python in data analysis and machine learning.
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

Python for Data Science – Part 1 & 2 (Text Format)

Python Basics for Data Science – Part 1


1. Python Intro
Python ek high-level, interpreted language hai jo easy-to-read syntax use karta
hai.
➡️Data Science mein Python ka use mainly Data Analysis, Machine Learning,
Visualization ke liye hota hai.

2. Variables & Data Types


x = 10 # int
y = 3.14 # float
name = "Amit" # str
flag = True # bool
📌 Python mein variable ka type automatic detect hota hai.
🔸 type(x) → data type check karta hai.

3. Data Structures (bohot important for DS)


✅ List → Ordered, changeable
fruits = ["apple", "banana", "mango"]
print(fruits[0]) # apple
[Link]("kiwi") # Add new item

✅ Tuple → Ordered, unchangeable


t = (1, 2, 3)

✅ Set → Unordered, unique items


s = {1, 2, 3, 3}
print(s) # Output: {1, 2, 3}

✅ Dictionary → Key-value pair


student = {"name": "Amit", "age": 21}
print(student["name"]) # Amit

4. Conditional Statements
age = 18
if age >= 18:
print("Adult")
else:
print("Minor")

5. Loops
🔁 For Loop
for i in range(5):
print(i)

🔁 While Loop
i=1
while i <= 5:
print(i)
i += 1

6. Functions
def greet(name):
return "Hello " + name
print(greet("Amit"))

7. Libraries (DS ke liye must)


import numpy as np
import pandas as pd
import [Link] as plt

Python for Data Science – Part 2: NumPy, Pandas, CSV Handling


1. NumPy Basics
import numpy as np
a = [Link]([1, 2, 3])
b = [Link]([[1, 2], [3, 4]])

✅ Useful functions:
[Link]((2, 3))
[Link]((3, 3))
[Link](0, 10, 2)
[Link](0, 1, 5)

2. Array Operations
a = [Link]([1, 2, 3])
b = [Link]([4, 5, 6])
a+b
a*b
[Link](a, b)
[Link](a)
[Link](a)
[Link](a)
[Link]

3. Pandas Basics
import pandas as pd
s = [Link]([10, 20, 30])
data = {'Name': ['Amit', 'Priya'], 'Age': [21, 22]}
df = [Link](data)

4. DataFrame Operations
df = pd.read_csv("[Link]")
[Link]()
[Link]()
[Link]()
[Link]()
df['Name']
df[df['Age'] > 20]
df['Salary'] = [30000, 40000]

5. Missing Data Handling


[Link]().sum()
[Link]()
[Link](0)

You might also like