Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

447
Vistas
How can I download a pandas Dataframe in Google Colab?

I have been stuck on how to download a pandas DataFrame into my local disk (or onto Google Drive) after creating it in Google Colab. I have tried converting it to bytes, a string (using pd.to_string), a dict (pd.to_dict), but nothing seems to work.

Additionally, I've looked at using the drive.CreateFile method as explained in the intro Colab Code and as specified here: How to download file created in Colaboratory workspace?, but I'm not sure how to apply this to pandas.

Any help is appreciated - thanks!

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

Maybe something like this.

from google.colab import files

df.to_csv('df.csv')
files.download('df.csv')
over 4 years ago · Santiago Trujillo Denunciar

0

For google colab, i recommend use Pydrive. Your answer can be found in here How to download file created in Colaboratory workspace?

edit: just change filename.csv to filename.zip or filename.blabla in lines

uploaded = drive.CreateFile({'title': 'filename.csv'})
uploaded.SetContentFile('filename.csv')

why? because this line

uploaded.SetContentFile('filename.csv')

auto set format for you content file, so you don't need to converter it to String or Byte.

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda