Python Forum
How to capture Single Column from Web Html Table?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to capture Single Column from Web Html Table?
#4
(Jul-11-2019, 05:12 AM)ahmedwaqas92 Wrote: I would most probably export them to a CSV file

Link appears to be dead, so generic example how to write specific columns to file:

>>> import pandas as pd
>>> d = {'ham': [1, 2, 3], 'spam': ['a', 'b', 'c'], 'bacon': ['1a', '2b', '3c']}
>>> df = pd.DataFrame(d)
>>> df
   ham spam bacon
0    1    a    1a
1    2    b    2b
2    3    c    3c
>>> df.to_csv('out.csv', columns=['ham', 'bacon'], index=False)
The content of out.csv is:

Output:
ham,bacon 1,1a 2,2b 3,3c
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Messages In This Thread
RE: How to capture Single Column from Web Html Table? - by perfringo - Jul-12-2019, 06:26 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Suggestion request for scrapping html table Vkkindia 3 2,033 Dec-06-2021, 06:09 PM
Last Post: Larz60+
  HTML multi select HTML listbox with Flask/Python rfeyer 0 4,633 Mar-14-2021, 12:23 PM
Last Post: rfeyer
  Help: Beautiful Soup - Parsing HTML table ironfelix717 2 2,691 Oct-01-2020, 02:19 PM
Last Post: snippsat
  Python3 + BeautifulSoup4 + lxml (HTML -> CSV) - How to loop to next HTML/new CSV Row BrandonKastning 0 2,364 Mar-22-2020, 06:10 AM
Last Post: BrandonKastning
  Imprt HTML table to array meleghengersor 2 2,111 Jan-23-2020, 10:23 AM
Last Post: perfringo
  BeautifulSoup: Error while extracting a value from an HTML table kawasso 3 3,224 Aug-25-2019, 01:13 AM
Last Post: kawasso
  convert html table to json bhojendra 5 16,016 Jul-30-2019, 07:53 PM
Last Post: DeaD_EyE

Forum Jump:

User Panel Messages

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