From the course: Advanced NoSQL for Data Science

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Prepare data with document databases

Prepare data with document databases - NoSQL Tutorial

From the course: Advanced NoSQL for Data Science

Start my 1-month free trial

Prepare data with document databases

- [Instructor] Now it's time to take a look at how we can prepare data for use with document databases. It's quite common to have to load data from comma separated value files, or CSV files for short. Tab separated value files, also known as TSV files, are also frequently used for data transfers. One way to work with these files is to use a scripting language like Python. Python has two useful libraries for working with text and JSON files. These are called the CSV and JSON libraries or packages. These libraries have functions for reading and writing to these formats. The csv.DictReader function in the CSV library is especially useful for reading lines from a tabular file into a Python dictionary. These data structures are then easily mapped to JSON. We can use the dump function in the JSON library to write a list of dictionaries to a JSON file which can then be loaded to a document database. Now we don't have to write custom scripts if we don't want to. Document databases like…

Contents