+1 (315) 557-6473 

Create a Program to Implement Pandas Dataframe in Python Assignment Solution.


Write a program to implement pandas dataframe in python language.

Requirements and Specifications

Description: 1. Write a Python assignment program that reads the CSV file into a Panda dataframe. Using that dataframe, print the row, source IP, and destination IP as a table. 2. Write a python program that reads the CSV file into an ArrayList. Convert the ArrayList to a string array and print the row, source IP, and destination IP on the same line using a loop. Place your screenshots and responses in a Microsoft Word document. Be sure to include the .python files with your code for the python portions.
Source Code
import pandas as pd
import csv
if __name__ == '__main__':
# Open file
data = list()
with open('IN300_Dataset1.csv', 'r') as f:
lines = f.readlines()
for i, line in enumerate(lines):
# ignore first line
if i == 0:
# Remove all quotation marks
#line = line.replace('"', '')
line = line.strip()
# Now, split
cells = line.split(',"')
sublist = []
for cell in cells:
cell = cell.replace('"', '')
# Finally, convert this list of rows into a dataframe
df = pd.DataFrame(data, columns = ['No.', 'Time', 'Source', 'Destination', 'Protocol', 'Length', 'Info'])
# Finally, get No. Source and Destination into a new dataframe and print
df2 = df[['No.', 'Source', 'Destination']]