text_html_output_1.png
from sqlalchemy import create_engine

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

import pandas as pd ## import liberaries pandas

import pandas as pd
df = pd.read_csv('/kaggle/input/analytics-industry-salaries-2022-india/Salary Dataset.csv')

df = df.rename(columns={'Company Name': 'CompanyName', 'Job Title': 'JobTitle', 'Salaries Reported': 'SalariesReported'}, inplace=False)

from sqlalchemy import create_engine
engine = create_engine('sqlite://', echo=False)
df.to_sql('SalaryDataset', con=engine)

sql = '\n\nSelect * from SalaryDataset\nlimit 5\n\n\n'
df_sql = pd.read_sql_query(sql, con=engine)

sql = "\n\nSelect * from SalaryDataset\nwhere CompanyName='IBM'\n\n\n"
df_sql = pd.read_sql_query(sql, con=engine)

sql = '\n\nSelect distinct(jobtitle) as job_title from SalaryDataset\n\n\n\n'
df_sql = pd.read_sql_query(sql, con=engine)

sql = '\n\nSelect \njobtitle,\ncount(salariesreported) as count_of_reports \nfrom SalaryDataset\ngroup by jobtitle\norder by count(salariesreported) desc\n\n\n\n'
df_sql = pd.read_sql_query(sql, con=engine)

sql = "\nSelect\nlocation,\nsum(case when JobTitle='Data Scientist' then 1 else 0 end) as Data_Scientist,\nsum(case when JobTitle='Data Analyst' then 1 else 0 end) as Data_Analyst,\nsum(case when JobTitle='Data Engineer' then 1 else 0 end) as Data_Engineer,\nsum(case when JobTitle='Machine Learning Engineer' then 1 else 0 end) as Machine_Learning_Engineer,\nsum(case when JobTitle='Junior Data Scientist' then 1 else 0 end) as Junior_Data_Scientist,\nsum(case when JobTitle='Senior Machine Learning Engineer' then 1 else 0 end) as Senior_Machine_Learning_Engineer,\nsum(case when JobTitle='Lead Data Scientist' then 1 else 0 end) as Lead_Data_Scientist,\nsum(case when JobTitle='Software Engineer- Machine learning' then 1 else 0 end) as Software_Engineer_Machine_learning,\nsum(case when JobTitle='Machine Learning Scientist' then 1 else 0 end) as Machine_Learning_Scientist,\nsum(case when JobTitle='Machine Learning Developer' then 1 else 0 end) as Machine_Learning_Developer,\nsum(case when JobTitle='Machine Learning Consultant' then 1 else 0 end) as Machine_Learning_Consultant,\nsum(case when JobTitle='Machine Learning Software Engineer' then 1 else 0 end) as Machine_Learning_Software_Engineer,\nsum(case when JobTitle='Machine Learning Engineer/Data Scientist' then 1 else 0 end) as Machine_Learning_Engineer_Data_Scientist,\nsum(case when JobTitle='Machine Learning Data Associate II' then 1 else 0 end) as Machine_Learning_Data_Associate_II,\nsum(case when JobTitle='Machine Learning Data Associate I' then 1 else 0 end) as Machine_Learning_Data_Associate_I,\nsum(case when JobTitle='Machine Learning Data Associate' then 1 else 0 end) as Machine_Learning_Data_Associate,\nsum(case when JobTitle='Machine Learning Data Analyst' then 1 else 0 end) as Machine_Learning_Data_Analyst,\nsum(case when JobTitle='Machine Learning Associate' then 1 else 0 end) as Machine_Learning_Associate,\nsum(case when JobTitle='Data Scientist - Trainee' then 1 else 0 end) as Data_Scientist_Trainee,\nsum(case when JobTitle='Data Science Manager' then 1 else 0 end) as Data_Science_Manager,\nsum(case when JobTitle='Data Science Lead' then 1 else 0 end) as Data_Science_Lead,\nsum(case when JobTitle='Data Science Associate' then 1 else 0 end) as Data_Science_Associate,\nsum(case when JobTitle='Associate Machine Learning Engineer' then 1 else 0 end) as Associate_Machine_Learning_Engineer,\nsum(case when JobTitle='Data Science Consultant' then 1 else 0 end) as Data_Science_Consultant,\nsum(case when JobTitle='Senior Data Scientist' then 1 else 0 end) as Senior_Data_Scientist\nfrom SalaryDataset\ngroup by 1\n"
df_sql = pd.read_sql_query(sql, con=engine)
df_sql.head(100)