{
  "id": 11276883,
  "title": "Getting to Know Your Data: An Introduction to Pandas",
  "url": "https://urgent.news/2026/10/01/getting-to-know-your-data-an-introduction-to-pandas",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-10-01T20:41:00.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/maureenkipkosgei/getting-to-know-your-data-an-introduction-to-pandas-44a9"
  },
  "original_language": "en",
  "account": "Pandas is an open-source library designed for data manipulation, analysis, and cleaning. It consists of two primary data structures: Series and DataFrame. A Series represents a single column, while a DataFrame represents a table with labeled rows and columns, similar to a spreadsheet.\n\nTo demonstrate, consider a simple example of creating a Series and a DataFrame in Python:\n\n```python\nimport pandas as pd\n\nstudent_list = pd.Series(['Amina', 'Brian', 'Fatuma', 'Dennis'])\nprint(student_list)\n\ndata = {\n'name': ['Ana', 'Sam', 'Lee'],\n'age': [29, 34, 41],\n'city': ['Nairobi', 'Lagos', 'Accra']\n}\nresults = pd.DataFrame(data)\nprint(results)\n```\n\nIn practice, you rarely type data manually like this, but rather read it from a file. Pandas provides methods to read data from various sources, such as CSV files, Excel files, and databases.\n\nTo read a CSV file, use the `read_csv()` function:\n\n```python\nsales = pd.read_csv(r'C:\\Data Science\\Python Files\\pharmacy_sales.csv')\n```\n\nTo read an Excel file, use the `read_excel()` function:\n\n```python\nsales = pd.read_excel(r'C:\\Data Science\\Python Files\\pharmacy_sales.xlsx')\n```\n\nIf your data resides in a database, you can use SQLAlchemy with Pandas to read data directly into a DataFrame:\n\n```python\nfrom sqlalchemy import create_engine\n\nengine = create_engine('postgresql+psycopg2://username:password@localhost:5432/database_name')\nquery = 'SELECT order_id, city, branch, channel FROM public.pharmacy_sales'\nsales_sql = pd.read_sql(query, con=engine)\n```\n\nBefore performing any analysis on a new DataFrame, it's crucial to inspect it to catch any potential issues early. Structural inspection can be done using the `info()` method, which provides a summary of the DataFrame, including index range, column names, counts of non-null values, data types, and memory usage.\n\n```python\nsales.info()\n```\n\nAdditionally, you can use the `columns` attribute to retrieve an index array of all column labels:\n\n```python\nsales.columns\n```\n\nThese basic inspection techniques help ensure that you're working with clean and accurate data, enabling you to build reliable analyses and avoid making assumptions based on flawed datasets.",
  "summary": "Once you start working with real-world data like spreadsheets, CSV exports, database then Python's built-in lists and dictionaries quickly become cumbersome. Pandas is the library that fills this gap: it gives you a structure built specifically for tabular data, along with fast, readable tools for exploring it before you do any real analysis. This article introduces pandas and covers the first…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}