generated from mwc/project_argument
Please check and see what I'm doing wrong. It keeps saying I need to define things that I thought were defined?
This commit is contained in:
@@ -96,7 +96,7 @@
|
||||
"\n",
|
||||
"# Load the dataset\n",
|
||||
"def pandas(pd):\n",
|
||||
" file_path = pd.read_csv(\"Fast_Food_Dataset/nutrition.csv\") \n",
|
||||
" df = pd.read_csv('Fast_Food_Dataset/nutrition.csv')\n",
|
||||
"\n",
|
||||
" \n",
|
||||
"\n",
|
||||
@@ -106,14 +106,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 6,
|
||||
"id": "heated-blade",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"#check first 15 rows\n",
|
||||
"def data (read_csv):\n",
|
||||
" data.head(15)"
|
||||
" data.head(15)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -195,14 +198,18 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 8,
|
||||
"id": "negative-highlight",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"#######################################################################\n",
|
||||
"def file_path():\n",
|
||||
" file_path = pd.read_csv(\"Fast_Food_Dataset/nutrition.csv\") \n",
|
||||
"\n",
|
||||
"# Calculate calories from fat (assuming fat column is in grams)\n",
|
||||
"# Formula: fat_grams * 9 calories per gram\n",
|
||||
"def first_15():\n",
|
||||
" first_15['fat_calories']= first_15['fat'] * 9\n",
|
||||
"\n",
|
||||
"### \n",
|
||||
"### Your data analysis may include a statistic and/or a data visualization\n",
|
||||
"#######################################################################"
|
||||
@@ -210,24 +217,23 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 16,
|
||||
"id": "victorian-burning",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'pd' is not defined",
|
||||
"ename": "SyntaxError",
|
||||
"evalue": "invalid syntax (2142274504.py, line 2)",
|
||||
"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"
|
||||
"\u001b[0;36m Cell \u001b[0;32mIn[16], line 2\u001b[0;36m\u001b[0m\n\u001b[0;31m def first_15('item', 'fat', 'fat_calories', 'calories'):\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"file_path = pd.read_csv(\"Fast_Food_Dataset/nutrition.csv\")"
|
||||
"# Display relevant columns\n",
|
||||
"def first_15('item', 'fat', 'fat_calories', 'calories'):\n",
|
||||
" return first_15"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
"\n",
|
||||
"# Load the dataset\n",
|
||||
"def pandas(pd):\n",
|
||||
" file_path = pd.read_csv(\"Fast_Food_Dataset/nutrition.csv\") \n",
|
||||
" df = pd.read_csv('Fast_Food_Dataset/nutrition.csv')\n",
|
||||
"\n",
|
||||
" \n",
|
||||
"\n",
|
||||
@@ -106,14 +106,17 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 6,
|
||||
"id": "heated-blade",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"#check first 15 rows\n",
|
||||
"def data (read_csv):\n",
|
||||
" data.head(15)"
|
||||
" data.head(15)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -195,14 +198,18 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 8,
|
||||
"id": "negative-highlight",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"#######################################################################\n",
|
||||
"def file_path():\n",
|
||||
" file_path = pd.read_csv(\"Fast_Food_Dataset/nutrition.csv\") \n",
|
||||
"\n",
|
||||
"# Calculate calories from fat (assuming fat column is in grams)\n",
|
||||
"# Formula: fat_grams * 9 calories per gram\n",
|
||||
"def first_15():\n",
|
||||
" first_15['fat_calories']= first_15['fat'] * 9\n",
|
||||
"\n",
|
||||
"### \n",
|
||||
"### Your data analysis may include a statistic and/or a data visualization\n",
|
||||
"#######################################################################"
|
||||
@@ -210,24 +217,23 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 14,
|
||||
"execution_count": 16,
|
||||
"id": "victorian-burning",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "NameError",
|
||||
"evalue": "name 'pd' is not defined",
|
||||
"ename": "SyntaxError",
|
||||
"evalue": "invalid syntax (2142274504.py, line 2)",
|
||||
"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"
|
||||
"\u001b[0;36m Cell \u001b[0;32mIn[16], line 2\u001b[0;36m\u001b[0m\n\u001b[0;31m def first_15('item', 'fat', 'fat_calories', 'calories'):\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"file_path = pd.read_csv(\"Fast_Food_Dataset/nutrition.csv\")"
|
||||
"# Display relevant columns\n",
|
||||
"def first_15('item', 'fat', 'fat_calories', 'calories'):\n",
|
||||
" return first_15"
|
||||
]
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user