Created
January 22, 2022 19:37
-
-
Save glowinthedark/6bfefd02faf9b5fddcf49aaadf745ba3 to your computer and use it in GitHub Desktop.
bcn immigration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from google.colab import data_table | |
data_table.enable_dataframe_formatter() | |
df = pd.read_html('https://www.idescat.cat/pub/?id=aec&n=272&t=2020&lang=es', thousands='.')[0] | |
df.drop(df.tail(1).index, inplace=True) | |
COLS = ['Barcelona', 'Girona', 'Lleida', 'Tarragona', 'Cataluña'] | |
df[COLS] = df[COLS].apply(pd.to_numeric) | |
df.sort_values(['Barcelona', 'Cataluña'], inplace=True, ascending=False) | |
data_table.DataTable(df, include_index=True, num_rows_per_page=100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment