A pd.Series can be created from Python lists, dictionaries, tuples, or NumPy arrays.
Output:
When creating a Series from a dictionary, the dictionary keys automatically become the Series Index, and the dictionary values become the data:
Here, each key becomes a Column Name, and the corresponding list becomes the column values (all lists must be of equal length):
Output:
Often data comes from REST APIs or MongoDB as a list of JSON records:
Once a DataFrame is instantiated, inspect its dimensions and metadata immediately:
df.dtypes?df.head(3) method do?Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
| Previous Lesson | Next Lesson |
|---|---|
| Pandas Installation & Environment Setup | Reading & Writing CSV and TSV Files |
Test your understanding of this lesson with 5 questions. Each question has one correct answer.
Combine 15 complete courses, 150 chapters, 541 topics, live SQL/Power BI/Tableau dashboards, and Scikit-Learn capstones at MSK Institute Shikohabad or Live Online.