import pandas as pd
import requests
from bs4 import BeautifulSoup
from tabulate import tabulate
import time
url = "http://comp.fnguide.com/SVO2/ASP/SVD_Main.asp?
pGB=1&gicode=A005930&cID=&MenuYn=Y&ReportGB=&NewMenuID=101&stkGb=701"
res = requests.get(url)
soup = BeautifulSoup(res.content, "lxml")
table = soup.find_all("table")
df = pd.read_html(str(table))
print(tabulate(df[0], headers="keys", tablefmt="psql"))
In order to obtain the data of the recount, the above code was created.
My next step goal is to get only the 'number of issued shares (common shares/preferred shares)' from the print (not the entire row, just this part).
How do I make a code?
If tabulate is inconvenient, is there any other way?
python
print(df[0].iloc[6, 1]) #### 5,969,782,550/ 822,886,700
botong, useon = list(df[0].iloc[6, 1].split('/'))
print(botong, useon) #### 5,969,782,550 822,886,700
botong = int(botong.replace(',', ''))
useon = int(useon.replace(',', ''))
print(botong, useon) #### 5969782550 822886700
583 GDB gets version error when attempting to debug with the Presense SDK (IDE)
563 Understanding How to Configure Google API Key
561 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
832 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.