#๐Ÿ”’ using pandas dataframe

12 messages ยท Page 1 of 1 (latest)

fluid hatch
#

from yahoo_fin import stock_info as yf_info
import pandas as pd

gainersdf = yf_info.get_day_gainers()
gainersrd = gainersdf.head(10)
car = gainersrd.iloc[:, : 1]
print(car)

that code prints this:
Symbol
0 BAK
1 TNRSF
2 LIVN
3 IBRX
4 ALIT
5 MODG
6 SRAD
7 CLSK
8 MARA
9 VKTX

how can i make it so that it turns all those ticker symbols into a list. idk how to do it for each ticker in Symbol collumn

topaz needleBOT
#

@fluid hatch

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

grand trellis
#

it's a DataFrame so that won't work

#

it works on a Series, and without an underscore (inheritance from NumPy)

#

so car["Symbol"].tolist() is one way

runic sequoia
#

wouldn't .iloc[] return a series here?

grand trellis
#

:1 forces a frame

#

if it was 0 it would be a Series

fluid hatch
#

so what do i do

topaz needleBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.