# This Python 3 environment comes with many helpful analytics libraries installed
# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python
# For example, here's several helpful packages to load

import numpy as np # linear algebra
import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

# Input data files are available in the read-only "../input/" directory
# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory

import os
for dirname, _, filenames in os.walk('/kaggle/input'):
    for filename in filenames:
        print(os.path.join(dirname, filename))

# You can write up to 5GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using "Save & Run All" 
# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session
"""
Convert the csv file into a dataframe
"""
df = pd.read_csv('../input/iphone-price-from-flipkartcom/iphoneFlipkart.csv')
"""
Then we check the columns, number of rows and null values. Although most of the time it is given by the dataset provider in kaggle but it is better to practice this sanity checking.
"""
df.info()
"""
Now we will dive into the dataset using the .head() method. I usually like to see first 10 and last 10 rows.
"""
df.head(10)
df.tail(10)
"""
# Its time to do some exploratory data analysis.
"""
"""
First we will check the status column. 
"""
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
colour = ["#e74c3c", "#34495e"]
sns.set_style('darkgrid')
sns.set_palette(colour)
sns.set_context('notebook')

g = sns.catplot(y = 'Status' , data = df, kind = 'count', height = 3, aspect = 3.5)
g.set(xlabel = 'Classes', ylabel ='Samples in each class')
plt.show()

"""
We can see there are only two types of status and most of them are not deliverable. 

We could the same for other classes as well.
"""
s = sns.color_palette(sns.cubehelix_palette(10))
g = sns.catplot(y = 'Product_Name', data = df, kind = 'count', height = 12, aspect = 2, palette = s)
g.set(xlabel = 'Samples in each class', ylabel ='Classes')
plt.show()
"""
We can see Iphone 11, Iphone XR and Iphone 8 are most available in the store.
"""
g = sns.pairplot(df, hue="Status", palette="husl", markers=["D", "o"])
"""
We can also look at the average prices for different Iphones with different storages.
"""
df.groupby(['Memmory','Product_Name'])['Price'].mean()
df.pivot_table(values = 'Price' , index = 'Product_Name' , columns = 'Color', fill_value = 0, margins = True)
"""
***This is my simple work within few minutes. Hope you will like it. I am still very new in this area. So, give feedback on my mistakes. Happy Hacking :)***
"""