Created
October 1, 2018 17:34
-
-
Save usmcamp0811/bc1c142d8a1ae2a66b14455579bf868a to your computer and use it in GitHub Desktop.
concat two or more ctables along the 0 axis.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def ctable_append(cts): | |
""" | |
A function to append multiple ctables and clean up the disk entries along the 0 axis | |
similar to pd.concat([df1, df2], axis=0) | |
:param cts: a string containing the root directory path or a list of ctables | |
:return: ctable | |
""" | |
import shutil | |
ctables = [] | |
first = True | |
# check if we are getting a list or a root dir | |
if type(cts) == str: | |
cts = bcolz.walk(cts) | |
for ct in cts: | |
if first is True: | |
ct1 = ct | |
else: | |
ct1.append(ct) | |
shutil.rmtree(ct.rootdir) | |
first = False | |
return ct1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment