mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-12-23 05:07:54 +00:00
python: process result files after metadata type inference.
This commit is contained in:
parent
b2f8450bf3
commit
ed669630c6
|
@ -101,9 +101,6 @@ def load(_dir, _process=None, _format=None, _stream='stdout',
|
|||
|
||||
# Create a DataFrame from the matches.
|
||||
df = pd.DataFrame(matches)
|
||||
if _process and not df.empty:
|
||||
df['res'] = df.resfile.apply(_process)
|
||||
df = df.drop('resfile', axis=1)
|
||||
|
||||
# Optionally try to convert string argument values to numeric types.
|
||||
if _infer_types:
|
||||
|
@ -111,6 +108,13 @@ def load(_dir, _process=None, _format=None, _stream='stdout',
|
|||
df.to_csv(buf)
|
||||
df = pd.read_csv(StringIO(buf.getvalue()), index_col=0)
|
||||
|
||||
# Open and process the results. This needs to happen after the type
|
||||
# infererence phase since the processed results can be arbitrary
|
||||
# Python objects and might not survive the round-trip.
|
||||
if _process and not df.empty:
|
||||
df['res'] = df.resfile.apply(_process)
|
||||
df = df.drop('resfile', axis=1)
|
||||
|
||||
return df
|
||||
|
||||
def _parse_name(file, sep='\t'):
|
||||
|
|
Loading…
Reference in a new issue