Split-Merge Package
Splitting a large CSV file into multiple small csv files for better processing using Split features at your local disk & Merge will merge back to small files into one large file. This is a first sample version.
Limitations
Split
As of now, this will create splitted file with the extension known as "splitted". Make sure that your original file should not contain the same naming pattern.
Your source file name for example - customer_addr_20180112.csv
Your split file name will will be given below:
1__customer_addr_20180112__splitted_.csv
2__customer_addr_20180112__splitted_.csv
....
N__customer_addr_20180112__splitted_.csv
Where N would be any number based on the size of the file. Bye default, each chunk will contain at least 30000 or less number of records.
Merge
For merge, it will pick-up from the temp directory as mentioned in the bottom of this page. And, it will create a final merged file with this kind of naming convention -
customer_addr_20180112_.csv
Final, file will be places under process directory. Please refer the bottom of this page for directory structure & placement of the main calling file.
This package requires pandas & regular expression package to be installed in your python environment.
Sample Code to use this library. You can name it as ->
callSplitMergeFiles.py
from SplitMerge.clsSplitFiles import clsSplitFiles
from SplitMerge.clsMergeFiles import clsMergeFiles
import re
import platform as pl
import os
def main():
print("Calling the custom Package for large file splitting..")
os_det = pl.system()
print("Running on :", os_det)
###############################################################
###### User Input based on Windows OS ########
###############################################################
srcF = str(input("Please enter the file name with extension:"))
base_name = re.sub(r'[0-9]','', srcF)
srcFileInit = base_name[:-5]
if os_det == "Windows":
subdir = "\\temp\\"
path = os.path.dirname(os.path.realpath(__file__)) + "\\"
else:
subdir = "/temp/"
path = os.path.dirname(os.path.realpath(__file__)) + '/'
###############################################################
###### End Of User Input ######
###############################################################
###############################################################
###### Begining of Split Process ######
###############################################################
t = clsSplitFiles(srcF, path, subdir)
ret_val = t.split_files()
if ret_val == 0:
print("Splitting Successful!")
else:
print("Splitting Failure!")
print("-"*30)
###############################################################
###### End of Split Process ######
###############################################################
print("Finally, Merging small splitted files to make the same big file!")
###############################################################
###### Begining of Merge Process ######
###############################################################
y = clsMergeFiles(srcFileInit, path)
ret_val1 = y.merge_file()
if ret_val1 == 0:
print("Merge Successful!")
else:
print("Merge Failure!")
print("-"*30)
###############################################################
###### End of Merge Process ######
###############################################################
if __name__ == "__main__":
main()
End Of Sample Code - callSplitMergeFiles.py
Bug Fix: 1. Module loading issue fixed. 2. Source & Target directory as per developer's choice. Dependancy Package: You need to install followig packages in order to run this package -
pip install pandas pip install regex
Directory Structure shoould be like ->
-> \callSplitMergeFiles.py
-> \process\
-> \src_file\
-> \temp\
Metadata
Release files for SplitMerge 0.0.2.post3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| SplitMerge-0.0.2.post3.tar.gz | 4.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| SplitMerge-0.0.2.post3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.1 kB
Release files / SplitMerge-0.0.2.post3.tar.gz
| Download URL | SplitMerge-0.0.2.post3.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b36a1e92b7409c6b36f7b50cf1f5be5b9b2a04537778b8b8347fbcc71ee8c44d
|
|
BLAKE2b-256 checksum How to use checksums |
ca2d001581b0b1d0b30256042e02440a20cd635553af81983f893000d35e3c05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2
|
Release files / SplitMerge-0.0.2.post3-py3-none-any.whl
| Download URL | SplitMerge-0.0.2.post3-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3084641076ba698491cb004e8d94654a65e65c7fa28823f79b3ce39d5cfafa81
|
|
BLAKE2b-256 checksum How to use checksums |
0e46cf57068194cca6ced34d09072fdf2fca98f4a1876ec37267b1bb4ed94da1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.6.3 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.2
|
Security for SplitMerge 0.0.2.post3
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.