Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.8 warning in tickers_sp500() #54

Closed
an4s opened this issue Jun 22, 2021 · 1 comment
Closed

Python 3.8 warning in tickers_sp500() #54

an4s opened this issue Jun 22, 2021 · 1 comment

Comments

@an4s
Copy link

an4s commented Jun 22, 2021

I have Python 3.8 installed on my system and see the following warning when using the tickers_sp500 function:

C:\Python38\lib\site-packages\yahoo_fin\stock_info.py:130: FutureWarning: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will*not* be treated as literal strings when regex=True.

sp500["Symbol"] = sp500["Symbol"].str.replace(".", "-")

which can be traced back to the line of code below:

sp500["Symbol"] = sp500["Symbol"].str.replace(".", "-")

The issue can be reproduced by running the following code:

PS > python
>>> from yahoo_fin import stock_info as si
>>> t = si.tickers_sp500()
C:\Python38\lib\site-packages\yahoo_fin\stock_info.py:130: FutureWarning: The default value of regex will change from True to False in a future version. In addition, single character regular expressions will*not* be treated as literal strings when regex=True.
  
  sp500["Symbol"] = sp500["Symbol"].str.replace(".", "-")

Specs of my system:
OS: Win10-64 bit
Python: 3.8.2
yahoo_fin: 0.8.8

I believe changing replace(".", "-") to replace(".", "-", regex=True) in the line of code referenced above should take care of the warning (but I haven't tested it yet). See this issue referenced from the Pandas docs.

@atreadw1492
Copy link
Owner

@an4s Thanks for the notification. I will push this update with the latest patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants