0

Can you help me with removing number in read_csv pandas? For example I want enter image description here

turn into enter image description here

I'm wondering if some could help me do this! Thank you in advance! My code:

from time import sleep
from pywebio.input import *
from pywebio.output import *
from pywebio import start_server

import pandas

def app():
    pandas.options.display.max_rows = 6000
    pandas.set_option('display.float_format', lambda x: '%.0f' % x)


    a = pandas.read_csv("https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/latest/owid-covid-latest.csv", delimiter=",", )



    out = (a[["location",  "new_cases", "total_cases","new_deaths","total_deaths"]].to_string().replace('\n','\n'+' '*12))
    out1 = '{:<11} {}'.format('',out)

    Titles1 = out1.replace("location", "Location")
    Titles2 = Titles1.replace("new_cases", "New Cases")
    Titles3 = Titles2.replace("total_deaths", "Total Deaths")
    Titles4 = Titles3.replace("total_cases", "Total Cases")
    Titles5 = Titles4.replace("new_deaths", "New deaths")
    No0 = Titles5.replace(".0", "")
    print(No0)
    put_code(No0)
    while True:
        sleep(1)

start_server(app,636)
Timur Yun
  • 31
  • 3
  • That number seems to be the index of your DataFrame, a property of the DataFrame itself. You could use a different column by using the `index_col` keyword argument of `read_csv`. – aaossa Feb 10 '22 at 18:33

1 Answers1

1

That's the index, and you can't get rid of it unless you make another column the index, which you can do with df = df.set_index('your column').