import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
employees = pd.read_excel('employee_data.xlsx')
employees.head()
Employee | Gender | Age | Prior Experience | Beta Experience | Education | Annual Salary | |
---|---|---|---|---|---|---|---|
0 | 1 | 1 | 39 | 5 | 12 | 4 | 57700 |
1 | 2 | 0 | 44 | 12 | 8 | 6 | 76400 |
2 | 3 | 0 | 24 | 0 | 2 | 4 | 44000 |
3 | 4 | 1 | 25 | 2 | 1 | 4 | 41600 |
4 | 5 | 0 | 56 | 5 | 25 | 8 | 163900 |
sns.relplot(x='Age',y='Annual Salary',data=employees, kind='scatter')
plt.show()
sns.relplot(x='Age',y='Annual Salary',data=employees, kind='line')
plt.show()
sns.regplot(x='Age',y='Annual Salary',data=employees)
plt.show()
sns.lmplot(x='Age',y='Annual Salary',data=employees)
plt.show()
sns.catplot(x='Education', y='Annual Salary', data=employees, kind='bar')
plt.show()
sns.catplot(x='Education', y='Annual Salary', data=employees, kind='box')
plt.show()
sns.catplot(x='Education', y='Annual Salary', data=employees, kind='strip')
plt.show()
sns.catplot(x='Education', y='Annual Salary', data=employees, kind='swarm')
plt.show()
sns.catplot(x='Education', y='Annual Salary', data=employees, kind='violin')
plt.show()
sns.catplot(x='Education', y='Annual Salary', data=employees, kind='point')
plt.show()
sns.displot(x="Annual Salary", data=employees, kind='hist')
plt.show()
sns.displot(x="Annual Salary", data=employees, kind='kde')
plt.show()
sns.displot(x="Annual Salary", data=employees, kind='ecdf')
plt.show()
sns.rugplot(x="Annual Salary", data=employees)
plt.show()
sns.displot(x="Annual Salary", data=employees, kind='kde')
sns.rugplot(x="Annual Salary", data=employees)
plt.show()
sns.jointplot(data=employees, x='Age',y='Annual Salary',hue='Education')
plt.show()
sns.jointplot(data=employees, x='Age',y='Annual Salary')
plt.show()
sns.jointplot(data=employees, x='Age',y='Annual Salary',hue='Education', kind='hist')
plt.show()
import json
dict = {
"FirstName": "Jonathan",
"LastName": "Freeman",
"LoginCount": 4,
"isWriter": True,
"WorksWith": ['Spantree Technology Group', 'InfoWorld'],
"Pets": [
{
"name": "Lilly",
"type": "Raccoon"
}
]
}
dict
{'FirstName': 'Jonathan', 'LastName': 'Freeman', 'LoginCount': 4, 'isWriter': True, 'WorksWith': ['Spantree Technology Group', 'InfoWorld'], 'Pets': [{'name': 'Lilly', 'type': 'Raccoon'}]}
person='{"name":"Bob", "languages": ["English", "French"]}'
person_dict=json.loads(person)
person_dict
{'name': 'Bob', 'languages': ['English', 'French']}
person_dict['languages']
['English', 'French']
with open('path_to_file/filename.json') as f:
data=json.load(f)
dict_json=json.dumps(dict)
dict_json
'{"FirstName": "Jonathan", "LastName": "Freeman", "LoginCount": 4, "isWriter": true, "WorksWith": ["Spantree Technology Group", "InfoWorld"], "Pets": [{"name": "Lilly", "type": "Raccoon"}]}'