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

Is there a way to only print the 'Ticker' column to a CSV #81

Open
mmehrle opened this issue Dec 7, 2020 · 1 comment
Open

Is there a way to only print the 'Ticker' column to a CSV #81

mmehrle opened this issue Dec 7, 2020 · 1 comment

Comments

@mmehrle
Copy link

mmehrle commented Dec 7, 2020

Since your Finviz data list seems to behave differently than a regular python list I am running into issues just printing a list of tickers based on a request.

This is what I'm trying to do:

from finviz.screener import Screener
import nest_asyncio
nest_asyncio.apply()

filter = ["geo_usa", "sh_avgvol_o2000", "sh_opt_optionshort", "sh_price_o30"]
stock_list = Screener(filters=filter, order='volume')
print ("%s symbols listed.\n" % len(stock_list))
tickers = stock_list['Ticker']
tickers.to_csv("tickers.csv")

The last one is breaking and I don't see any pertinent documentation about it telling me how to just grab one column.

Thanks in advance for any pointers.

@linuxkd
Copy link

linuxkd commented Feb 7, 2021

Might not be the cleanest way, but you could do this.

tickers = [stock["Ticker"] for stock in stock_list]

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

No branches or pull requests

3 participants