Skip to main content

No project description provided

Project description

Tabular data processing for Continuous REPresentation

pytest code coverage Publish on Pypi

pip install crep

This simple module aims at providing some function to tackle tabular data that have a continuous axis. In situations, this index can represent time, but this tool was originally developed to tackle rail way description.

This simple tools helps providing tools to represent a linear structure (cable, rail, beam, pipe) whose characteristics are piece-wize constant (of strongly heterogeneous length)

Basic usage

  • Merge function merge together two dataframe
import pandas as pd

from crep import merge


df_left = pd.DataFrame(
    dict(id=[2, 2, 2],
         t1=[0, 100, 120],
         t2=[100, 120, 130],
         data1=[0.2, 0.1, 0.5])
)
df_right = pd.DataFrame(
    dict(id=[2, 2, 2],
         t1=[0, 80, 100],
         t2=[70, 100, 140],
         data2=[0.1, 0.3, 0.2])
)

ret = merge(data_left=df_left,
            data_right=df_right,
            id_continuous=["t1", "t2"],
            id_discrete=["id"],
            how="outer")

Yield the following result

drawing

Tools

Test if your data is admissible to the merge function, you can use the tools module

import pandas as pd

from crep import tools


df_admissible = pd.DataFrame(
    dict(id=[2, 2, 2],
         t1=[0, 100, 120],
         t2=[100, 120, 130],
         data1=[0.2, 0.1, 0.5])
)
df_not_admissible = pd.DataFrame(
    dict(id=[2, 2, 2],
         t1=[0, 90, 120],
         t2=[100, 120, 130],
         data1=[0.2, 0.1, 0.5])
)
# the second table is not admissible because for t in [90,100] two values are possible

assert tools.admissible_dataframe(
    df_admissible, id_continuous=["t1", "t2"],
    id_discrete=["id"])
assert not tools.admissible_dataframe(
    df_not_admissible, id_continuous=["t1", "t2"],
    id_discrete=["id"])
print(tools.sample_non_admissible_data(
    df_not_admissible, id_continuous=["t1", "t2"],
    id_discrete=["id"]
))
# id  t1   t2  data1
# 1   2  90  120    0.1

Acknowledgement

This implementation come from an SNCF DTIPG project and is developed and maintained by Mews Labs and SNCF DTIPG.

drawing drawing

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

crep-2025.1.6.tar.gz (40.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

crep-2025.1.6-py3-none-any.whl (43.9 kB view details)

Uploaded Python 3

File details

Details for the file crep-2025.1.6.tar.gz.

File metadata

  • Download URL: crep-2025.1.6.tar.gz
  • Upload date:
  • Size: 40.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for crep-2025.1.6.tar.gz
Algorithm Hash digest
SHA256 363f064ffd39d2b5ee29252cb6ad181f0e2cb5fa2e86b2709d5d5a32bd2f6c4f
MD5 05c73ffd99a41b7d1760b7f617fd074d
BLAKE2b-256 c394aa9e0406bd1b197269783b933405c2385e6b8b6c05987d8089431d4c908e

See more details on using hashes here.

Provenance

The following attestation bundles were made for crep-2025.1.6.tar.gz:

Publisher: publish.yml on eurobios-mews-labs/crep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file crep-2025.1.6-py3-none-any.whl.

File metadata

  • Download URL: crep-2025.1.6-py3-none-any.whl
  • Upload date:
  • Size: 43.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for crep-2025.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 eb1b242bd18af75d016dffe6e9ad682e22cbe5a64f4e98bbef8cae9f2a1e4c12
MD5 a0c7320c795644138dd17b3a418caa3c
BLAKE2b-256 fa98b8076e3cd89aa6de18db9d226171682302c74d71fa8b70d94a518549c20f

See more details on using hashes here.

Provenance

The following attestation bundles were made for crep-2025.1.6-py3-none-any.whl:

Publisher: publish.yml on eurobios-mews-labs/crep

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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