def read_csv_and_convert(path, shuffle=False, copy_index=True, **kwargs):
from concurrent.futures import ProcessPoolExecutor<EOL>import pandas as pd<EOL>filenames = glob.glob(path)<EOL>if len(filenames) > <NUM_LIT:1>:<EOL><INDENT>filename_hdf5 = _convert_name(filenames, shuffle=shuffle)<EOL>filename_hdf5_noshuffle = _convert_name(filenames, shuffle=False)<EOL>if not os.path.exists(filename_hdf5):<EOL><INDENT>if not os.path.exists(filename_hdf5_noshuffle):<EOL><INDENT>for filename in filenames:<EOL><INDENT>read_csv_and_convert(filename, shuffle=shuffle, copy_index=copy_index, **kwargs)<EOL><DEDENT>ds = open_many([_convert_name(k, shuffle=shuffle) for k in filenames])<EOL><DEDENT>else:<EOL><INDENT>ds = open(filename_hdf5_noshuffle)<EOL><DEDENT>ds.export_hdf5(filename_hdf5, shuffle=shuffle)<EOL><DEDENT>return open(filename_hdf5)<EOL><DEDENT>else:<EOL><INDENT>filename = filenames[<NUM_LIT:0>]<EOL>filename_hdf5 = _convert_name(filename, shuffle=shuffle)<EOL>filename_hdf5_noshuffle = _convert_name(filename, shuffle=False)<EOL>if not os.path.exists(filename_hdf5):<EOL><INDENT>if not os.path.exists(filename_hdf5_noshuffle):<EOL><INDENT>df = pd.read_csv(filename, **kwargs)<EOL>ds = from_pandas(df, copy_index=copy_index)<EOL><DEDENT>else:<EOL><INDENT>ds = open(filename_hdf5_noshuffle)<EOL><DEDENT>ds.export_hdf5(filename_hdf5, shuffle=shuffle)<EOL><DEDENT>return open(filename_hdf5)<EOL><DEDENT>
Convert a path (or glob pattern) to a single hdf5 file, will open the hdf5 file if exists.

    Example:
            >>> vaex.read_csv_and_convert('test-*.csv', shuffle=True)  # this may take a while
            >>> vaex.read_csv_and_convert('test-*.csv', shuffle=True)  # 2nd time it is instant

    :param str path: path of file or glob pattern for multiple files
    :param bool shuffle: shuffle DataFrame when converting to hdf5
    :param bool copy_index: by default pandas will create an index (row number), set to false if you want to drop that
    :param kwargs: parameters passed to pandas' read_cvs