<https://ja.coursera.org/lecture/python-for-applied-data-science-ai/working-with-different-file-formats-csv-xml-json-xlsx-EPUdg#lecture>
<http://schema.org/transcript>
"hello welcome to working with different file formats after watching this video you will be able to define different file formats such as csv xml and json write simple programs to read and output data and list what python libraries are needed to extract data when collecting data you will find there are many different file formats that need to be collected or read in order to complete a data driven story or analysis when gathering the data python can make the process simpler with its predefined libraries but before we explore python let us first check out some of the various file formats looking at a file name you will notice an extension at the end of the title these extensions let you know what type of file it is and what is needed to open it for instance if you see a title like file example.csv you will know this is a csv file but this is only one example of different file types there are many more such as json or xml when coming across these different file formats and trying to access their data we need to utilize python libraries to make this process easier the first python library to become familiar with is called pandas by importing this library in the beginning of the code we are then able to easily read the different file types since we have now imported the panda library let us use it to read the first csv file in this instance we have come across the file example.csv file the first step is to assign the file to a variable then create another variable to read the file with the help of the panda library we can then call read underscore csv function to output the data to the screen with this example there were no headers for the data so it added the first line as the header since we do not want the first line of data as the header let us find out how to correct this issue now that we have learned how to read and output the data from a csv file let us make it look a little more organized from the last example we were able to print out the data but because the file had no headers it printed the first line of data as the header we easily solve this by adding a data frame attribute we use the variable df to call the file then add the columns attribute by adding this one line to our program we can then neatly organize the data output into the specified headers for each column the next file format we will explore is the json file format in this type of file the text is written in a language independent data format and is similar to a python dictionary the first step in reading this type of file is to import json after importing json we can add a line to open the file call the load attribute of json to begin and read the file and lastly we can then print the file the next file format type is xml also known as extensible markup language while the pandas library does not have an attribute to read this type of file let us explore how to parse this type of file the first step to read this type of file is to import xml by importing this library we can then use the e-tree attribute to parse the xml file we then add the column headers and assign them to the data frame then create a loop to go through the document to collect the necessary data and append the data to a data frame in this video you learned how to recognize different file types how to use python libraries to extract data and how to use data frames when collecting data"
<https://ja.coursera.org/lecture/python-for-applied-data-science-ai/working-with-different-file-formats-csv-xml-json-xlsx-EPUdg>