This file contains 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
sns.heatmap(df_new.corr()) |
This file contains 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
#importing all the libraries needed | |
import seaborn as sns | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
tips_df = sns.load_dataset('tips') | |
tips_df.head() |
This file contains 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
#.....read data | |
df = pd.read.csv(your_data) | |
#to select at numeric columns | |
df.select_dtypes(include=np.number) | |
#Wrapping it to a variable to get a new dataframe of other numeric features | |
new_df = df.select_dtypes(include=np.number) |
This file contains 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
import pandas as pd | |
website = 'url_of_choice' | |
website_table = pd.read_html(website) | |
df = pd.DataFrame(website_table[0]) | |
This file contains 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
INSERT INTO marvels VALUES(1, "Spider Man", 1, "Good", "Male", 1.78, 75.75, "USA", 4, 4, 3, 3, 1, 4); | |
INSERT INTO marvels VALUES(2, "Iron Man", 20, "Neutral", "Male", 1.98, 102.58, "USA", 6, 6, 5, 6, 6, 4); | |
INSERT INTO marvels VALUES(3, "Hulk", 18, "Neutral", "Male", 2.44, 635.29, "USA", 6, 7, 3, 7, 5, 4); | |
INSERT INTO marvels VALUES(4, "Wolverine", 3, "Good", "Male", 1.6, 88.46, "Canada", 2, 4, 2, 4, 1, 7); | |
INSERT INTO marvels VALUES(5, "Thor", 5, "Good", "Male", 1.98, 290.3, "Norway", 2, 7, 7, 6, 6, 4); | |
INSERT INTO marvels VALUES(6, "Green Goblin", 91, "Bad", "Male", 1.93, 174.63, "USA", 4, 4, 3, 4, 3, 3); | |
INSERT INTO marvels VALUES(7, "Magneto", 11, "Neutral", "Male", 1.88, 86.18, "Germany", 6, 3, 5, 4, 6, 4); | |
INSERT INTO marvels VALUES(8, "Thanos", 47, "Bad", "Male", 2.01, 446.79, "Titan", 6, 7, 7, 6, 6, 4); | |
INSERT INTO marvels VALUES(9, "Loki", 32, "Bad", "Male", 1.93, 238.14, "Jotunheim", 5, 5, 7, 6, 6, 3); | |
INSERT INTO marvels VALUES(10, "Doctor Doom", 19, "Bad", "Male", 2.01, 188.24, "Latveria", 6, 4, 5 |
This file contains 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
CREATE TABLE marvels (ID INTEGER PRIMARY KEY, | |
name TEXT, | |
popularity INTEGER, | |
alignment TEXT, | |
gender TEXT, | |
height_m NUMERIC, | |
weight_kg NUMERIC, | |
hometown TEXT, | |
intelligence INTEGER, | |
strength INTEGER, |
This file contains 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
INSERT INTO tablename VALUES(column1_values, column2_values); |
This file contains 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
CREATE TABLE tablename(column_1 data type, | |
column_2 data type, | |
......); |
This file contains 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
SELECT name, SUM(intelligence + strength + speed + durability + Energy_projection + Fighting_skills) as Power_rate | |
FROM power_average | |
GROUP BY name | |
ORDER BY Power_rate DESC | |
LIMIT 5; |
This file contains 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
SELECT Name, CASE | |
WHEN intelligence > ( SELECT AVG(intelligence) FROM marvels) THEN 1 | |
ELSE 0 | |
END AS intelligence, | |
CASE | |
WHEN Strength > ( SELECT AVG(Strength) FROM marvels) THEN 1 | |
ELSE 0 | |
END AS Strength, | |
CASE | |
WHEN Speed > ( SELECT AVG(Speed ) FROM marvels) THEN 1 |