Corran commited on
Commit
7747336
·
verified ·
1 Parent(s): 7557de2

Create fruitchecker.ipynb

Browse files
Files changed (1) hide show
  1. fruitchecker.ipynb +63 -0
fruitchecker.ipynb ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": null,
6
+ "id": "parameters-cell",
7
+ "metadata": {
8
+ "tags": ["parameters"]
9
+ },
10
+ "outputs": [],
11
+ "source": [
12
+ "fruits = [] # This will be overridden by Papermill"
13
+ ]
14
+ },
15
+ {
16
+ "cell_type": "code",
17
+ "execution_count": null,
18
+ "id": "price-lookup",
19
+ "metadata": {},
20
+ "outputs": [],
21
+ "source": [
22
+ "import pandas as pd\n",
23
+ "\n",
24
+ "# Example fruit price dictionary\n",
25
+ "fruit_prices = {\n",
26
+ " 'apple': 1.2,\n",
27
+ " 'banana': 0.5,\n",
28
+ " 'orange': 0.8,\n",
29
+ " 'grape': 2.5,\n",
30
+ " 'mango': 1.8\n",
31
+ "}\n",
32
+ "\n",
33
+ "# Look up prices\n",
34
+ "prices = [(fruit, fruit_prices.get(fruit, 'N/A')) for fruit in fruits]\n",
35
+ "df = pd.DataFrame(prices, columns=['Fruit', 'Price'])\n",
36
+ "\n",
37
+ "# Convert to CSV (string, not file)\n",
38
+ "csv_output = df.to_csv(index=False)\n"
39
+ ]
40
+ }
41
+ ],
42
+ "metadata": {
43
+ "kernelspec": {
44
+ "display_name": "Python 3",
45
+ "language": "python",
46
+ "name": "python3"
47
+ },
48
+ "language_info": {
49
+ "codemirror_mode": {
50
+ "name": "ipython",
51
+ "version": 3
52
+ },
53
+ "file_extension": ".py",
54
+ "mimetype": "text/x-python",
55
+ "name": "python",
56
+ "nbconvert_exporter": "python",
57
+ "pygments_lexer": "ipython3",
58
+ "version": "3.8.10"
59
+ }
60
+ },
61
+ "nbformat": 4,
62
+ "nbformat_minor": 5
63
+ }