geovizir#

Subpackages#

Submodules#

Package Contents#

Functions#

glimpse(df[, max_width])

Print a pandas DataFrame by columns.

load_data(folder, filepath)

ne_countries(→ geopandas.GeoDataFrame)

Return a GeoDataFrame of the world countries.

ne_states(→ geopandas.GeoDataFrame)

Return a GeoDataFrame of the stats of a country.

label_bins(→ list[str])

Return a list of labels for a list of bins.

relabel_bins(column)

Relabel a column with the bins of the column.

get_data(→ pandas.DataFrame)

Get data from the World Bank API

get_data_most_recent(→ pandas.DataFrame)

Get the data from the World Bank API with the most

Attributes#

geovizir.__version__#
geovizir.glimpse(df: pandas.DataFrame, max_width: int = 76)[source]#

Print a pandas DataFrame by columns.

Print the dimensions, column names, dtypes and first few values of a pandas DataFrame by columns.

Parameters:
  • df (DataFrame) – The pandas DataFrame to print.

  • max_width (int, optional) – The maximum width of the output, by default 76.

geovizir.load_data(folder, filepath)[source]#
geovizir.ne_countries(scale: int = 10) geopandas.GeoDataFrame[source]#

Return a GeoDataFrame of the world countries.

Download the world countries shapefile from Natural Earth and return a GeoDataFrame of the countries.

Parameters:

scale (int, optional) – The scale of the shapefile, by default 10. The allowed values are 10, 50 and 110.

Returns:

A table of the world countries.

Return type:

GeoDataFrame

geovizir.ne_states(state: str, scale: int = 10) geopandas.GeoDataFrame[source]#

Return a GeoDataFrame of the stats of a country.

Download the counties shapefile from Natural Earth and return a GeoDataFrame of the countries.

Parameters:
  • state (str) – The country ISO3 code.

  • scale (int, optional) – The scale of the shapefile, by default 10. The allowed values are 10, 50 and 110.

Returns:

A table of the world countries.

Return type:

GeoDataFrame

geovizir.label_bins(bins: list[int, float]) list[str][source]#

Return a list of labels for a list of bins.

For each element of the bins, an interval is created with the previous element. The first element is add as ‘< first_element’ and the last element as ‘> last_element’.

Parameters:

bins (list[float, int]) – A list of bins to be labeled.

Returns:

A list of labels.

Return type:

list[str]

Examples

>>> bins([1,2,3])
geovizir.relabel_bins(column: pandas.Series)[source]#

Relabel a column with the bins of the column.

Parameters:

column (Series) – A column to be relabeled.

Returns:

A column with the labels of the bins.

Return type:

Series

geovizir.get_data(indicator: str, year: int) pandas.DataFrame[source]#

Get data from the World Bank API

Parameters:
  • indicator (str) – Indicator code

  • year (int) – Year

Returns:

Dataframe with the data

Return type:

pandas.DataFrame

geovizir.get_data_most_recent(indicator: str) pandas.DataFrame[source]#

Get the data from the World Bank API with the most recent year available

Parameters:

indicator (str) – Indicator code

Returns:

Dataframe with the data

Return type:

pandas.DataFrame