myimagelib.myImageLib.readdata¶
- myimagelib.myImageLib.readdata(folder, ext='csv', mode='i')¶
Wrapper of
dirrec()
, but easier to use when reading one type of files in a given folder. Instead of returning a list of directories asdirrec()
does,readdata()
puts the file names and corresponding full directories in apandas.DataFrame
. The table will be sorted by the file names (strings), so the order would likely be correct. In the worst case, it is still easier to resort thepandas.DataFrame
, compared to the list of strings returned bydirrec()
.- Parameters
folder (str) – the folder to read files from
ext (str) – optional param, default to “csv”, specifies the extension of files to be read
mode (str) – “i” for immediate, “r” for recursive. Default to “i”
- Returns
a 2-column table containing file names and the corresponding full directories
- Return type
pandas.DataFrame
EDIT
- 11152022
Add mode optional argument, to specify whether to read data only in the immediate folder, or read recursively.