Muhtar
Muhtar

Reputation: 1700

Show pandas framework as html from csv file

I am trying to show csv files on html content but I havent done properly up to now. Want to show html content without using models because the length or headers is not fixed this is dependable on tasks. This doesnt show proper format. Code;

df = pd.read_csv(f_path)
objects = df.to_html(header=None)return
HttpResponse(objects)

csv content

enter image description here

html output

enter image description here

Upvotes: 0

Views: 254

Answers (1)

Joe Thor
Joe Thor

Reputation: 1260

Try calling out the separator in your data, which looks to be ;. Also set your index to be the first column and establish your column names.

df = pd.read_csv(f, sep=';', index_col=0)
df.columns =['Epoch', 'Data']

Upvotes: 1

Related Questions