UKO5A




Pay Notebook Creator: Muhammad0
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0
Total0

Type Your Tool Title Here

Describe your tool in Markdown syntax.

Be sure to give thanks to the people who helped you!

  • Specifying a tool template is optional.
  • Specifying input arguments in the tool template is optional.

{ x_table : Table of Yummies ? Write tooltips to help your users understand each input argument }

In [17]:
"""
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
In [ ]:
# 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]
In [ ]:
# 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
In [ ]:
# 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
In [ ]:
# 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
In [ ]:
"""
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)

Type Your Result Title Here

You can use this space to specify links to more information.

  • Specifying a result template is optional.
  • Specifying output properties in the result template is optional.

{ row_count : Number of Rows ? Note that you do not need to specify each output property for it to render }

{ summary_text : Summary }

Learn how to render different data types.

Click here to see a list of supported data types.