@baker.command(name='<STR_LIT>',<EOL>params={"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": "<STR_LIT>",<EOL>"<STR_LIT>": """<STR_LIT>""",<EOL>"<STR_LIT>": """<STR_LIT>"""},<EOL>shortopts={'<STR_LIT>': '<STR_LIT:i>', '<STR_LIT>': '<STR_LIT:o>', <EOL>'<STR_LIT>': '<STR_LIT:m>', '<STR_LIT>': '<STR_LIT:t>'})<EOL>def convert_sav(inputfile, outputfile=None, method='<STR_LIT>', otype='<STR_LIT>'):
assert(os.path.isfile(inputfile))<EOL>assert(method=='<STR_LIT>' or method=='<STR_LIT>')<EOL>if method == '<STR_LIT>':<EOL><INDENT>df = sav_to_pandas_rpy2(inputfile)<EOL><DEDENT>elif method == '<STR_LIT>':<EOL><INDENT>df = sav_to_pandas_savreader(inputfile)<EOL><DEDENT>otype_exts = {'<STR_LIT>': '<STR_LIT>', <EOL>'<STR_LIT>': '<STR_LIT>', <EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT:html>': '<STR_LIT>'}<EOL>if outputfile is None:<EOL><INDENT>outputfile = inputfile.replace(path(inputfile).ext, '<STR_LIT>')<EOL><DEDENT>outputfile = add_extension_if_needed(outputfile, otype_exts[otype])<EOL>if otype == '<STR_LIT>':<EOL><INDENT>df.to_csv(outputfile)<EOL><DEDENT>elif otype == '<STR_LIT>':<EOL><INDENT>df.to_hdf(outputfile, os.path.basename(outputfile))<EOL><DEDENT>elif otype == '<STR_LIT>':<EOL><INDENT>df.to_stata(outputfile)<EOL><DEDENT>elif otype == '<STR_LIT>':<EOL><INDENT>df.to_json(outputfile)<EOL><DEDENT>elif otype == '<STR_LIT>':<EOL><INDENT>df.to_pickle(outputfile)<EOL><DEDENT>elif otype == '<STR_LIT>':<EOL><INDENT>df.to_excel(outputfile)<EOL><DEDENT>elif otype == '<STR_LIT:html>':<EOL><INDENT>df.to_html(outputfile)<EOL><DEDENT>else:<EOL><INDENT>df.to_csv(outputfile)<EOL><DEDENT>
Transforms the input .sav SPSS file into other format.
    If you don't specify an outputfile, it will use the
    inputfile and change its extension to .csv