To import the .csv file into a Jupyter Notebook session, open the Jupyter Notebook program as we did in Chapter 1, Introduction to Healthcare Analytics. Open a new notebook. Then, in the first cell, type the following (substituting in your file path for that which is shown here) and hit the Play button:
import pandas as pd
df = pd.read_csv(
'C:\\Users\\Vikas\\Desktop\\Bk\\Data\\DFCompare_Revised_FlatFiles\\' +
'ESRD QIP - Complete QIP Data - Payment Year 2018.csv', header=0
)
The preceding code uses the read_csv() function of the pandas library to import the .csv file as a DataFrame. The header parameter tells the notebook that the first line contains column names.
Notice that the backslashes appear in groups of two. That is because \ is an escape character in Python. Also, notice that the filename was too long to fit in one line. In Python, statements can encompass multiple lines without special treatment as long as the break is enclosed by parentheses and certain other punctuation.