Jan-10-2021, 11:14 AM
Hello,
I have a basic question and would be happy if someone could help me out.
I've extracted the prices of 2 stocks (Varta and Softcat) from a website using the following code:
Many thanks in advance!
Best,
Tim
I have a basic question and would be happy if someone could help me out.
I've extracted the prices of 2 stocks (Varta and Softcat) from a website using the following code:
import pandas as pd # Get data from website url = 'https://www.ariva.de/varta-aktie/kurs' df = pd.read_html(url) # Select table df_Varta = df[3] url = 'https://www.ariva.de/softcat-aktie/kurs' df = pd.read_html(url) df_Softcat = df[3] # Extract price from column/ row price_Varta= df_Varta['Letzter'][df_Varta['Handelsplatz']=='Xetra'] price_Softcat= df_Softcat['Letzter'][df_Softcat['Handelsplatz']=='L&S RT'] print(price_Varta) print(price_Softcat)The code generates the following output:
Output:5 126,90 €
Name: Letzter, dtype: object
0 16,825 €
Name: Letzter, dtype: object
However, I only want to know the price (without row numbers, name or dtype). Has anyone an idea how to achieve this result?Many thanks in advance!
Best,
Tim