Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pandas problems
#1
Hi Guys,
I have been using pandas for a while now to extract tables from the web. I used this simple bit of code here and ran into all sorts of problems!
import pandas as pd
import requests

url='https://free-proxy-list.net/'
response = requests.get(url)
html = response.content
df = pd.read_html(html, match='IP Address')
The output was fine as seen below - but if you look at my subsequent commands I simply cannot understand the errors since I have used these on numerous occasions with tables extracted using pandas.

   

Can anybody please let me know what I am doing wrong?

thanks
Reply
#2
It's OK - found the problem.

This line should be:

df = pd.read_html(html, match='IP Address')[0]
Otherwise I get a list of tables! DOH!
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020