0

I'm trying to print in a .csv all the data of some stocks the user wants to see, however, when I input a long period it keeps printing some dots that I can't remove.ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ

import csv
import yfinance as yf
import sys
import pandas as pd
import investpy as inv

try:
    br = inv.stocks.get_stocks(country="brazil")

    carteira = []
    
    ticker = input("Insira o ticker da ação (0 para encerrar): ").upper()
    while ticker != "0":
        carteira.append(ticker)
        ticker = input("Insira o ticker da ação (0 para encerrar): ").upper()
        
    carteira_sa = [ticker + ".SA" for ticker in carteira]

    inicio, fim = map(str, input("Informe o período que deseja analisar (ano-mês-dia): ").split())
    
    fechamento = yf.download(carteira_sa, start = inicio, end = fim)["Adj Close"]

    with open("dados.csv", "w") as final:
        d = str(fechamento)
        final.write(d)
        print("Feito")
            

except Exception as e:
    print(e)
    #sys.exit("Erro")

the output

toyota Supra
  • 3,181
  • 4
  • 15
  • 19
  • 1
    Does this answer your question? [Pretty-print an entire Pandas Series / DataFrame](https://stackoverflow.com/questions/19124601/pretty-print-an-entire-pandas-series-dataframe) – juanpethes Aug 14 '23 at 14:55
  • 1
    Does this answer your question? [Writing a pandas DataFrame to CSV file](https://stackoverflow.com/questions/16923281/writing-a-pandas-dataframe-to-csv-file) – C.Nivs Aug 14 '23 at 15:34

0 Answers0