Home > database >  Python Pandas : Getting only 3 first elements from table
Python Pandas : Getting only 3 first elements from table

Time:11-09

I using pandas to webscrape this site pick

CodePudding user response:

It looks like if you install and use html5lib as your parser it may fix your issues:

df = pd.read_html("https://www.mapsofworld.com/lat_long/poland-lat-long.html",attrs={"class":"tableizer-table"},skiprows=2,flavor="html5lib")

>>>df
[                      0         1          2
0             Locations  Latitude  Longitude
1                   NaN       NaN        NaN
2              Augustow   53°51'N    23°00'E
3    Auschwitz/Oswiecim   50°02'N    19°11'E
4       Biala Podxlaska   52°04'N    23°06'E
..                  ...       ...        ...
177           Zawiercie   50°30'N    19°24'E
178        Zdunska Wola   51°37'N    18°59'E
179           Zgorzelec   51°10'N     15°0'E
180            Zyrardow    52°3'N    20°28'E
181              Zywiec   49°42'N    19°10'E

[182 rows x 3 columns]]
  • Related