I am still plugging away at the argument project. I keep getting an

error message saying "pd is not defined", but I have defined it SO many times.
Not sure what to do. I've put the ask into discord a few days ago, but have not received any feedback yet
This commit is contained in:
Heather
2025-11-10 18:14:46 -05:00
parent 059fd8fabe
commit a3ee361132
4 changed files with 98 additions and 85 deletions

View File

@@ -59,7 +59,7 @@
"metadata": {},
"outputs": [],
"source": [
"#I chose this question becuase I generally try to eat healthy. Sometimes quick meals are a necesity. I am curious if common fast food restaurants truly offer healthier options "
"#I chose this question because I generally try to eat healthy. Sometimes quick meals are a necessity. I am curious if common fast food restaurants truly offer healthier options "
]
},
{
@@ -72,7 +72,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 2,
"id": "technical-evans",
"metadata": {},
"outputs": [],
@@ -87,7 +87,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 2,
"id": "overhead-sigma",
"metadata": {},
"outputs": [],
@@ -96,25 +96,20 @@
"\n",
"# Load the dataset\n",
"def pandas(pd):\n",
" file_path = 'Fast_Food_Dataset/nutrition.csv' # Update this with the correct path\n",
" data = pd.read_csv(file_path)"
" file_path = pd.read_csv(\"Fast_Food_Dataset/nutrition.csv\") \n",
"\n",
" \n",
"\n",
" # Update this with the correct path\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 3,
"id": "heated-blade",
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (1804757086.py, line 1)",
"output_type": "error",
"traceback": [
"\u001b[0;36m Cell \u001b[0;32mIn[12], line 1\u001b[0;36m\u001b[0m\n\u001b[0;31m def data (pd.read_csv):\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
]
}
],
"outputs": [],
"source": [
"#check first 15 rows\n",
"def data (read_csv):\n",
@@ -141,12 +136,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "basic-canadian",
"metadata": {},
"outputs": [],
"source": [
"#Import any helper files you need here\n"
"#Import any helper files you need here\n",
"\n",
"import numpy as np\n",
"import matplotlib as mpl\n",
"import matplotlib.artist as martist\n",
"import matplotlib.patches as mpatches\n",
"import warnings\n",
"warnings.filterwarnings(\"ignore\")\n",
"\n",
"\n"
]
},
{
@@ -173,12 +177,12 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "44d5cdff-d651-46b8-8ee9-6bd6019c96c8",
"execution_count": 1,
"id": "0e3d2271-0361-4d42-a237-eff6b909c7b3",
"metadata": {},
"outputs": [],
"source": [
"I will use rows 1-15 \n"
"#I will focus on rows 1-15 to reorganize the data into how many calories come from fat, which has the least amout of sodium and least amout of calories"
]
},
{
@@ -191,26 +195,14 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 11,
"id": "negative-highlight",
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'data' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[2], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m#######################################################################\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;66;03m#import rows 1-15\u001b[39;00m\n\u001b[0;32m----> 3\u001b[0m \u001b[43mdata\u001b[49m\u001b[38;5;241m.\u001b[39mhead()\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m### \u001b[39;00m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m### Your data analysis may include a statistic and/or a data visualization\u001b[39;00m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;66;03m#######################################################################\u001b[39;00m\n",
"\u001b[0;31mNameError\u001b[0m: name 'data' is not defined"
]
}
],
"outputs": [],
"source": [
"#######################################################################\n",
"#import rows 1-15\n",
"data.head()\n",
"def file_path():\n",
" file_path = pd.read_csv(\"Fast_Food_Dataset/nutrition.csv\") \n",
"### \n",
"### Your data analysis may include a statistic and/or a data visualization\n",
"#######################################################################"
@@ -218,12 +210,24 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 14,
"id": "victorian-burning",
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "NameError",
"evalue": "name 'pd' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[14], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m file_path \u001b[38;5;241m=\u001b[39m \u001b[43mpd\u001b[49m\u001b[38;5;241m.\u001b[39mread_csv(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFast_Food_Dataset/nutrition.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
"\u001b[0;31mNameError\u001b[0m: name 'pd' is not defined"
]
}
],
"source": [
"# 💻 YOU CAN ADD NEW CELLS WITH THE \"+\" BUTTON "
"file_path = pd.read_csv(\"Fast_Food_Dataset/nutrition.csv\")"
]
},
{

View File

@@ -59,7 +59,7 @@
"metadata": {},
"outputs": [],
"source": [
"#I chose this question becuase I generally try to eat healthy. Sometimes quick meals are a necesity. I am curious if common fast food restaurants truly offer healthier options "
"#I chose this question because I generally try to eat healthy. Sometimes quick meals are a necessity. I am curious if common fast food restaurants truly offer healthier options "
]
},
{
@@ -72,7 +72,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 2,
"id": "technical-evans",
"metadata": {},
"outputs": [],
@@ -87,7 +87,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 2,
"id": "overhead-sigma",
"metadata": {},
"outputs": [],
@@ -96,13 +96,17 @@
"\n",
"# Load the dataset\n",
"def pandas(pd):\n",
" file_path = 'Fast_Food_Dataset/nutrition.csv' # Update this with the correct path\n",
" data = pd.read_csv(file_path)"
" file_path = pd.read_csv(\"Fast_Food_Dataset/nutrition.csv\") \n",
"\n",
" \n",
"\n",
" # Update this with the correct path\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 3,
"id": "heated-blade",
"metadata": {},
"outputs": [],
@@ -132,12 +136,21 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 4,
"id": "basic-canadian",
"metadata": {},
"outputs": [],
"source": [
"#Import any helper files you need here\n"
"#Import any helper files you need here\n",
"\n",
"import numpy as np\n",
"import matplotlib as mpl\n",
"import matplotlib.artist as martist\n",
"import matplotlib.patches as mpatches\n",
"import warnings\n",
"warnings.filterwarnings(\"ignore\")\n",
"\n",
"\n"
]
},
{
@@ -164,29 +177,12 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 1,
"id": "0e3d2271-0361-4d42-a237-eff6b909c7b3",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 16,
"id": "44d5cdff-d651-46b8-8ee9-6bd6019c96c8",
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (339389244.py, line 1)",
"output_type": "error",
"traceback": [
"\u001b[0;36m Cell \u001b[0;32mIn[16], line 1\u001b[0;36m\u001b[0m\n\u001b[0;31m I will use rows 1-15\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": [
"I will use rows 1-15 \n"
"#I will focus on rows 1-15 to reorganize the data into how many calories come from fat, which has the least amout of sodium and least amout of calories"
]
},
{
@@ -199,25 +195,14 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 11,
"id": "negative-highlight",
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'data' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[2], line 3\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[38;5;66;03m#######################################################################\u001b[39;00m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;66;03m#import rows 1-15\u001b[39;00m\n\u001b[0;32m----> 3\u001b[0m \u001b[43mdata\u001b[49m\u001b[38;5;241m.\u001b[39mhead()\n\u001b[1;32m 4\u001b[0m \u001b[38;5;66;03m### \u001b[39;00m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;66;03m### Your data analysis may include a statistic and/or a data visualization\u001b[39;00m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;66;03m#######################################################################\u001b[39;00m\n",
"\u001b[0;31mNameError\u001b[0m: name 'data' is not defined"
]
}
],
"outputs": [],
"source": [
"#######################################################################\n",
"\n",
"def file_path():\n",
" file_path = pd.read_csv(\"Fast_Food_Dataset/nutrition.csv\") \n",
"### \n",
"### Your data analysis may include a statistic and/or a data visualization\n",
"#######################################################################"
@@ -225,12 +210,24 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 14,
"id": "victorian-burning",
"metadata": {},
"outputs": [],
"outputs": [
{
"ename": "NameError",
"evalue": "name 'pd' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"Cell \u001b[0;32mIn[14], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m file_path \u001b[38;5;241m=\u001b[39m \u001b[43mpd\u001b[49m\u001b[38;5;241m.\u001b[39mread_csv(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mFast_Food_Dataset/nutrition.csv\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n",
"\u001b[0;31mNameError\u001b[0m: name 'pd' is not defined"
]
}
],
"source": [
"# 💻 YOU CAN ADD NEW CELLS WITH THE \"+\" BUTTON "
"file_path = pd.read_csv(\"Fast_Food_Dataset/nutrition.csv\")"
]
},
{

View File

@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}

6
data/Untitled.ipynb Normal file
View File

@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}