Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Change output of cells.
#1
Dear users,

I am quite new to Python coding, and recently I have found a way to download stock data into Python.
Since I am downloading multiple stocks at once, I want to change the output of what Python gives me as a return of this string.

The string I am using is:

import requests

url = "https://query1.finance.yahoo.com/v7/finance/download/AAPL?period1=1514761200&period2=1517439600&interval=1d&events=history&crumb=Nr.jC4aJCc7"

response = requests.post(url)
print (response.text)
If i copy this string multiple times and change the ticker symbol, i will receive data from multiple stocks.

The output i Receive is
Output:
Date,Open,High,Low,Close,Adj Close,Volume 2018-01-02,170.160004,172.300003,169.259995,172.259995,169.712067,25555900 2018-01-03,172.529999,174.550003,171.960007,172.229996,169.682510,29517900 2018-01-04,172.539993,173.470001,172.080002,173.029999,170.470703,22434600 2018-01-05,173.440002,175.369995,173.050003,175.000000,172.411560,23660000
(I get more rows, but for argument sake this is enough)


I would like the output to be changed in a way that infront of every row, it will say the ticker simbol. (which in this case is AAPL)

So an example would be:
Output:
Ticker,Date,Open,High,Low,Close,Adj Close,Volume AAPL,2018-01-02,170.160004,172.300003,169.259995,172.259995,169.712067,25555900
Is there anyone who can help me with this issue?

Kind regards,



Hoogoo
Reply


Messages In This Thread
Change output of cells. - by Hoogoo - Nov-18-2018, 09:06 AM
RE: Change output of cells. - by Hoogoo - Nov-18-2018, 01:55 PM
RE: Change output of cells. - by Larz60+ - Nov-19-2018, 12:47 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  output values change akbarza 3 561 Oct-18-2023, 12:30 PM
Last Post: deanhystad
  Find a specific keyword after another keyword and change the output sgtmcc 5 879 Oct-05-2023, 07:41 PM
Last Post: deanhystad
  Rain sensor output only on change Pete6 3 2,076 May-11-2022, 10:36 PM
Last Post: Pete6
  Openpyxl-change value of cells in column based on value that currently occupies cells phillipaj1391 5 9,942 Mar-30-2022, 11:05 PM
Last Post: Pedroski55
  How can I iterate through all cells in a column (with merge cells) with openpyxl? aquerci 1 7,552 Feb-11-2021, 09:31 PM
Last Post: nilamo
  Copy certain cells into new workbook certain cells Kristenl2784 4 2,520 Jul-14-2020, 07:59 PM
Last Post: Kristenl2784
  Change Text Color Output in Python bluethundr 2 8,773 Mar-06-2019, 10:23 PM
Last Post: bluethundr
  Confusing output from 2to3 about what files need change Moonwatcher 1 4,856 Dec-30-2018, 04:07 PM
Last Post: Gribouillis
  Change the output window size and display area issac_n 0 2,284 Apr-13-2018, 04:41 AM
Last Post: issac_n
  Change Windows Sound Output Device with Python delfar 1 10,368 Sep-15-2017, 12:11 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020