Skip to content

Commit 1760ae7

Browse files
Intro_to_Fused: removing_cache_max_age_in_chart (#1966)
Intro_to_Fused: removing_cache_max_age_in_chart Made in [Fused Workbench](https://www.fused.io/workbench) Co-authored-by: max@fused.io <max@fused.io>
1 parent 21d6b0d commit 1760ae7

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

public/Intro_to_Fused/collection.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

public/Intro_to_Fused/note_920a6a1e_bcdb_4610_88c4_5d05c25dae56_57/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"nodeTemplateAlignment": "left",
6464
"nodeTemplateScaleFactor": 2
6565
},
66-
"code": "A UDF can call another\n\nTo chart soem data for example",
66+
"code": "A UDF can call another\n\nTo chart some data for example",
6767
"headers": []
6868
}
6969
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
A UDF can call another
22

3-
To chart soem data for example
3+
To chart some data for example

public/Intro_to_Fused/sf_airbnb_price_chart/meta.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
},
5858
"fused:udfType": "auto"
5959
},
60-
"code": "@fused.udf(cache_max_age=0)\ndef udf():\n import altair as alt\n import pandas as pd\n\n # This loads the previous UDF and calls it\n parent_udf = fused.load('sf_airbnb_listings')\n df = parent_udf(cache_max_age=0)\n print(df.T)\n\n plot_df = df.dropna(subset=['price_in_dollar', 'number_of_reviews'])\n plot_df = plot_df[plot_df['price_in_dollar'] <= 1000]\n plot_df = plot_df[plot_df['number_of_reviews'] > 0]\n\n plot_df = plot_df.sample(n=min(4999, len(plot_df)), random_state=42)\n\n chart = alt.Chart(plot_df).mark_circle(size=200, opacity=0.9).encode(\n x=alt.X('number_of_reviews:Q', title='Number of Reviews'),\n y=alt.Y('price_in_dollar:Q', title='Price ($)'),\n color=alt.Color('room_type:N', title='Room Type'),\n tooltip=['name:N', 'neighbourhood_cleansed:N', 'room_type:N', 'price_in_dollar:Q', 'number_of_reviews:Q']\n ).properties(\n title='SF Airbnb: Price vs Number of Reviews',\n width='container',\n height=700,\n background='white'\n ).configure_title(\n fontSize=28,\n fontWeight='bold'\n ).configure_axis(\n titleFontSize=18,\n labelFontSize=14\n ).configure_legend(\n titleFontSize=16,\n labelFontSize=14\n ).to_html(embed_options={\"renderer\": \"svg\"})\n\n return chart",
60+
"code": "@fused.udf\ndef udf():\n import altair as alt\n import pandas as pd\n\n # This loads the previous UDF and calls it\n parent_udf = fused.load('sf_airbnb_listings')\n df = parent_udf()\n print(df.T)\n\n plot_df = df.dropna(subset=['price_in_dollar', 'number_of_reviews'])\n plot_df = plot_df[plot_df['price_in_dollar'] <= 1000]\n plot_df = plot_df[plot_df['number_of_reviews'] > 0]\n\n plot_df = plot_df.sample(n=min(4999, len(plot_df)), random_state=42)\n\n chart = alt.Chart(plot_df).mark_circle(size=200, opacity=0.9).encode(\n x=alt.X('number_of_reviews:Q', title='Number of Reviews'),\n y=alt.Y('price_in_dollar:Q', title='Price ($)'),\n color=alt.Color('room_type:N', title='Room Type'),\n tooltip=['name:N', 'neighbourhood_cleansed:N', 'room_type:N', 'price_in_dollar:Q', 'number_of_reviews:Q']\n ).properties(\n title='SF Airbnb: Price vs Number of Reviews',\n width='container',\n height=700,\n background='white'\n ).configure_title(\n fontSize=28,\n fontWeight='bold'\n ).configure_axis(\n titleFontSize=18,\n labelFontSize=14\n ).configure_legend(\n titleFontSize=16,\n labelFontSize=14\n ).to_html(embed_options={\"renderer\": \"svg\"})\n\n return chart",
6161
"headers": []
6262
}
6363
}

public/Intro_to_Fused/sf_airbnb_price_chart/sf_airbnb_price_chart.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
@fused.udf(cache_max_age=0)
1+
@fused.udf
22
def udf():
33
import altair as alt
44
import pandas as pd
55

66
# This loads the previous UDF and calls it
77
parent_udf = fused.load('sf_airbnb_listings')
8-
df = parent_udf(cache_max_age=0)
8+
df = parent_udf()
99
print(df.T)
1010

1111
plot_df = df.dropna(subset=['price_in_dollar', 'number_of_reviews'])

0 commit comments

Comments
 (0)