Upload diamondeconomicdata_159.py
Browse files- diamondeconomicdata_159.py +87 -0
diamondeconomicdata_159.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""DiamondEconomicData.159
|
| 3 |
+
|
| 4 |
+
Automatically generated by Colab.
|
| 5 |
+
|
| 6 |
+
Original file is located at
|
| 7 |
+
https://colab.research.google.com/drive/1S_CVJWdykN_6LSpjdHLcSQhC6UVUcFDe
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
!pip install ydata-profiling
|
| 11 |
+
|
| 12 |
+
import pandas as pd
|
| 13 |
+
import numpy as np
|
| 14 |
+
import matplotlib as plt
|
| 15 |
+
import seaborn as sns
|
| 16 |
+
import tensorflow as tf
|
| 17 |
+
from ydata_profiling import ProfileReport
|
| 18 |
+
|
| 19 |
+
df = pd.read_csv('/content/M6_T2_V1_Diamonds.csv')
|
| 20 |
+
|
| 21 |
+
df.sample(5)
|
| 22 |
+
|
| 23 |
+
print(df.head())
|
| 24 |
+
|
| 25 |
+
df.info()
|
| 26 |
+
|
| 27 |
+
df.isnull().sum
|
| 28 |
+
|
| 29 |
+
df.describe()
|
| 30 |
+
|
| 31 |
+
df.duplicated().sum()
|
| 32 |
+
|
| 33 |
+
df.head()
|
| 34 |
+
|
| 35 |
+
df_numeric = df.select_dtypes(include=[np.number])
|
| 36 |
+
df_numeric
|
| 37 |
+
|
| 38 |
+
df_numeric.corr()['price']
|
| 39 |
+
|
| 40 |
+
df['cut'].value_counts().plot(kind='bar')
|
| 41 |
+
|
| 42 |
+
df['color'].value_counts().plot(kind='bar')
|
| 43 |
+
|
| 44 |
+
df['clarity'].value_counts().plot(kind='bar')
|
| 45 |
+
|
| 46 |
+
df['cut'].value_counts().plot(kind='pie', autopct='%.2f')
|
| 47 |
+
|
| 48 |
+
df['color'].value_counts().plot(kind='pie', autopct='%.2f')
|
| 49 |
+
|
| 50 |
+
df['clarity'].value_counts().plot(kind='pie', autopct='%.2f')
|
| 51 |
+
|
| 52 |
+
sns.histplot(df['price'])
|
| 53 |
+
|
| 54 |
+
sns.histplot(df['x'], bins=10)
|
| 55 |
+
|
| 56 |
+
sns.histplot(df['y'], bins=50)
|
| 57 |
+
|
| 58 |
+
sns.histplot(df['z'], bins=50)
|
| 59 |
+
|
| 60 |
+
sns.distplot(df['price'])
|
| 61 |
+
|
| 62 |
+
sns.distplot(df['x'])
|
| 63 |
+
|
| 64 |
+
sns.distplot(df['y'])
|
| 65 |
+
|
| 66 |
+
sns.distplot(df['z'])
|
| 67 |
+
|
| 68 |
+
sns.boxplot(df['price'])
|
| 69 |
+
|
| 70 |
+
sns.boxplot(df['x'])
|
| 71 |
+
|
| 72 |
+
sns.boxplot(df['y'])
|
| 73 |
+
|
| 74 |
+
sns.boxplot(df['z'])
|
| 75 |
+
|
| 76 |
+
sns.pairplot(df)
|
| 77 |
+
|
| 78 |
+
prof = ProfileReport(df)
|
| 79 |
+
prof.to_file(output_file='output.html')
|
| 80 |
+
|
| 81 |
+
from IPython.core.display import display, HTML
|
| 82 |
+
|
| 83 |
+
with open('/content/output.html', 'r') as file:
|
| 84 |
+
html_content = file.read()
|
| 85 |
+
|
| 86 |
+
display(HTML(html_content))
|
| 87 |
+
|