3

SQL and Built-in File Handling Modules in Python

Introduction

The first step in data science always involves getting a hold of data, since it's a little difficult to do data science without data. The canonical data operations package in Python is pandas, but before we can even get to that, we need to learn some other basic input/output (I/O) functions and methods in base Python. In this chapter, we'll cover the following topics:

  • How to load data from common text files with built-in Python functions
  • How to use the built-in sqlite3 module to save and load data
  • How to use basic SQL commands
  • How to use the SQLAlchemy package in Python

Let's get started by using base Python to load plain text files.

Loading, reading, and writing files with base ...

Get Practical Data Science with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.