{ "cells": [ { "cell_type": "markdown", "metadata": { "id": "view-in-github", "colab_type": "text" }, "source": [ "" ] }, { "cell_type": "markdown", "id": "1e095521", "metadata": { "id": "1e095521" }, "source": [ "# Exportar los DataFrame de Pandas \n", "Veamos cómo exportar los Panda DataFrame." ] }, { "cell_type": "markdown", "id": "962388c9", "metadata": { "id": "962388c9" }, "source": [ "## Exportar a Excel" ] }, { "cell_type": "code", "execution_count": 1, "id": "74107392", "metadata": { "id": "74107392" }, "outputs": [], "source": [ "import pandas as pd # importamos la librería Pandas" ] }, { "cell_type": "code", "execution_count": 2, "id": "6c2bbd75", "metadata": { "id": "6c2bbd75", "outputId": "50c68f5c-8cbe-41a0-e1e7-ab98020a5ab2", "colab": { "base_uri": "https://localhost:8080/" } }, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ "[['MADRID', 'MAD', 61734944, 560039136, False, 1931],\n", " ['BARCELONA', 'BCN', 52688455, 176797909, False, 1927],\n", " ['PALMA DE MALLORCA', 'PMI', 29721142, 9021606, True, 1960],\n", " ['MALAGA', 'AGP', 19858656, 3080119, False, 1946],\n", " ['ALICANTE', 'ALC', 15048240, 4032300, False, 1951],\n", " ['GRAN CANARIA', 'LPA', 13261228, 19727786, True, 1933],\n", " ['TENERIFE SUR', 'TFS', 11168707, 2193378, True, 1978],\n", " ['VALENCIA', 'VLC', 8539579, 14515842, False, 1930],\n", " ['IBIZA', 'IBZ', 8155626, 1434695, True, 1949],\n", " ['SEVILLA', 'SVQ', 7544357, 9891790, False, 1946]]" ] }, "metadata": {}, "execution_count": 2 } ], "source": [ "# Datos de aeropuertos\n", "mad = ['MADRID', 'MAD', 61734944, 560039136, False, 1931]\n", "bcn = ['BARCELONA', 'BCN', 52688455, 176797909, False, 1927]\n", "pmi = ['PALMA DE MALLORCA', 'PMI', 29721142, 9021606, True, 1960]\n", "agp = ['MALAGA', 'AGP', 19858656, 3080119, False, 1946]\n", "alc = ['ALICANTE', 'ALC', 15048240, 4032300, False, 1951]\n", "lpa = ['GRAN CANARIA', 'LPA', 13261228, 19727786, True, 1933]\n", "tfs = ['TENERIFE SUR', 'TFS', 11168707, 2193378, True, 1978]\n", "vlc = ['VALENCIA', 'VLC', 8539579, 14515842, False, 1930]\n", "ibz = ['IBIZA', 'IBZ', 8155626, 1434695, True, 1949]\n", "svq = ['SEVILLA', 'SVQ', 7544357, 9891790, False, 1946]\n", "\n", "list_airport = [mad, bcn, pmi, agp, alc, lpa, tfs, vlc, ibz, svq]\n", "list_airport" ] }, { "cell_type": "code", "execution_count": 3, "id": "afa299d5", "metadata": { "id": "afa299d5", "outputId": "b25d4268-cb65-4a9f-fd62-936d646e0dcf", "colab": { "base_uri": "https://localhost:8080/", "height": 363 } }, "outputs": [ { "output_type": "execute_result", "data": { "text/plain": [ " Aeropuerto CodigoIATA Pasajeros Mercancía Insular Año\n", "0 MADRID MAD 61734944 560039136 False 1931\n", "1 BARCELONA BCN 52688455 176797909 False 1927\n", "2 PALMA DE MALLORCA PMI 29721142 9021606 True 1960\n", "3 MALAGA AGP 19858656 3080119 False 1946\n", "4 ALICANTE ALC 15048240 4032300 False 1951\n", "5 GRAN CANARIA LPA 13261228 19727786 True 1933\n", "6 TENERIFE SUR TFS 11168707 2193378 True 1978\n", "7 VALENCIA VLC 8539579 14515842 False 1930\n", "8 IBIZA IBZ 8155626 1434695 True 1949\n", "9 SEVILLA SVQ 7544357 9891790 False 1946" ], "text/html": [ "\n", "
\n", " | Aeropuerto | \n", "CodigoIATA | \n", "Pasajeros | \n", "Mercancía | \n", "Insular | \n", "Año | \n", "
---|---|---|---|---|---|---|
0 | \n", "MADRID | \n", "MAD | \n", "61734944 | \n", "560039136 | \n", "False | \n", "1931 | \n", "
1 | \n", "BARCELONA | \n", "BCN | \n", "52688455 | \n", "176797909 | \n", "False | \n", "1927 | \n", "
2 | \n", "PALMA DE MALLORCA | \n", "PMI | \n", "29721142 | \n", "9021606 | \n", "True | \n", "1960 | \n", "
3 | \n", "MALAGA | \n", "AGP | \n", "19858656 | \n", "3080119 | \n", "False | \n", "1946 | \n", "
4 | \n", "ALICANTE | \n", "ALC | \n", "15048240 | \n", "4032300 | \n", "False | \n", "1951 | \n", "
5 | \n", "GRAN CANARIA | \n", "LPA | \n", "13261228 | \n", "19727786 | \n", "True | \n", "1933 | \n", "
6 | \n", "TENERIFE SUR | \n", "TFS | \n", "11168707 | \n", "2193378 | \n", "True | \n", "1978 | \n", "
7 | \n", "VALENCIA | \n", "VLC | \n", "8539579 | \n", "14515842 | \n", "False | \n", "1930 | \n", "
8 | \n", "IBIZA | \n", "IBZ | \n", "8155626 | \n", "1434695 | \n", "True | \n", "1949 | \n", "
9 | \n", "SEVILLA | \n", "SVQ | \n", "7544357 | \n", "9891790 | \n", "False | \n", "1946 | \n", "