Lesson 38 of 55 · Python
Introduction to Pandas
Duration: 20 minutes
Lesson 38 of 55 · Python
Duration: 20 minutes
python\nimport pandas as pd\n\n# Create a DataFrame from a dictionary\ndf = pd.DataFrame({\n 'name': ['Alice', 'Bob', 'Charlie'],\n 'age': [25, 30, 35]\n})\nprint(df)\n\n# Compute the average age\nprint('Average age:', df['age'].mean())\n\n# Filter rows where age > 28\nprint('Older than 28:\n', df[df['age'] > 28])\n\n\nPandas reads CSV, Excel, SQL, and many other formats, and works seamlessly with NumPy, Matplotlib, and scikit‑learn.\n