Remove column from a matrix

0

Passing a csv to an array with pandas creates a column to the left of everything indicating the row number that it is. How could it be eliminated?

def cargar():
  print("Indica la ruta donde se encuentra el CSV\n")
  print("Si desea salir pulse '0' " )
ruta=input()
try:
    if ruta=="0":
        sys.exit()

    matriz_partidos=pd.read_csv(ruta,header=0)
    print(matriz_partidos)
    matriz_partidos= matriz_partidos.drop('column_name', 1)

    time.sleep(10)
except OSError :
    print("No se puede leer el archivo intentelo de nuevo")

    cargar()
aj_data(matriz_partidos)
    
asked by Diego 08.10.2018 в 23:25
source

1 answer

0

In pandas, when you upload a file, a dataframe is created which automatically assigns an index

This is an example taken from the original documentation link

As you can see, the dataframe is created and an index is generated automatically on the left, I recommend you try with pd.read_csv(ruta, index = False)

    
answered by 09.10.2018 в 00:23