LM Introduction

πŸ” What is a CSV File?

CSV (Comma-Separated Values) is a simple file format used to store tabular data, such as spreadsheets or databases. Each line in the file is a row of data, and columns are typically separated by commas or semicolons.

Example:

Name,Age,City
Alice,30,Berlin
Bob,25,Hamburg

🐍 Working with CSV Files in Python

Python offers two common ways to work with CSV files:

1. Using pandas

The pandas library provides powerful tools for reading, writing, and analyzing CSV data as DataFrames.

2. Using the csv module

The built-in csv module allows you to read and write CSV files using simple Python structures like lists and dictionaries.

βœ… Good to Know

  • Always check your delimiter (sep) when reading European CSV files – often it’s a semicolon ;.

πŸ“š Further Reading

Updated: