Print CSV File in Python with Visual Studio Code on Windows - DevPops-Inc/python GitHub Wiki
• Press the Windows key, type “visual studio code” and select “Open.”
•
• Press the Ctrl and N key to create a new file.
•
• Select “Select a Language.”
•
• Type “python” in the search box and select “Python (python)” from the result.
•
• Type import pandas as pd
and press the Enter key to import the Pandas module as the pd
variable.
•
• Type from openpyxl.workbook import Workbook
and press the Enter key twice to import the Workbook
object from the openpxl.workbook
module.
•
• Type df_csv = pd.read_csv(‘< .csv file >.csv’, header=None)
and press the Enter key to define the dataframe for the .csv file.
•
• Type df_csv.colums = [‘< colunmn 1 >’, ‘< column 2 >’, ‘< . . . >’ ]
and press the Enter key to define the columns.
•
• Type print(df_csv)
and press the Enter key to print the .csv file.
•
• Press the Ctrl and S keys to save the file.
•
• Browse to where you want to save the file, type the filename in the “File name:” box and select “Save.”
•
• Press the Run button to print the contents of the .csv file in the TERMINAL.
•