Skip to main content

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

Metadata

Release files for crep 2025.1.8

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

Source distribution (sdist)

Source distribution for crep 2025.1.8
File Size Uploaded
crep-2025.1.8.tar.gz 40.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for crep 2025.1.8
File Interpreter ABI Platform
crep-2025.1.8-py3-none-any.whl Python 3 none any Details

Total release size: 85.1 kB

Release files / crep-2025.1.8.tar.gz

Download URL crep-2025.1.8.tar.gz
Size 40.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e62954c2b0acdf638539bb610ff9e2b949394da97e173d62e0b97e9229b51951
BLAKE2b-256 checksum
How to use checksums
c8815373b6131686db7897bc52246e1729b54666b001b2bc223437105652fc91
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2025.

Transparency log

Release files / crep-2025.1.8-py3-none-any.whl

Download URL crep-2025.1.8-py3-none-any.whl
Size 44.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
435f70b85d7319c57bd1364487ab3b7e2c4b0e6b75dc426391eda43b18c01527
BLAKE2b-256 checksum
How to use checksums
32827b3f0ab452288c29e2368a7b9af8dfb561fde4c9fa892eb54ec7d79dd273
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 16, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

2025.1.8 This release

2 release files

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