python – Optimize Yahoo Finance Code for Analysis

I am trying to analyze a number of companies using financial data I gathered from Yahoo Finance. I am also using the yfinance API to get some more details about the company using functions. Since I am trying to do this for a number of companies Each Iteration needs to be quick. Currently, 1 Company takes about 3 seconds.

Is it because of the API calls or requests? Can I increase the below code efficiency?

import pandas as pd
import numpy as np
from pandas import ExcelWriter
import requests
import timeit
import yfinance as yf

def get_industry(stock):
    tickerdata = yf.Ticker(stock) 

def get_symbol(symbol):
    url = "{}&region=1&lang=en".format(symbol)
    result = requests.get(url).json()
    for x in result('ResultSet')('Result'):
        if x('symbol') == symbol:
            return x('name')
def get_currency(stock):
    tickerdata = yf.Ticker(stock) 

quarters = ('Q4-2020','Q3-2020','Q2-2020','Q1-2020','Q4-2019','Q3-2019','Q2-2019','Q1-2019','Q4-2018','Q3-2018','Q2-2018','Q1-2018')
start_time = timeit.default_timer()
r = ()
for i in stock(:1):
        df = pd.read_csv(i+'_quarterly_balance-sheet.csv')
        df = df.drop('ttm',axis=1,errors='ignore')
        df('name') = df('name').str.replace('t','')
        df = df.iloc(:,:13).T
        df.columns = df.iloc(0)
        df = df(1:)
            df.insert(0,'Currency','Not Found')
        df = df.loc(:,df.columns.isin(('Q','Currency','Ticker','Company','Industry','TotalRevenue')))
df = pd.concat(r)
# code you want to evaluate
elapsed = timeit.default_timer() - start_time

3.041297 Seconds

I will promote your website with 12 High Quality Yahoo answer for $6

I will promote your website with 12 High Quality Yahoo answer

Hi Sir,
This is “MOINUL” Here.

Yahoo Answers is a great way to promote your business. And get lots of natural traffic. Million people visit this platform every day. It is the best way to promote your business on google 1st page. We answer those question which is related to your website. I guaranteed you that your website gets 100% Real traffic. I will use Level 3 or higher accounts for answers.

My Services :
1. Answer submitted manually, Unique and Best Quality
2. Answers will be posted with your keyword related
3. Get Lots of Real Traffic
4. All are a clickable link
5. Never delete my answers
6. Quick Delivery and 24/7 Customer Support


It’s quite simple and straight forward. First I will go through your website to understand the theme and niche. And, I will search for a relevant question and answer with your website URL.

If you have any Questions? Please, feel free to talk mine inbox.


programming languages – Latex commands for telegram, whatsapp yahoo gmail etc

In the site of Quora we can write mathematics formulas with latex codes. It converts automatically the codes to Math. formulas.

can one do the same in “telegram”, Whatsapp. or emails systems as yahoo or gmail? that is we write our latex codes but after that we send our message it would be convert to math formula.

Is it ok (regarding spam) to use yahoo to send email from our domain

I m enough of seeing my email arriving in spam folder. I would like now to send my emails not from my smtp server but from yahoo mail server. When you have a yahoo account, you can choose to send email from other sender (ie like it’s just a simple configuration we can do for free in all yahoo account (in some way I guess it’s just changing the header of the email, putting in the sender instead of Now is it safe regarding spam to send emails like this? what are the pro and cons?

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive New Proxy Lists Every Day Proxies123