Last answered:

01 Aug 2023

Posted on:

26 Jan 2023

0

Using yf and unable to import data for pg

I tried importing data from yahoo finance api with following code:
PG=yf.download('PG',data_source='yahoo',start='1995-1-1')
it worked but showed this error:

1 Failed download:
- PG: No data found for this date range, symbol may be delisted

so instead i have downloaded TSLA and it starts from 2010.

hopefully this wont cause problem in long term.

2 answers ( 0 marked as helpful)
Posted on:

19 May 2023

0

run the below in the anconda prompt to install yfinance package

conda install -c conda-forge yfinance


THEN run the code this way;


import yfinance as yf

data = yf.download('PG', start = '1991-01-01')
data

Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Posted on:

01 Aug 2023

0

Found following solution:

import pandas
from pandas_datareader import data as pdr
import yfinance as yfin
yfin.pdr_override()

PG = pdr.get_data_yahoo("PG", start="1995-1-1", end="2023-1-1")
print(PG)


credit : Alok

Submit an answer