This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #pie plot | |
| plt.pie([x*100 for x in d_cuisine.values()],labels=[x for x in d_cuisine.keys()],autopct='%0.1f',explode=[0,0,0.1,0]) | |
| #label the plot | |
| plt.title('Cuisine share %') | |
| plt.savefig('C:\\Users\\Dell\\Desktop\\AV Plotting images\\matplotlib_plotting_8.png',dpi=300,bbox_inches='tight') | |
| plt.show(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #dictionary for base price per cuisine | |
| c_price = {} | |
| for i in df['cuisine'].unique(): | |
| c_price[i] = df[df['cuisine']==i].base_price |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #plotting boxplot | |
| plt.boxplot([x for x in c_price.values()],labels=[x for x in c_price.keys()]) | |
| #x and y-axis labels | |
| plt.xlabel('Cuisine') | |
| plt.ylabel('Price') | |
| #plot title | |
| plt.title('Analysing cuisine price') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #plotting histogram | |
| plt.hist(df['base_price'],rwidth=0.9,alpha=0.3,color='blue',bins=15,edgecolor='red') | |
| #x and y-axis labels | |
| plt.xlabel('Base price range') | |
| plt.ylabel('Distinct order') | |
| #plot title | |
| plt.title('Inspecting price effect') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #new revenue column | |
| df['revenue'] = df.apply(lambda x: x.checkout_price*x.num_orders,axis=1) | |
| #new month column | |
| df['month'] = df['week'].apply(lambda x: x//4) | |
| #list to store month-wise revenue | |
| month=[] | |
| month_order=[] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #subplots returns a Figure and an Axes object | |
| fig,ax=plt.subplots(nrows=1,ncols=2,figsize=(20,5)) | |
| #manipulating the first Axes | |
| ax[0].plot(week,week_order) | |
| ax[0].set_xlabel('Week') | |
| ax[0].set_ylabel('Revenue') | |
| ax[0].set_title('Weekly income') | |
| #manipulating the second Axes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| center_type_name = ['TYPE_A','TYPE_B','TYPE_C'] | |
| #relation between op area and number of orders | |
| op_table=pd.pivot_table(df,index='op_area',values='num_orders',aggfunc=np.sum) | |
| #relation between center type and op area | |
| c_type = {} | |
| for i in center_type_name: | |
| c_type[i] = df[df['center_type']==i].op_area |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| train = pd.read_csv('/kaggle/input/house-prices-advanced-regression-techniques/train.csv') | |
| test = pd.read_csv('/kaggle/input/house-prices-advanced-regression-techniques/test.csv') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| train.head() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| train.info() |