Skip to main content

Group of utilities for Sabia

Project description

Sabia Utils

This is a collection of utilities for Sabia.

Concat Module

This module is used to concatenate files.

Concatenate all files from a path

  • Returns a concatenated dataframe from all files in a path.
  • Can save the concatenated dataframe to a file.
from sabia_utils import concat

concat.concatenate_all_from_path(
    path='path\\to\\files',
    output_file='output\\file\\path', # optional
    fine_name='file_name'           # optional 
)

Concatenate some files from a path

  • Returns a concatenated dataframe from some files in a path.
  • Can save the concatenated dataframe to a file.
from sabia_utils import concat

concat.concatenate_files(
    path='path\\to\\files',
    files=['file1', 'file2'],
    output_file='output\\file\\path', # optional
    fine_name='file_name'           # optional 
)

Copy files from a path to another

  • Verify if the files exist in the path before copy.
from sabia_utils import group

group.copy_new_files(
    PATH_IN='path\\to\\files1',
    PATH_OUT='path\\to\\files2'
)

Group Module

This module is used to group files.

Process files in both paths

  • Verify if the files exist in the path before process.
from sabia_utils import group

group.process_existent_files(
    PATH_IN='path\\to\\files1',
    PATH_OUT='path\\to\\files2'
)

Process all files

  • apply the function of copy and process files between the paths.
from sabia_utils import group

group.process_all_files(
    PATH_IN='path\\to\\files1',
    PATH_OUT='path\\to\\files2'
)

Pre_process Module

This module is used to pre_process parquet files.

Process all parquet files

  • Define a class that inherit sabia_utils.pre_process.Processing

  • Override method apply_to_df(self, df, column), defining the pre-processing to be applied

  • Apply this function on a folder containing parquet files to process them.

from sabia_utils.pre_process import Processing
from sabia_utils import pre_process

class MyProcessor(Processing):
    def apply_to_df(self, df, column): 
        # Your pre-processing steps

pre_process.pre_process_parquets(
    folder_path='path\\to\\folder',
    colomun_to_pre_process='column_name_to_be_processed',
    pre_processed_column='processed_column_name',
    processor=MyProcessor()
)

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

sabia-utils-0.2.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

sabia_utils-0.2.0-py3-none-any.whl (12.9 kB view details)

Uploaded Python 3

File details

Details for the file sabia-utils-0.2.0.tar.gz.

File metadata

  • Download URL: sabia-utils-0.2.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for sabia-utils-0.2.0.tar.gz
Algorithm Hash digest
SHA256 f994cfd1ca250d0a82b4e7cd35915dfcc607da96486e5bfc2633c77f0a0b5b77
MD5 713b69d0ae209906db4885e8312fa142
BLAKE2b-256 30681fea725967184c6f722b6316bb891fadb0248388834441991b05293ab689

See more details on using hashes here.

File details

Details for the file sabia_utils-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: sabia_utils-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 12.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for sabia_utils-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b09f1c3e3fffaa103fa581291fc6a8ce784b7176f0d78d50d5325db4389a909d
MD5 6c471cb2e348633944a6e862e8532a61
BLAKE2b-256 aeb48df09b46837a86370213d685c7b1fe7f3c3ed3891fbabca4d1e7dec0dc14

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