TGViewer
Data Science & Machine Learning Data Science & Machine Learning @datasciencefun · 77.8K subscribers
Post #3835 5.96K
✅ Python for Data Science – Part 2: Pandas Interview Q&A 🐼📊

1. What is Pandas and why is it used?
Pandas is a data manipulation and analysis library built on top of NumPy. It provides two main structures: Series (1D) and DataFrame (2D), making it easy to clean, analyze, and visualize data.

2. How do you create a DataFrame?
import pandas as pd  
data = {'Name': ['Alice', 'Bob'], 'Age': [25, 30]}
df = pd.DataFrame(data)


3. Difference between Series and DataFrame
⦁ Series: 1D labeled array (like a single column), homogeneous data types, immutable size.
⦁ DataFrame: 2D table with rows & columns (like a spreadsheet), heterogeneous data types, mutable size.

4. How to read/write CSV files?
df = pd.read_csv('data.csv')  
df.to_csv('output.csv', index=False)


5. How to handle missing data in Pandas?
⦁ df.isnull() — identify nulls
⦁ df.dropna() — remove missing rows
⦁ df.fillna(value) — fill with default

6. How to filter rows in a DataFrame?
df[df['Age'] > 25]

7. What is groupby() in Pandas?
Used to split data into groups, apply a function, and combine the result.
Example:
df.groupby('Department')['Salary'].mean()

8. Difference between loc[] and iloc[]?
⦁ loc[]: label-based indexing
⦁ iloc[]: index-based (integer)

9. How to merge/join DataFrames?
Use pd.merge() to combine DataFrames on a key
pd.merge(df1, df2, on='ID', how='inner')

10. How to sort data in Pandas?
df.sort_values(by='Age', ascending=False)

💡 Pandas is key for data cleaning, transformation, and exploratory data analysis (EDA). Master it before jumping into ML!

Double Tap ❤️ For More!
  • ❤ 18
More from @datasciencefun
  1. Oct 17, 2026Aggregate functions such as COUNT() generally cannot be used in WHERE. ✅ Correct: SELECT d…
  2. Oct 17, 2026🚀 Data Science Roadmap 2026 📍 Phase 3: SQL for Data Science 📖 Topic 7 — HAVING HAVING i…
  3. Oct 17, 2026𝗜𝗕𝗠 𝗙𝗥𝗘𝗘 𝗧𝗘𝗖𝗛 𝗖𝗢𝗨𝗥𝗦𝗘𝗦 𝟮𝟬𝟮𝟲! 🎓 Explore IBM Cognitive Class and build…
  4. Oct 16, 2026𝗗𝗮𝘁𝗮 𝘀𝗰𝗶𝗲𝗻𝗰𝗲 𝗖𝗲𝗿𝘁𝗶𝗳𝗶𝗰𝗮𝘁𝗶𝗼𝗻 𝗪𝗶𝘁𝗵 𝗔𝗜😍 Future Ready Data Scien…
  5. Oct 15, 2026Post #4665
  6. Oct 15, 2026Post #4664
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →