Describe your tool in Markdown syntax.
Be sure to give thanks to the people who helped you!
{ x_table : Table of Yummies ? Write tooltips to help your users understand each input argument }
"""
Specify your input arguments in the first code cell
- To accept text, use x_text_path
- To render a table, use x_table_path
- [See other tool notebooks for more data types](https://crosscompute.com/tools)
- Be sure that any files you specify are in the same folder as this notebook
Click the Blue Button to preview this as a CrossCompute tool
"""
a_table_path = 'table.csv' # Define a table as an input argument
target_folder = '/tmp' # Define target_folder as a special argument
# Type your algorithm code here
# Press CTRL-ENTER to run a code cell
import pandas as pd
table = pd.read_csv(a_table_path)
table.iloc[0]
# Press SHIFT-ENTER to run a code cell and move to the next cell
# Press ALT-ENTER to run a code cell and insert a new code cell
row_count = len(table)
row_count
# Press CTRL-SHIFT-HYPHEN to split a cell
# Press ESC-h to see more keyboard shortcuts
lines = []
line_template = '{count} {units} of {description} at ${unit_price:.2f} each'
for index, row in table.iterrows():
lines.append(line_template.format(**row))
lines
# Save your output files in target_folder to make them available for download
# Note that target_folder is a special argument and must be spelled exactly
from os.path import join
y_text_path = join(target_folder, 'summary.txt')
open(y_text_path, 'wt').write('\n'.join(lines))
y_text_path
"""
Print output properties in any code cell to render them in the result
- To render a value, use y = 1
- To render text, use y_text_path = join(target_folder, 'y.txt')
- To render a table, use y_table_path = join(target_folder, 'y.csv')
- [See other tool notebooks for more data types](https://crosscompute.com/tools)
Press the Red Button to deploy your tool on the CrossCompute website
"""
print('row_count = %s' % row_count)
print('summary_text_path = %s' % y_text_path)
You can use this space to specify links to more information.
{ row_count : Number of Rows ? Note that you do not need to specify each output property for it to render }
{ summary_text : Summary }