loadany#

loadany(filename, folder=None, verbose=False, **kwargs)[source]#

Load data from a file using all known load functions until one works.

Known formats are: pickle, JSON, YAML, Excel, CSV, zip, or plain text.

Parameters:
  • filename (str/path) – the name of the file to load

  • folder (str) – optional additional folder for the filename

  • verbose (bool) – print out the details of the process (verbose=2 to show errors)

  • kwargs (dict) – passed to the load function

Example:

data = sc.odict()
datafiles = ['headers.json', 'some-data.csv', 'more-data.xlsx', 'final-data.obj']
for datafile in datafiles:
    data[datafile] = sc.loadany(datafile)
New in version 3.2.0.