Apply Schema on Lists from Files

Apply Schema on the lists from files¶ Let us understand how to apply schema while processing the data from the files. In many cases, data files might not contain the metadata such as column names, data types, etc. We might get the data metadata in the form of separate files. Also, it is common that …

Apply Schema on Lists from Files Read More »

0 comments

Advantages of Using CSV Module

Advantages of using CSV Module¶ Let us go through the advantages related to CSV. Readability and lesser code while dealing with files containing delimited records or lines. We can avoid iterable of strings as intermediate data structure while reading delimited data from files as well as writing the iterables of tuples or dicts into delimited …

Advantages of Using CSV Module Read More »

0 comments

Write Iterables to Files Using CSV

Write iterables to files using CSV¶ Let us understand how to write data in iterables such as list of tuples to delimited files using Python I/O functions as well as csv. csv can also be used to write iterable of dicts into delimited files. In [1]: orders = [(1, ‘2013-07-25 00:00:00.0’, 11599, ‘CLOSED’), (2, ‘2013-07-25 00:00:00.0’, …

Write Iterables to Files Using CSV Read More »

0 comments

Read Delimited Data using CSV

Read Delimited data using CSV¶ Let us understand how to read data from delimited files using Python I/O functions as well as csv. csv can be used to read iterable of delimited strings into iterable of tuples or dicts. We will go through the steps related to how to read the contents of the file …

Read Delimited Data using CSV Read More »

0 comments

Overview of CSV Module

Overview of CSV Module¶ Let us get an overview of CSV Module. It provide some wrapper functions to provide structure to the delimited data in collections as well as to write the collections back in the form of delimited records. You need to import csv module to use the functions that are part of it. …

Overview of CSV Module Read More »

0 comments

Write Delimited Strings into Files

Write Delimited Strings into files¶ Let us understand how to write delimited strings into files. We will start with a collection or list of tuples and see how to convert to delimited strings before writing to a file. Here are the steps involved to write list of tuples into file as delimited strings. Convert the …

Write Delimited Strings into Files Read More »

0 comments