You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
5.7 KiB
128 lines
5.7 KiB
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Pumpkin Pricing\n",
|
|
"\n",
|
|
"ആവശ്യമായ ലൈബ്രറികളും ഡാറ്റാസെറ്റും ലോഡ് ചെയ്യുക. ഡാറ്റയുടെ ഒരു ഉപസമൂഹം അടങ്ങിയ ഡാറ്റാഫ്രെയിമിലേക്ക് ഡാറ്റ മാറ്റുക:\n",
|
|
"\n",
|
|
"- ബഷെൽ പ്രകാരം വില നിശ്ചയിച്ച പംപ്കിനുകൾ മാത്രം എടുക്കുക\n",
|
|
"- തീയതി ഒരു മാസമായി മാറ്റുക\n",
|
|
"- ഉയർന്ന വിലയും താഴ്ന്ന വിലയും ശരാശരിയായി വില കണക്കാക്കുക\n",
|
|
"- ബഷെൽ അളവിൽ വില പ്രതിഫലിപ്പിക്കാൻ വില മാറ്റുക\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import pandas as pd\n",
|
|
"import matplotlib.pyplot as plt\n",
|
|
"import numpy as np\n",
|
|
"from datetime import datetime\n",
|
|
"\n",
|
|
"pumpkins = pd.read_csv('../data/US-pumpkins.csv')\n",
|
|
"\n",
|
|
"pumpkins.head()\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"pumpkins = pumpkins[pumpkins['Package'].str.contains('bushel', case=True, regex=True)]\n",
|
|
"\n",
|
|
"columns_to_select = ['Package', 'Variety', 'City Name', 'Low Price', 'High Price', 'Date']\n",
|
|
"pumpkins = pumpkins.loc[:, columns_to_select]\n",
|
|
"\n",
|
|
"price = (pumpkins['Low Price'] + pumpkins['High Price']) / 2\n",
|
|
"\n",
|
|
"month = pd.DatetimeIndex(pumpkins['Date']).month\n",
|
|
"day_of_year = pd.to_datetime(pumpkins['Date']).apply(lambda dt: (dt-datetime(dt.year,1,1)).days)\n",
|
|
"\n",
|
|
"new_pumpkins = pd.DataFrame(\n",
|
|
" {'Month': month, \n",
|
|
" 'DayOfYear' : day_of_year, \n",
|
|
" 'Variety': pumpkins['Variety'], \n",
|
|
" 'City': pumpkins['City Name'], \n",
|
|
" 'Package': pumpkins['Package'], \n",
|
|
" 'Low Price': pumpkins['Low Price'],\n",
|
|
" 'High Price': pumpkins['High Price'], \n",
|
|
" 'Price': price})\n",
|
|
"\n",
|
|
"new_pumpkins.loc[new_pumpkins['Package'].str.contains('1 1/9'), 'Price'] = price/1.1\n",
|
|
"new_pumpkins.loc[new_pumpkins['Package'].str.contains('1/2'), 'Price'] = price*2\n",
|
|
"\n",
|
|
"new_pumpkins.head()\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"ഒരു അടിസ്ഥാന സ്കാറ്റർപ്ലോട്ട് നമ്മെ ഓർമ്മിപ്പിക്കുന്നത് ആഗസ്റ്റ് മുതൽ ഡിസംബർ വരെ മാത്രമേ മാസ ഡാറ്റ ഉണ്ടായിരിക്കുകയുള്ളൂ എന്നതാണ്. ലീനിയർ രീതിയിൽ നിഗമനങ്ങൾ വരയ്ക്കാൻ കൂടുതൽ ഡാറ്റ ആവശ്യമുണ്ടാകാം.\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import matplotlib.pyplot as plt\n",
|
|
"plt.scatter('Month','Price',data=new_pumpkins)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"\n",
|
|
"plt.scatter('DayOfYear','Price',data=new_pumpkins)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"metadata": {},
|
|
"source": [
|
|
"---\n\n<!-- CO-OP TRANSLATOR DISCLAIMER START -->\n**അസൂയാപത്രം**: \nഈ രേഖ AI വിവർത്തന സേവനം [Co-op Translator](https://github.com/Azure/co-op-translator) ഉപയോഗിച്ച് വിവർത്തനം ചെയ്തതാണ്. നാം കൃത്യതയ്ക്ക് ശ്രമിച്ചിട്ടുണ്ടെങ്കിലും, യന്ത്രം ചെയ്ത വിവർത്തനങ്ങളിൽ പിശകുകൾ അല്ലെങ്കിൽ തെറ്റുകൾ ഉണ്ടാകാമെന്ന് ദയവായി ശ്രദ്ധിക്കുക. അതിന്റെ മാതൃഭാഷയിലുള്ള യഥാർത്ഥ രേഖ അധികാരപരമായ ഉറവിടമായി കണക്കാക്കപ്പെടണം. നിർണായകമായ വിവരങ്ങൾക്ക്, പ്രൊഫഷണൽ മനുഷ്യ വിവർത്തനം ശുപാർശ ചെയ്യപ്പെടുന്നു. ഈ വിവർത്തനം ഉപയോഗിക്കുന്നതിൽ നിന്നുണ്ടാകുന്ന ഏതെങ്കിലും തെറ്റിദ്ധാരണകൾക്കോ തെറ്റായ വ്യാഖ്യാനങ്ങൾക്കോ ഞങ്ങൾ ഉത്തരവാദികളല്ല.\n<!-- CO-OP TRANSLATOR DISCLAIMER END -->\n"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.8.3-final"
|
|
},
|
|
"orig_nbformat": 2,
|
|
"coopTranslator": {
|
|
"original_hash": "b032d371c75279373507f003439a577e",
|
|
"translation_date": "2025-12-19T16:17:35+00:00",
|
|
"source_file": "2-Regression/3-Linear/notebook.ipynb",
|
|
"language_code": "ml"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 2
|
|
} |