DSQuest
DSQuest

Reputation: 35

Pandas html to df - commas in numbers

I'm newbie in Python. I need to download some tables from Polish language webpages. I have problem with commas in numbers because it seems that Pandas delete them? For example:

import pandas as pd
x = pd.read_html('https://www.gpw.pl/wskazniki', encoding='utf-8', decimal=",")[1]

The result in C/WK column is "021" instead "0,21". How to download it properly or change to "0.21". Thank you

Upvotes: 1

Views: 824

Answers (1)

Roy2012
Roy2012

Reputation: 12523

The issue is with the thousands separator, which also defaults to common.

To read the data and parse it correctly, use:

pd.read_html('https://www.gpw.pl/wskazniki',encoding = 'utf-8', decimal=',', thousands='.')[1]

The result is: enter image description here

Upvotes: 2

Related Questions