Skip to main content

Library to handle PC-Axis data in python using pandas DataFrames.

Project description

pyaxis is a python library for PC-Axis (or PX) formatted data manipulation which allows reading and writing PC-Axis [1] format with python, using the DataFrame structures provided by the widely accepted pandas library [2]. PX is a standard format for statistical files used by a large number of statistical offices (Spain, Switzerland, Sweden). A package of software has been developed for this format: PX-Win, PX-Web and PX-Edit. pyaxis eases reading and parsing of PX files data and metadata into a pandas Dataframe and a dict structure, allowing their manipulation in a tabular and pythonic manner. It supports both monolingual and multilingual PX files. The package was initially developped by the [Instituto Cántabro de Estadistica](https://www.icane.es) and is now jointly maintained by ICANE and the [Swiss Data Science Center](https://datascience.ch). pyaxis is provided under the Apache License 2.0.

Installation

For installation:

pip install pyaxis

Usage

From PX to pandas DataFrame

Typical usage often looks like this:

from pyaxis import pyaxis

EXAMPLE_URL = 'https://www.ine.es/jaxiT3/files/t/es/px/2184.px'

px = pyaxis.parse(EXAMPLE_URL, encoding='ISO-8859-2')
print(px['DATA'])
print(px['METADATA'])

For Multilingual PX files

Typical usage often looks like this:

from pyaxis import pyaxis

EXAMPLE_URL = 'https://www.pxweb.bfs.admin.ch/DownloadFile.aspx?file=px-x-0602000000_107'

# Swiss PX files are in German(de), French(fr), Italian(it), and English(en)
px = pyaxis.parse(EXAMPLE_URL, encoding='ISO-8859-2', lang='fr')
print(px['DATA'])
print(px['METADATA'])
print(px['TRANSLATION'])

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

pyaxis-0.4.2.tar.gz (239.4 kB view details)

Uploaded Source

File details

Details for the file pyaxis-0.4.2.tar.gz.

File metadata

  • Download URL: pyaxis-0.4.2.tar.gz
  • Upload date:
  • Size: 239.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.10

File hashes

Hashes for pyaxis-0.4.2.tar.gz
Algorithm Hash digest
SHA256 370fb5c8e9d4946615a421aaf1f10b4ed90476a491223e5674d743d34da5d4b5
MD5 b0c1098d6596b4fb99dc81da898487d6
BLAKE2b-256 bac3659d3d6a1d918847a5fc9921a4416ef78ce6575039e91005d024f3112679

See more details on using hashes here.

Supported by

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