Skip to content

Instantly share code, notes, and snippets.

@glowinthedark
Created January 22, 2022 19:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save glowinthedark/6bfefd02faf9b5fddcf49aaadf745ba3 to your computer and use it in GitHub Desktop.
Save glowinthedark/6bfefd02faf9b5fddcf49aaadf745ba3 to your computer and use it in GitHub Desktop.
bcn immigration
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