def to_arff(dataset, **kwargs):
pods_data = dataset(**kwargs)<EOL>vals = list(kwargs.values())<EOL>for i, v in enumerate(vals):<EOL><INDENT>if isinstance(v, list):<EOL><INDENT>vals[i] = '<STR_LIT:|>'.join(v)<EOL><DEDENT>else:<EOL><INDENT>vals[i] = str(v)<EOL><DEDENT><DEDENT>args = '<STR_LIT:_>'.join(vals)<EOL>n = dataset.__name__<EOL>if len(args)><NUM_LIT:0>:<EOL><INDENT>n += '<STR_LIT:_>' + args<EOL>n = n.replace('<STR_LIT:U+0020>', '<STR_LIT:->')<EOL><DEDENT>ks = pods_data.keys()<EOL>d = None<EOL>if '<STR_LIT:Y>' in ks and '<STR_LIT:X>' in ks: <EOL><INDENT>d = pd.DataFrame(pods_data['<STR_LIT:X>'])<EOL>if '<STR_LIT>' in ks:<EOL><INDENT>d = d.append(pd.DataFrame(pods_data['<STR_LIT>']), ignore_index=True)<EOL><DEDENT>if '<STR_LIT>' in ks:<EOL><INDENT>d.columns = pods_data['<STR_LIT>']<EOL><DEDENT>dy = pd.DataFrame(pods_data['<STR_LIT:Y>'])<EOL>if '<STR_LIT>' in ks:<EOL><INDENT>dy = dy.append(pd.DataFrame(pods_data['<STR_LIT>']), ignore_index=True)<EOL><DEDENT>if '<STR_LIT>' in ks:<EOL><INDENT>dy.columns = pods_data['<STR_LIT>']<EOL><DEDENT>for c in dy.columns:<EOL><INDENT>if c not in d.columns:<EOL><INDENT>d[c] = dy[c]<EOL><DEDENT>else:<EOL><INDENT>d['<STR_LIT:y>'+str(c)] = dy[c]<EOL><DEDENT><DEDENT><DEDENT>elif '<STR_LIT:Y>' in ks:<EOL><INDENT>d = pd.DataFrame(pods_data['<STR_LIT:Y>'])<EOL>if '<STR_LIT>' in ks:<EOL><INDENT>d = d.append(pd.DataFrame(pods_data['<STR_LIT>']), ignore_index=True)<EOL><DEDENT><DEDENT>elif '<STR_LIT:data>' in ks:<EOL><INDENT>d = pd.DataFrame(pods_data['<STR_LIT:data>'])<EOL><DEDENT>if d is not None:<EOL><INDENT>df2arff(d, n, pods_data)<EOL><DEDENT>
Take a pods data set and write it as an ARFF file