{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Writing data/solar_events.csv\n" ] } ], "source": [ "%%writefile data/solar_events.csv\n", "timestamp,event\n", "2021-03-20 09:37:00,March Equinox\n", "2021-06-21 03:32:00,June Solstice\n", "2021-09-22 19:21:00,September Equinox\n", "2021-12-21 15:59:00,December Solstice" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Interactive Beam" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Pandas has the pandas.read_csv function to easily read CSV files into DataFrames. Beam has the beam.dataframe.io.read_csv function that emulates pandas.read_csv, but returns a deferred Beam DataFrame.\n", "\n", "If you’re using Interactive Beam, you can use collect to bring a Beam DataFrame into local memory as a Pandas DataFrame." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "application/javascript": "\n if (typeof window.interactive_beam_jquery == 'undefined') {\n var jqueryScript = document.createElement('script');\n jqueryScript.src = 'https://code.jquery.com/jquery-3.4.1.slim.min.js';\n jqueryScript.type = 'text/javascript';\n jqueryScript.onload = function() {\n var datatableScript = document.createElement('script');\n datatableScript.src = 'https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js';\n datatableScript.type = 'text/javascript';\n datatableScript.onload = function() {\n window.interactive_beam_jquery = jQuery.noConflict(true);\n window.interactive_beam_jquery(document).ready(function($){\n \n });\n }\n document.head.appendChild(datatableScript);\n };\n document.head.appendChild(jqueryScript);\n } else {\n window.interactive_beam_jquery(document).ready(function($){\n \n });\n }" }, "metadata": {}, "output_type": "display_data" }, { "data": { "text/html": [ "\n", " \n", "
| \n", " | timestamp | \n", "event | \n", "
|---|---|---|
| 0 | \n", "2021-03-20 09:37:00 | \n", "March Equinox | \n", "
| 1 | \n", "2021-06-21 03:32:00 | \n", "June Solstice | \n", "
| 2 | \n", "2021-09-22 19:21:00 | \n", "September Equinox | \n", "
| 3 | \n", "2021-12-21 15:59:00 | \n", "December Solstice | \n", "