Tanai Goncalves
Tanai Goncalves

Reputation: 69

Dataframe List Pandas

Good morning,

I have the following List.

[ Unnamed: 0 R$/m3 Var./Dia Var./Mês 0 12/03/2021 2.9820 -0,03% 3,38% 1 11/03/2021 2.9830 -0,10% 3,41% 2 10/03/2021 2.9860 0,29% 3,52% 3 09/03/2021 2.9775 -0,02% 3,22% 4 08/03/2021 2.9780 0,25% 3,24% 5 05/03/2021 2.9705 -0,60% 2,98% 6 04/03/2021 2.9885 -0,05% 3,61% 7 03/03/2021 2.9900 0,57% 3,66% 8 02/03/2021 2.9730 3,07% 3,07% 9 01/03/2021 2.8845 0,00% 0,00% 10 26/02/2021 2.8845 2,72% 30,94% 11 25/02/2021 2.8080 1,10% 27,46% 12 24/02/2021 2.7775 1,67% 26,08% 13 23/02/2021 2.7320 2,11% 24,01% 14 22/02/2021 2.6755 1,02% 21,45%]

Read from

esalq_dia = pd.read_html('https://www.cepea.esalq.usp.br/br/indicador/etanol-diario-paulinia.aspx')

I'm having trouble to converitng into dataframe

cols = ['Unnamed: 0', 'R$/litro', 'US$/litro', 'Var./semana']

df = pd.DataFrame.from_records(esalq_dia, columns=cols)

Returns only this. Any idea what i'm doing wrong?

Unnamed: 0  R$/litro    US$/litro   Var./semana

0 Unnamed: 0 R$/m3 Var./Dia Var./Mês

enter image description here

Upvotes: 1

Views: 49

Answers (1)

Vinson Ciawandy
Vinson Ciawandy

Reputation: 1166

import pandas as pd
esalq_dia = pd.read_html('https://www.cepea.esalq.usp.br/br/indicador/etanol-diario-paulinia.aspx')
esalq_dia[0]

Upvotes: 2

Related Questions