Mock Tool




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

Bus Ridership Prediction Tool

Our tool does cool predictive statistics stuff.

Thanks to the following groups for making this work possible:

{ a : income ? Specify the income level } { a_select : Borough ? Choose your borough } { a_text : Some Text } { a_table ? Thanks! }

In [1]:
"""
Specify your input arguments in the first code cell

- Add a comment with the word CrossCompute in the first code cell to indicate that your notebook defines a tool
- Do not put import statements
- 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)
"""
# CrossCompute
a = 50000
a_select = """
    Queens

    Queens
    Bronx
    Manhattan
    Brooklyn
    Staten Island
"""
#a_text_path = 'example.csv'
#a_table_path = 'example.csv'
# Note that target_folder is a special argument and must be spelled exactly
target_folder = '/tmp'
In [2]:
"""
Print output properties in any code cell to render them on the result page
- To render a value, use y = 1
- To render a text file saved in target_folder, use y_text_path = target_folder + '/y.txt'
- To render a table file saved in target_folder, use y_table_path = target_folder + '/y.csv'
Press the Red Button to deploy your tool on the CrossCompute website
"""
#print('variable_names_must_not_have_spaces = %s' % (a + 1))
#print('selected_fruits = %s' % ' '.join(a_select.splitlines()))
Out[2]:
"\nPrint output properties in any code cell to render them on the result page\n- To render a value, use y = 1\n- To render a text file saved in target_folder, use y_text_path = target_folder + '/y.txt'\n- To render a table file saved in target_folder, use y_table_path = target_folder + '/y.csv'\nPress the Red Button to deploy your tool on the CrossCompute website\n"
In [ ]:
# Press CTRL-ENTER to run a code cell
# 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

import pandas as pd
# Load table
a_table = pd.read_csv(a_table_path)
a_table[:2]
In [ ]:
# from geotable import GeoTable
# a_geotable = GeoTable.load(a_geotable_path)
# a_geotable.draw()
In [ ]:
# Save your output files in target_folder
%matplotlib inline
target_path = target_folder + '/plot.png'
figure = ax.get_figure()
figure.savefig(target_path)
or
target_path = target_folder + '/map.csv'
a_table.to_csv(target_path, index=False)
In [ ]:
# Output render options
# Render the file as an image
print('abcdef_image_path = %s' % target_path)
# Render the file as a text
print('abcdef_text_path = %s' % target_path)
# Render the file as a table
print('abcdef_table_path = %s' % target_path)
# Render the file as a geotable
print('abcdef_geotable_path = %s' % target_path)
In [ ]:
# Specify colors
table_with_fill_color = a_table.copy()
table_with_fill_color['FillColor'] = [
    'r',
    'b',
    '#ff565f',
    'purple',
]
target_path = target_folder + '/map-with-fill-color.csv'
table_with_fill_color.to_csv(target_path, index=False)
print('abcdef_geotable_path = %s' % target_path)
In [ ]:
# Assign shades of red based on value
table_with_fill_reds = a_table.copy()
table_with_fill_reds['FillReds'] = a_table['Level']
target_path = target_folder + '/map-with-fill-reds.csv'
table_with_fill_reds.to_csv(target_path, index=False)
print('abcdef_geotable_path = %s' % target_path)
In [ ]:
print('abcdef_satellite_geotable_path = %s' % target_path)

Prediction Results (optional)

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

  • Omit the path suffix when configuring output properties.

{ variable_names_must_not_have_spaces : X ? Hmm }

{ selected_fruits : Selected Fruits }

{ abcdef_image : An Image }

{ abcdef_text : Some Text }

{ abcdef_table : A Table }

{ abcdef_geotable : A Map }

Learn how to render different data types.

Click here to see a list of supported data types.

In [ ]: