Mercurial > repos > jjohnson > pandas_pivot_table
changeset 2:6f05390deffa draft
"planemo upload for repository https://github.com/jj-umn/galaxytools/tree/master/pandas_pivot_table/ commit 1ca7433aaa606c636f796c75b6cfd8a080e2d5bc-dirty"
author | jjohnson |
---|---|
date | Wed, 16 Dec 2020 17:44:58 +0000 |
parents | c02f59711eb6 |
children | 4b65133e0722 |
files | pandas_pivot_table.py pandas_pivot_table.xml |
diffstat | 2 files changed, 36 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/pandas_pivot_table.py Wed Dec 16 16:13:51 2020 +0000 +++ b/pandas_pivot_table.py Wed Dec 16 17:44:58 2020 +0000 @@ -58,6 +58,11 @@ default=None, help='fill value for missing values' ) + p.add_argument( + '-f', '--float_format', + default='%0.6f', + help='' + ) args = p.parse_args() def getValueType(val): @@ -128,7 +133,10 @@ fill_value=fill_value) pdf_cols = ['_'.join(reversed(p)) if isinstance(p, tuple) else p for p in pdf.columns.tolist()] - pdf.to_csv(args.output, sep='\t', float_format='%0.6f', header=pdf_cols) + pdf.to_csv(args.output, + sep='\t', + float_format=args.float_format, + header=pdf_cols) if __name__ == "__main__":
--- a/pandas_pivot_table.xml Wed Dec 16 16:13:51 2020 +0000 +++ b/pandas_pivot_table.xml Wed Dec 16 17:44:58 2020 +0000 @@ -20,6 +20,12 @@ --columns '$pvt_columns' --values '$pvt_values' --aggfunc='$aggfunc' + #if $fill_value + --fill_value '$fill_value' + #end if + #if $float_format + --float_format '$float_format' + #end if --input '$input' --output '$output' ]]></command> @@ -58,9 +64,10 @@ <ul> <li>A single function applied to each <i>value</i> column: <b>"min"</b></li> <li>An array of functions applied to each <i>value</i> column: <b>["min", "max", "mean", "std"]</b></li> - <li>A dictionary of <i>value column : functions</i>: <b>{"A" : "sum", "B" : ["min", "max"]}</b></li> + <li>A dictionary of <i>value column : function(s)</i>: <b>{"A" : "sum", "B" : ["min", "max"]}</b></li> </ul> ]]></help> + <validator type="regex" message="Do not forget the double quotes">.*".+".*</validator> <sanitizer> <valid initial="string.printable"> <remove value="'"/> @@ -70,6 +77,25 @@ </mapping> </sanitizer> </param> + <param name="fill_value" type="text" value="" optional="true" label="Fill value (optional)" + help="Value to replace missing values with (in the resulting pivot table, after aggregation) default is an empty field"/> + <param name="float_format" type="text" value="" optional="true" label="Output floating point format (optional)"> + <help>Default is six decimal places: %0.6f</help> + <validator type="regex" message="">^%\d+.\d+[fFeEgGn]$</validator> + <sanitizer> + <valid initial="string.digits"> + <add value="%" /> + <add value="." /> + <add value="f" /> + <add value="e" /> + <add value="g" /> + <add value="F" /> + <add value="E" /> + <add value="G" /> + <add value="n" /> + </valid> + </sanitizer> + </param> </inputs> <outputs> <data name="output" format="tabular"/>