Metadata-Version: 2.1
Name: SplitMerge
Version: 0.0.1.post1
Summary: Split & Merge utilities for large csv files.
Home-page: https://github.com/SatyakiDe2019/SplitMerge
Author: Satyaki De
Author-email: satyaki.de@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown

# 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

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 - addr_det_20190101.csv
> Your split file name will will be given below: 
> 	1__addr_det_20180112__splitted_.csv
> 	2__addr_det_20180112__splitted_.csv
> 	N__addr_det_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.

This requires pandas & regular expression package installed in your python environment.

Sample Code to use this library. You can name it as -> 

--------------------------------------------------------------------------------------
                         callSplitMergeFiles.py
--------------------------------------------------------------------------------------

    import clsSplitFiles as t
    import clsMergeFiles as cm
    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                                 ######
        ###############################################################

        x = t.clsSplitFiles(srcF, path, subdir)

        ret_val = x.split_files()

        if ret_val == 0:
            print("Splitting Successful!")
        else:
            print("Splitting Failure!")

        print("-"*30)

        print("Finally, Merging small splitted files to make the same big file!")

        y = cm.clsMergeFiles(srcFileInit)

        ret_val1 = y.merge_file()

        if ret_val1 == 0:
            print("Merge Successful!")
        else:
            print("Merge Failure!")

        print("-"*30)



    if __name__ == "__main__":
        main()

--------------------------------------------------------------------------------------
                 End Of Sample Code - callSplitMergeFiles.py
--------------------------------------------------------------------------------------

