Spaces:
Running
Running
Raine Hoang
commited on
Commit
·
56227e8
1
Parent(s):
374050a
moved imports, hyperlink author, error handling
Browse files- polars/02_dataframes.py +20 -14
polars/02_dataframes.py
CHANGED
@@ -10,17 +10,8 @@
|
|
10 |
|
11 |
import marimo
|
12 |
|
13 |
-
__generated_with = "0.13.
|
14 |
-
app = marimo.App(
|
15 |
-
|
16 |
-
|
17 |
-
@app.cell
|
18 |
-
def _():
|
19 |
-
import marimo as mo
|
20 |
-
import polars as pl
|
21 |
-
import numpy as np
|
22 |
-
import pandas as pd
|
23 |
-
return mo, np, pd, pl
|
24 |
|
25 |
|
26 |
@app.cell(hide_code=True)
|
@@ -28,7 +19,7 @@ def _(mo):
|
|
28 |
mo.md(
|
29 |
r"""
|
30 |
# DataFrames
|
31 |
-
Author: Raine Hoang
|
32 |
|
33 |
In this tutorial, we will go over the central data structure for structured data, DataFrames. There are a multitude of packages that work with DataFrames, but we will be focusing on the way Polars uses them the different options it provides.
|
34 |
|
@@ -378,7 +369,10 @@ def _(mo):
|
|
378 |
|
379 |
@app.cell
|
380 |
def _(pl, seq_data):
|
381 |
-
|
|
|
|
|
|
|
382 |
return
|
383 |
|
384 |
|
@@ -410,7 +404,10 @@ def _(mo):
|
|
410 |
def _(pl):
|
411 |
data = [[1, "a", 2]]
|
412 |
|
413 |
-
|
|
|
|
|
|
|
414 |
return
|
415 |
|
416 |
|
@@ -510,5 +507,14 @@ def _(mo):
|
|
510 |
return
|
511 |
|
512 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
513 |
if __name__ == "__main__":
|
514 |
app.run()
|
|
|
10 |
|
11 |
import marimo
|
12 |
|
13 |
+
__generated_with = "0.13.10"
|
14 |
+
app = marimo.App()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
|
17 |
@app.cell(hide_code=True)
|
|
|
19 |
mo.md(
|
20 |
r"""
|
21 |
# DataFrames
|
22 |
+
Author: [*Raine Hoang*](https://github.com/Jystine)
|
23 |
|
24 |
In this tutorial, we will go over the central data structure for structured data, DataFrames. There are a multitude of packages that work with DataFrames, but we will be focusing on the way Polars uses them the different options it provides.
|
25 |
|
|
|
369 |
|
370 |
@app.cell
|
371 |
def _(pl, seq_data):
|
372 |
+
try:
|
373 |
+
pl.DataFrame(seq_data, schema_overrides = {"column_0": pl.String})
|
374 |
+
except Exception as e:
|
375 |
+
print(f"Error: {e}")
|
376 |
return
|
377 |
|
378 |
|
|
|
404 |
def _(pl):
|
405 |
data = [[1, "a", 2]]
|
406 |
|
407 |
+
try:
|
408 |
+
pl.DataFrame(data = data, strict = True)
|
409 |
+
except Exception as e:
|
410 |
+
print(f"Error: {e}")
|
411 |
return
|
412 |
|
413 |
|
|
|
507 |
return
|
508 |
|
509 |
|
510 |
+
@app.cell
|
511 |
+
def _():
|
512 |
+
import marimo as mo
|
513 |
+
import polars as pl
|
514 |
+
import numpy as np
|
515 |
+
import pandas as pd
|
516 |
+
return mo, np, pd, pl
|
517 |
+
|
518 |
+
|
519 |
if __name__ == "__main__":
|
520 |
app.run()
|