agate icon indicating copy to clipboard operation
agate copied to clipboard

Customize file extensions for globbing csv and json TableSets

Open cowsandmilk opened this issue 9 years ago • 3 comments

I have directories of csv files with different suffixes (a common example would be .tsv , but there are others as well). This allows the user to specify a suffix).

I have some personal use cases where the suffix would be '_foo.txt' and I would like the whole '_foo.txt' striped off, which explains why I have the default arg of '.csv' rather than 'csv' without the period.

cowsandmilk avatar Jan 11 '17 18:01 cowsandmilk

I like this idea, but I think it might be cleaner to just allow an array as the path argument. Then you could use glob:

from glob import glob

TableSet.from_csv(glob('*.tsv'))

This would also allow for providing arbitrary lists of files, which could be useful for nested directory structures.

Thoughts?

onyxfish avatar Jan 11 '17 21:01 onyxfish

I like that if I'm able to optionally pass an array of table names as well. If no table names are passed, then it would use os.path.splitext to come up with table names?

cowsandmilk avatar Jan 12 '17 16:01 cowsandmilk

@cowsandmilk Yes, I think that behavior makes sense.

jpmckinney avatar Jul 14 '21 20:07 jpmckinney

Closing as abandoned. Feel free to open an issue.

jpmckinney avatar Apr 27 '24 22:04 jpmckinney