Skip to main content

No project description provided

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

locuscomplexity-0.2.3.19.tar.gz (11.1 kB view details)

Uploaded Source

File details

Details for the file locuscomplexity-0.2.3.19.tar.gz.

File metadata

  • Download URL: locuscomplexity-0.2.3.19.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for locuscomplexity-0.2.3.19.tar.gz
Algorithm Hash digest
SHA256 d50d0b8915472b209b54f8726de0b82709b36aa455240bd186b865734541da2d
MD5 f32e276531a9b7a7c542dcd258dbb3f1
BLAKE2b-256 b6f57fbcb295ef25b2bb99d49c3b573d7d323a35425d09a63a48e53b2cc1d616

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page