Skip to main content

Economic Complexity

This package is the implementation of the Economic Complexity and Fitness

See https://locusanalytics.github.io/EconCmplx/ for full documentation.

Getting Started

Installation

The package can be downloaded and installed using pip.

pip install locuscomplexity

You will then be able to import the package in your Python scripts.

import locuscomplexity as lc

You can also import specific parts of the package.

import locuscomplexity.complexity as lcmplx
import locuscomplexity.fitness as lfit

Prerequisites

This package is coded in Python 3. Using pip install, all Python libraries required to use it should be automatically installed on your machine.

How to use the Locus Economic Complexity package

Input data

The input data needs to follow a specific format. the module requires a Dataframe that contains two dimensions. For example, the first dimension can be the area codes, such as County Fips codes, the second can be 4x6 Locus Functions or Functional markers for which we know the employment level for a year. The following table could be an input if we want to compute the complexity of counties based on the distribution of employment by 4x6 Locus Functions.

Fips codes 1 A 2 A 3 A ... 4 E 4 F
1001 1207 542 788 456 741
1003 456 7412 845 369 236
51857 159 4563 458 4563 257

Using the original OEC algorithm

If we note df our input Dataframe, we can compute the complexity scores of both the counties and the Locus functions directly using the complexity_indices function. The first argument is the input Dataframe, the second is the name of the column that contains the first dimension.

area_complexity, functions_complexity = locuscomplexity.complexity.complexity_indices(
            df, 'Fips codes')

Using the Fitness algorithm

Using the fitness algorithm the matrix m needs to be computed separately. We can then compute area fitness scores and functional complexity using the fitness and complexity functions. The arguments are the same as in the previous method.

m = locuscomplexity.complexity.build_m(df_data, 'Fips codes')
area_fitness = locuscomplexity.fitness.fitness(m, 'Fips codes')
functions_complexity = locuscomplexity.fitness.complexity(m)

Output

Both methods return the complexity scores for the first and second dimension. We standardized the output for both methods.

The complexity (or fitness) scores for the first dimension are returned in a two column Dataframe.

f Fips codes
2.1 1001
1.5 1003
0.45 51857

The output for complexity scores on the second dimension has a similar structure.

index q
1 A 1.6
1 B 3.4
4 F 0.7

Documentation

Authors

Metadata

Release files for locuscomplexity 0.2.3.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for locuscomplexity 0.2.3.19
File Size Uploaded
locuscomplexity-0.2.3.19.tar.gz 11.1 kB Details

Release files / locuscomplexity-0.2.3.19.tar.gz

Download URL locuscomplexity-0.2.3.19.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
d50d0b8915472b209b54f8726de0b82709b36aa455240bd186b865734541da2d
BLAKE2b-256 checksum
How to use checksums
b6f57fbcb295ef25b2bb99d49c3b573d7d323a35425d09a63a48e53b2cc1d616
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.36.0 CPython/3.6.5

Release history Release notifications | RSS feed

This release

0.2.3.19 This release

1 release file

0.2.3.9

1 release file

0.2.3.8

1 release file

0.2.3.7

1 release file

0.2.3.6

1 release file

0.2.3.5

1 release file

0.2.3.4

1 release file

0.2.3.3

1 release file

0.2.3.2

1 release file

0.2.3.1

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.1.19

1 release file

0.1.18

1 release file

0.1.17

1 release file

0.1.16

1 release file

0.1.15

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page