Changing pipe separated data to a pandas Dataframe
dataframe, file-io, pandas, python, python-3.x
Solution
Here you go:
>>> import pandas as pd
>>> pd.read_csv('data.csv', sep='|', index_col=False,
names=['protocol', 'server', 'type', 'value'])
Out[7]:
protocol server type value
0 https clients4.google.com application/octet-stream 2296
1 https clients4.google.com text/html; charset=utf-8 0
2 https clients4.google.com application/octet-stream 2291
Problem
I have pipe-separated values like this: ``` https|clients4.google.com|application/octet-stream|2296| https|clients4.google.com|text/html; charset=utf-8|0| .... .... https|clients4.google.com|application/octet-stream|2291| ``` I have to create a Pandas DataFrame out of this data, with each column given a name.