HomeWork: Ameo with Pandas Visualisations
ameo15

Homework - ameo15 dataset

In [ ]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
In [ ]:
d = pd.read_excel('/content/Ameo15.xlsx', index_col='ID')
In [ ]:
d.head()
Out[ ]:
Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation ... ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID
203097 420000 2012-06-01 present senior quality engineer Bangalore f 1990-02-19 84.3 board ofsecondary education,ap 2007 ... -1 -1 -1 -1 -1 0.9737 0.8128 0.5269 1.35490 -0.4455
579905 500000 2013-09-01 present assistant manager Indore m 1989-10-04 85.4 cbse 2007 ... -1 -1 -1 -1 -1 -0.7335 0.3789 1.2396 -0.10760 0.8637
810601 325000 2014-06-01 present systems engineer Chennai f 1992-08-03 85.0 cbse 2010 ... -1 -1 -1 -1 -1 0.2718 1.7109 0.1637 -0.86820 0.6721
267447 1100000 2011-07-01 present senior software engineer Gurgaon m 1989-12-05 85.6 cbse 2007 ... -1 -1 -1 -1 -1 0.0464 0.3448 -0.3440 -0.40780 -0.9194
343523 200000 2014-03-01 2015-03-01 00:00:00 get Manesar m 1991-02-27 78.0 cbse 2008 ... -1 -1 -1 -1 -1 -0.8810 -0.2793 -1.0697 0.09163 -0.1295

5 rows × 37 columns

In [ ]:
d['Designation'].unique()
Out[ ]:
array(['senior quality engineer', 'assistant manager', 'systems engineer',
       'senior software engineer', 'get', 'system engineer',
       'java software engineer', 'mechanical engineer',
       'electrical engineer', 'project engineer', 'senior php developer',
       'senior systems engineer', 'quality assurance engineer',
       'qa analyst', 'network engineer', 'product development engineer',
       'associate software developer', 'data entry operator',
       'software engineer', 'developer', 'electrical project engineer',
       'programmer analyst', 'systems analyst', 'ase',
       'telecommunication engineer', 'application developer',
       'ios developer', 'executive assistant', 'online marketing manager',
       'documentation specialist', 'associate software engineer',
       'management trainee', 'site manager', 'software developer',
       '.net developer', 'production engineer', 'jr. software engineer',
       'trainee software developer', 'ui developer',
       'assistant system engineer', 'android developer',
       'customer service', 'test engineer', 'java developer', 'engineer',
       'recruitment coordinator', 'technical support engineer',
       'data analyst', 'assistant software engineer', 'faculty',
       'entry level management trainee',
       'customer service representative', 'software test engineer',
       'firmware engineer', 'php developer', 'research associate',
       'research analyst', 'quality engineer', 'programmer',
       'technical support executive', 'business analyst', 'web developer',
       'application engineer', 'project coordinator', 'engineer trainee',
       'sap consultant', 'quality analyst', 'marketing coordinator',
       'system administrator', 'senior engineer',
       'business development managerde', 'network administrator',
       'technical support specialist', 'business development executive',
       'junior software engineer', 'asp.net developer',
       'graduate engineer trainee', 'field engineer',
       'assistant professor', 'trainee software engineer',
       'senior software developer',
       'quality assurance automation engineer', 'design engineer',
       'telecom engineer', 'quality control engineer',
       'hardware engineer', 'hr recruiter', 'sales associate',
       'junior engineer', 'associate engineer', 'maintenance engineer',
       'sales engineer', 'human resources associate',
       'mobile application developer',
       'electronic field service engineer', 'process associate',
       'field service engineer', 'it support specialist',
       'software development engineer', 'business process analyst',
       'operation engineer', 'electrical designer', 'marketing assistant',
       'sales executive', 'admin assistant', 'senior java developer',
       'account executive', 'oracle dba', 'rf engineer',
       'embedded software engineer', 'programmer analyst trainee',
       'technical engineer', 'operations executive', 'trainee engineer',
       'recruiter', 'lecturer', '.net web developer',
       'marketing executive', 'operations assistant', 'associate manager',
       'electrical design engineer', 'systems administrator',
       'client services associate', 'it analyst', 'senior developer',
       'cad designer', 'business technology analyst', 'asst. manager',
       'service engineer', 'executive recruiter', 'planning engineer',
       'associate technical operations', 'web designer',
       'software architect', 'software quality assurance tester',
       'seo trainee', 'process engineer',
       'software quality assurance analyst', 'designer',
       'business systems consultant', 'business development manager',
       'junior research fellow', 'technical recruiter',
       'operations analyst', 'quality assurance test engineer',
       'linux systems administrator', 'software trainee',
       'entry level sales and marketing', 'electrical field engineer',
       'windows systems administrator', 'junior software developer',
       'python developer', 'web application developer',
       'assistant systems engineer', 'javascript developer',
       'operation executive', 'performance engineer', 'technical writer',
       'operations engineer and jetty handling', 'lead engineer',
       'portfolio analyst', 'associate system engineer',
       'mechanical design engineer', 'product engineer',
       'network security engineer', 'operations manager',
       'technical lead', 'operations', 'quality assurance tester',
       'automation engineer', 'data scientist', 'quality associate',
       'manual tester', 'sr. engineer', 'embedded engineer',
       'service and sales engineer', 'telecom support engineer',
       'engineer- customer support', 'cloud engineer', 'branch manager',
       'business analyst consultant', 'technology lead',
       'software trainee engineer', 'dcs engineer', 'junior manager',
       'ux designer', 'clerical', 'hr generalist',
       'database administrator', 'senior design engineer', 'seo',
       'assistant engineer', 'marketing analyst', 'it executive',
       'salesforce developer', 'software tester', 'sql dba',
       'junior engineer product support', 'manager',
       'senior business analyst', 'c# developer',
       'implementation engineer', 'executive hr', 'executive engineer',
       'sharepoint developer', 'system analyst',
       'sales management trainee', 'senior project engineer',
       'it recruiter', 'software engineer analyst',
       'desktop support technician', 'continuous improvement engineer',
       'process advisor', 'etl developer', 'sales and service engineer',
       'project manager', 'training specialist', 'product manager',
       'staffing recruiter', 'assistant programmer', 'quality controller',
       'mis executive', 'game developer', 'digital marketing specialist',
       'principal software engineer', 'software devloper',
       'senior mechanical engineer', 'technical operations analyst',
       'service coordinator', 'testing engineer', 'technical assistant',
       'sap abap consultant', 'seo engineer', 'project assistant',
       'talent acquisition specialist', 'sales account manager',
       'software engineer trainee', 'customer service manager',
       'help desk analyst', 'general manager', 'engineering manager',
       'senior network engineer',
       'field based employee relations manager', 'phone banking officer',
       'support engineer', 'associate test engineer',
       'technology analyst', 'network support engineer',
       'it business analyst', 'junior system analyst',
       'senior .net developer', 'secretary', 'research engineer',
       'quality assurance auditor', 'process executive',
       'lecturer & electrical maintenance', 'office coordinator',
       'hr manager', 'html developer', 'sales support',
       'front end web developer', 'administrative support',
       'territory sales manager', 'project administrator',
       'environmental engineer', 'web designer and seo',
       'information security analyst',
       'field business development associate', 'operational executive',
       'administrative coordinator', 'senior risk consultant',
       'desktop support engineer', 'cad drafter', 'noc engineer',
       'industrial engineer', 'it engineer', 'human resources intern',
       'senior quality assurance engineer', 'clerical assistant',
       'software enginner', 'quality assurance',
       'delivery software engineer', 'graphic designer',
       'sales development manager', 'visiting faculty',
       'business intelligence analyst', 'team lead',
       'operational excellence manager', 'sales & service engineer',
       'web intern', 'full stack developer', 'database developer',
       'sr. database engineer', 'graduate apprentice trainee',
       'software engineer associate', 'technical analyst',
       'executive engg', 'it technician', 'business system analyst',
       'process control engineer', 'technical consultant',
       'business office manager', 'quality control inspector',
       'product design engineer', 'manufacturing engineer',
       'seo executive', 'sap analyst', 'software engineere',
       'financial service consultant', 'co faculty', 'software analyst',
       'desktop support analyst', 'graduate engineer',
       'engineering technician', 'it assistant', 'marketing manager',
       'human resource assistant', 'hr assistant', 'product developer',
       'customer support engineer',
       'quality control inspection technician', 'gis/cad engineer',
       'senior web developer', 'sql developer', 'research staff member',
       'sap abap associate consultant', 'associate qa',
       'corporate recruiter', 'project management officer',
       'business systems analyst', 'software programmer',
       'help desk technician', 'sales manager', 'catalog associate',
       'assistant store manager', 'software engg', 'it developer',
       'apprentice', 'business consultant', 'controls engineer',
       'ruby on rails developer', 'risk consultant', 'account manager',
       'professor', 'assistant administrator', 'civil engineer',
       'educator', 'service manager', 'teradata dba',
       'full-time loss prevention associate', 'junior recruiter',
       'associate developer', 'assistant electrical engineer',
       'shift engineer', 'dotnet developer', 'rf/dt engineer',
       'human resources analyst', 'software test engineerte',
       'junior .net developer', 'java trainee', 'maintenance supervisor',
       'r&d engineer', 'front end developer', 'engineer-hws',
       'operations engineer', 'senior research fellow',
       'web designer and joomla administrator',
       'enterprise solutions developer',
       'information technology specialist', 'site engineer',
       'graduate trainee engineer', 'quality assurance analyst',
       'cnc programmer', 'financial analyst', 'system engineer trainee',
       'sap mm consultant', 'assistant system engineer trainee',
       'qa trainee', 'teradata developer', 'hr executive',
       'senior programmer', 'software test engineer (etl)',
       'associate software engg', 'supply chain analyst', 'sales trainer',
       'software executive', 'team leader',
       'assistant system engineer - trainee', 'seo analyst',
       'risk investigator', 'executive administrative assistant',
       'program manager', 'r & d', 'sap functional consultant',
       'website developer/tester', 'software designer',
       'sales coordinator', 'qa engineer', 'aircraft technician',
       'customer care executive', 'senior test engineer',
       'program analyst trainee', 'electrical controls engineer',
       'trainee decision scientist', 'editor', 'bss engineer', 'dba',
       'software eng', 'computer faculty', 'recruitment associate',
       'logistics executive', 'quality consultant',
       'senior sales executive', 'db2 dba', 'test technician',
       'it operations associate', 'software engineering associate',
       'research scientist', 'jr. software developer'], dtype=object)
In [ ]:
d['Designation'].str.upper()
Out[ ]:
ID
203097         SENIOR QUALITY ENGINEER
579905               ASSISTANT MANAGER
810601                SYSTEMS ENGINEER
267447        SENIOR SOFTWARE ENGINEER
343523                             GET
                      ...             
407755                         MANAGER
575154               SOFTWARE ENGINEER
216598                TECHNICAL WRITER
919755     ASSOCIATE SOFTWARE ENGINEER
1037308             SOFTWARE DEVELOPER
Name: Designation, Length: 5498, dtype: object
In [ ]:
d.head(2)
Out[ ]:
Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation ... ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID
203097 420000 2012-06-01 present senior quality engineer Bangalore f 1990-02-19 84.3 board ofsecondary education,ap 2007 ... -1 -1 -1 -1 -1 0.9737 0.8128 0.5269 1.3549 -0.4455
579905 500000 2013-09-01 present assistant manager Indore m 1989-10-04 85.4 cbse 2007 ... -1 -1 -1 -1 -1 -0.7335 0.3789 1.2396 -0.1076 0.8637

2 rows × 37 columns

In [ ]:
d['10percentage'].mean()
Out[ ]:
78.05070025463795
In [ ]:
d['Salary'].mean()
Out[ ]:
305605.49290651147
In [ ]:
d.describe()
Out[ ]:
Salary 10percentage 12graduation 12percentage CollegeID CollegeTier collegeGPA CollegeCityID CollegeCityTier GraduationYear ... ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
count 5.498000e+03 5498.000000 5498.000000 5498.000000 5498.000000 5498.000000 5498.000000 5498.000000 5498.000000 5498.000000 ... 5498.000000 5498.000000 5498.000000 5498.000000 5498.000000 5498.000000 5498.000000 5498.000000 5498.000000 5498.000000
mean 3.056055e+05 78.050700 2008.096944 74.597506 5169.293198 1.925973 71.521359 5169.293198 0.294289 2012.246453 ... 89.173518 22.979629 17.623136 32.580757 3.042197 -0.037976 0.156622 0.015219 -0.147904 -0.128363
std 2.030102e+05 9.774724 1.636035 10.902039 4787.707246 0.261839 8.328995 4787.707246 0.455764 27.174495 ... 174.314470 98.511684 90.694107 105.358134 38.560043 1.026689 0.919777 0.943009 1.008903 0.982055
min 3.500000e+04 43.000000 1995.000000 40.000000 2.000000 1.000000 6.450000 2.000000 0.000000 0.000000 ... -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -4.126700 -5.781600 -4.600900 -2.643000 -7.375700
25% 1.800000e+05 72.000000 2007.000000 66.400000 513.000000 2.000000 66.700000 513.000000 0.000000 2012.000000 ... -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 -0.726400 -0.287100 -0.604800 -0.868200 -0.669200
50% 3.000000e+05 79.600000 2008.000000 74.530000 3879.000000 2.000000 71.830000 3879.000000 0.000000 2013.000000 ... -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 0.046400 0.212400 0.091400 -0.172700 -0.050600
75% 3.700000e+05 85.615000 2009.000000 82.800000 8816.250000 2.000000 76.400000 8816.250000 1.000000 2014.000000 ... -1.000000 -1.000000 -1.000000 -1.000000 -1.000000 0.702700 0.812800 0.672000 0.526200 0.502400
max 4.000000e+06 97.760000 2013.000000 98.700000 18409.000000 2.000000 99.930000 18409.000000 1.000000 2017.000000 ... 746.000000 653.000000 676.000000 553.000000 548.000000 1.995300 1.904800 2.535400 3.352500 1.822400

8 rows × 26 columns

In [ ]:
d['Designation'] = d['Designation'].astype(str)
  • Pandas 1.0 introduces a new datatype specific to string data which is StringDtype.
  • As of now, we can still use object or StringDtype to store strings but in the future, we may be required to only use StringDtype.
  • One important thing to note here is that object datatype is still the default datatype for strings
  • Covert a column to string string datatype
    • df['points'] = df['points'].astype(str)
  • Convert multiple columns to string type
    • df[['points', 'assists']] = df[['points', 'assists']].astype(str)
In [ ]:
df10 = d.sample(10)
In [ ]:
df10
Out[ ]:
Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation ... ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID
902841 430000 2014-05-01 2014-08-01 00:00:00 software engineer Hyderabad m 1992-05-19 83.00 state board 2010 ... -1 -1 -1 -1 -1 -0.7335 -0.4536 0.1637 1.0333 -0.2859
89357 225000 2011-02-01 2011-07-01 00:00:00 technical support engineer Bangalore m 1989-01-05 69.00 sslc 2006 ... -1 -1 -1 -1 -1 1.4374 -1.2153 -0.6343 -0.2902 -2.0253
984851 320000 2015-03-01 2015-05-01 00:00:00 system engineer Ahmedabad m 1993-08-20 78.17 state board 2010 ... -1 -1 676 -1 -1 1.1336 0.3789 0.1637 -0.7415 -0.6692
1129408 250000 2013-06-01 present system engineer Chennai m 1990-04-19 69.00 state board 2009 ... -1 -1 -1 -1 -1 0.1282 0.5454 -0.6048 0.0192 -1.0524
1088496 120000 2014-08-01 present junior software engineer Trivandrum m 1990-11-16 75.00 cbse 2009 ... -1 -1 -1 -1 -1 -0.4463 0.0459 -0.7585 -1.2486 -0.4776
687711 300000 2014-06-01 present software engineer noida m 1990-10-31 83.20 cbse 2009 ... 438 -1 -1 -1 -1 -1.4517 0.2124 0.1637 -0.7415 -0.8608
994256 340000 2014-04-01 2015-04-01 00:00:00 web application developer Bangalore m 1991-12-13 74.00 state board 2009 ... -1 -1 -1 -1 -1 0.5591 0.0459 0.6248 0.5262 1.6302
109166 380000 2012-02-01 2014-08-01 00:00:00 software engineer Pune f 1989-09-03 79.83 gshseb 2006 ... -1 -1 -1 -1 -1 0.2009 0.0328 -0.0537 -1.4653 0.1864
1193139 325000 2014-08-01 2015-04-01 00:00:00 software engineer Bangalore m 1992-06-25 71.84 state board 2010 ... -1 -1 -1 -1 -1 0.1282 0.2124 -0.9122 1.0333 -0.0943
1226693 350000 2015-02-01 present front end developer Gurgaon f 1993-08-12 92.00 cbse 2011 ... -1 -1 -1 -1 -1 -1.1644 0.7119 -0.6048 -0.3612 0.6721

10 rows × 37 columns

In [ ]:
def sal_low_red(x):
    color = 'red' if x < 200000 else 'blue'
    return "color:" + color

work with single column in a dataframe

In [ ]:
df10.style.bar(subset = ['Salary'])
Out[ ]:
  Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation 12percentage 12board CollegeID CollegeTier Degree Specialization collegeGPA CollegeCityID CollegeCityTier CollegeState GraduationYear English Logical Quant Domain ComputerProgramming ElectronicsAndSemicon ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID                                                                          
902841 430000 2014-05-01 00:00:00 2014-08-01 00:00:00 software engineer Hyderabad m 1992-05-19 00:00:00 83.000000 state board 2010 82.000000 state board 9775 2 B.Tech/B.E. computer science & engineering 71.000000 9775 1 Telangana 2014 425 465 470 -1.000000 -1 -1 -1 -1 -1 -1 -1 -0.733500 -0.453600 0.163700 1.033300 -0.285900
89357 225000 2011-02-01 00:00:00 2011-07-01 00:00:00 technical support engineer Bangalore m 1989-01-05 00:00:00 69.000000 sslc 2006 50.000000 puc 1648 2 B.Tech/B.E. information technology 60.000000 1648 1 Karnataka 2010 404 375 395 0.488348 405 -1 -1 -1 -1 -1 -1 1.437400 -1.215300 -0.634300 -0.290200 -2.025300
984851 320000 2015-03-01 00:00:00 2015-05-01 00:00:00 system engineer Ahmedabad m 1993-08-20 00:00:00 78.170000 state board 2010 77.850000 state board 4948 2 B.Tech/B.E. electrical engineering 76.850000 4948 1 Rajasthan 2014 675 495 545 0.997698 -1 -1 -1 -1 676 -1 -1 1.133600 0.378900 0.163700 -0.741500 -0.669200
1129408 250000 2013-06-01 00:00:00 present system engineer Chennai m 1990-04-19 00:00:00 69.000000 state board 2009 61.300000 state board 5039 2 B.Tech/B.E. electronics and communication engineering 69.000000 5039 0 Andhra Pradesh 2013 430 425 295 0.338786 175 292 -1 -1 -1 -1 -1 0.128200 0.545400 -0.604800 0.019200 -1.052400
1088496 120000 2014-08-01 00:00:00 present junior software engineer Trivandrum m 1990-11-16 00:00:00 75.000000 cbse 2009 80.000000 state board 10361 2 B.Tech/B.E. electronics and communication engineering 60.850000 10361 0 Kerala 2013 570 580 750 -1.000000 495 -1 -1 -1 -1 -1 -1 -0.446300 0.045900 -0.758500 -1.248600 -0.477600
687711 300000 2014-06-01 00:00:00 present software engineer noida m 1990-10-31 00:00:00 83.200000 cbse 2009 67.000000 state board 7814 2 B.Tech/B.E. computer science & engineering 70.700000 7814 0 Orissa 2013 565 615 445 0.744758 295 -1 438 -1 -1 -1 -1 -1.451700 0.212400 0.163700 -0.741500 -0.860800
994256 340000 2014-04-01 00:00:00 2015-04-01 00:00:00 web application developer Bangalore m 1991-12-13 00:00:00 74.000000 state board 2009 78.000000 state board 10389 2 B.Tech/B.E. electronics & telecommunications 73.720000 10389 0 Madhya Pradesh 2013 405 470 585 0.783304 505 388 -1 -1 -1 -1 -1 0.559100 0.045900 0.624800 0.526200 1.630200
109166 380000 2012-02-01 00:00:00 2014-08-01 00:00:00 software engineer Pune f 1989-09-03 00:00:00 79.830000 gshseb 2006 68.330000 gshseb 988 2 B.Tech/B.E. electronics and communication engineering 68.740000 988 0 Gujarat 2010 435 605 685 0.824666 -1 400 -1 -1 -1 -1 -1 0.200900 0.032800 -0.053700 -1.465300 0.186400
1193139 325000 2014-08-01 00:00:00 2015-04-01 00:00:00 software engineer Bangalore m 1992-06-25 00:00:00 71.840000 state board 2010 66.830000 state board 3770 2 B.Tech/B.E. computer science & engineering 70.350000 3770 0 Karnataka 2016 640 615 585 0.974396 615 -1 -1 -1 -1 -1 -1 0.128200 0.212400 -0.912200 1.033300 -0.094300
1226693 350000 2015-02-01 00:00:00 present front end developer Gurgaon f 1993-08-12 00:00:00 92.000000 cbse 2011 85.600000 cbse 115 2 B.Tech/B.E. computer science & engineering 91.000000 115 0 Punjab 2015 535 480 605 -1.000000 -1 -1 -1 -1 -1 -1 -1 -1.164400 0.711900 -0.604800 -0.361200 0.672100

work with one column as single column

In [ ]:
df10[['Salary']].style.bar()
Out[ ]:
  Salary
ID  
902841 430000
89357 225000
984851 320000
1129408 250000
1088496 120000
687711 300000
994256 340000
109166 380000
1193139 325000
1226693 350000
In [ ]:
df10.style.bar(subset = ['Salary'], color = 'blue')
Out[ ]:
  Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation 12percentage 12board CollegeID CollegeTier Degree Specialization collegeGPA CollegeCityID CollegeCityTier CollegeState GraduationYear English Logical Quant Domain ComputerProgramming ElectronicsAndSemicon ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID                                                                          
902841 430000 2014-05-01 00:00:00 2014-08-01 00:00:00 software engineer Hyderabad m 1992-05-19 00:00:00 83.000000 state board 2010 82.000000 state board 9775 2 B.Tech/B.E. computer science & engineering 71.000000 9775 1 Telangana 2014 425 465 470 -1.000000 -1 -1 -1 -1 -1 -1 -1 -0.733500 -0.453600 0.163700 1.033300 -0.285900
89357 225000 2011-02-01 00:00:00 2011-07-01 00:00:00 technical support engineer Bangalore m 1989-01-05 00:00:00 69.000000 sslc 2006 50.000000 puc 1648 2 B.Tech/B.E. information technology 60.000000 1648 1 Karnataka 2010 404 375 395 0.488348 405 -1 -1 -1 -1 -1 -1 1.437400 -1.215300 -0.634300 -0.290200 -2.025300
984851 320000 2015-03-01 00:00:00 2015-05-01 00:00:00 system engineer Ahmedabad m 1993-08-20 00:00:00 78.170000 state board 2010 77.850000 state board 4948 2 B.Tech/B.E. electrical engineering 76.850000 4948 1 Rajasthan 2014 675 495 545 0.997698 -1 -1 -1 -1 676 -1 -1 1.133600 0.378900 0.163700 -0.741500 -0.669200
1129408 250000 2013-06-01 00:00:00 present system engineer Chennai m 1990-04-19 00:00:00 69.000000 state board 2009 61.300000 state board 5039 2 B.Tech/B.E. electronics and communication engineering 69.000000 5039 0 Andhra Pradesh 2013 430 425 295 0.338786 175 292 -1 -1 -1 -1 -1 0.128200 0.545400 -0.604800 0.019200 -1.052400
1088496 120000 2014-08-01 00:00:00 present junior software engineer Trivandrum m 1990-11-16 00:00:00 75.000000 cbse 2009 80.000000 state board 10361 2 B.Tech/B.E. electronics and communication engineering 60.850000 10361 0 Kerala 2013 570 580 750 -1.000000 495 -1 -1 -1 -1 -1 -1 -0.446300 0.045900 -0.758500 -1.248600 -0.477600
687711 300000 2014-06-01 00:00:00 present software engineer noida m 1990-10-31 00:00:00 83.200000 cbse 2009 67.000000 state board 7814 2 B.Tech/B.E. computer science & engineering 70.700000 7814 0 Orissa 2013 565 615 445 0.744758 295 -1 438 -1 -1 -1 -1 -1.451700 0.212400 0.163700 -0.741500 -0.860800
994256 340000 2014-04-01 00:00:00 2015-04-01 00:00:00 web application developer Bangalore m 1991-12-13 00:00:00 74.000000 state board 2009 78.000000 state board 10389 2 B.Tech/B.E. electronics & telecommunications 73.720000 10389 0 Madhya Pradesh 2013 405 470 585 0.783304 505 388 -1 -1 -1 -1 -1 0.559100 0.045900 0.624800 0.526200 1.630200
109166 380000 2012-02-01 00:00:00 2014-08-01 00:00:00 software engineer Pune f 1989-09-03 00:00:00 79.830000 gshseb 2006 68.330000 gshseb 988 2 B.Tech/B.E. electronics and communication engineering 68.740000 988 0 Gujarat 2010 435 605 685 0.824666 -1 400 -1 -1 -1 -1 -1 0.200900 0.032800 -0.053700 -1.465300 0.186400
1193139 325000 2014-08-01 00:00:00 2015-04-01 00:00:00 software engineer Bangalore m 1992-06-25 00:00:00 71.840000 state board 2010 66.830000 state board 3770 2 B.Tech/B.E. computer science & engineering 70.350000 3770 0 Karnataka 2016 640 615 585 0.974396 615 -1 -1 -1 -1 -1 -1 0.128200 0.212400 -0.912200 1.033300 -0.094300
1226693 350000 2015-02-01 00:00:00 present front end developer Gurgaon f 1993-08-12 00:00:00 92.000000 cbse 2011 85.600000 cbse 115 2 B.Tech/B.E. computer science & engineering 91.000000 115 0 Punjab 2015 535 480 605 -1.000000 -1 -1 -1 -1 -1 -1 -1 -1.164400 0.711900 -0.604800 -0.361200 0.672100
In [ ]:
df10[['Salary']].style.bar(color='blue')
Out[ ]:
  Salary
ID  
902841 430000
89357 225000
984851 320000
1129408 250000
1088496 120000
687711 300000
994256 340000
109166 380000
1193139 325000
1226693 350000
In [ ]:
def gender_color(x):
    color = "red" if x == "M" else ""
    return "color:" + color

applying function on Gender col

In [ ]:
df10.style.applymap(gender_color)
Out[ ]:
  Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation 12percentage 12board CollegeID CollegeTier Degree Specialization collegeGPA CollegeCityID CollegeCityTier CollegeState GraduationYear English Logical Quant Domain ComputerProgramming ElectronicsAndSemicon ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID                                                                          
902841 430000 2014-05-01 00:00:00 2014-08-01 00:00:00 software engineer Hyderabad m 1992-05-19 00:00:00 83.000000 state board 2010 82.000000 state board 9775 2 B.Tech/B.E. computer science & engineering 71.000000 9775 1 Telangana 2014 425 465 470 -1.000000 -1 -1 -1 -1 -1 -1 -1 -0.733500 -0.453600 0.163700 1.033300 -0.285900
89357 225000 2011-02-01 00:00:00 2011-07-01 00:00:00 technical support engineer Bangalore m 1989-01-05 00:00:00 69.000000 sslc 2006 50.000000 puc 1648 2 B.Tech/B.E. information technology 60.000000 1648 1 Karnataka 2010 404 375 395 0.488348 405 -1 -1 -1 -1 -1 -1 1.437400 -1.215300 -0.634300 -0.290200 -2.025300
984851 320000 2015-03-01 00:00:00 2015-05-01 00:00:00 system engineer Ahmedabad m 1993-08-20 00:00:00 78.170000 state board 2010 77.850000 state board 4948 2 B.Tech/B.E. electrical engineering 76.850000 4948 1 Rajasthan 2014 675 495 545 0.997698 -1 -1 -1 -1 676 -1 -1 1.133600 0.378900 0.163700 -0.741500 -0.669200
1129408 250000 2013-06-01 00:00:00 present system engineer Chennai m 1990-04-19 00:00:00 69.000000 state board 2009 61.300000 state board 5039 2 B.Tech/B.E. electronics and communication engineering 69.000000 5039 0 Andhra Pradesh 2013 430 425 295 0.338786 175 292 -1 -1 -1 -1 -1 0.128200 0.545400 -0.604800 0.019200 -1.052400
1088496 120000 2014-08-01 00:00:00 present junior software engineer Trivandrum m 1990-11-16 00:00:00 75.000000 cbse 2009 80.000000 state board 10361 2 B.Tech/B.E. electronics and communication engineering 60.850000 10361 0 Kerala 2013 570 580 750 -1.000000 495 -1 -1 -1 -1 -1 -1 -0.446300 0.045900 -0.758500 -1.248600 -0.477600
687711 300000 2014-06-01 00:00:00 present software engineer noida m 1990-10-31 00:00:00 83.200000 cbse 2009 67.000000 state board 7814 2 B.Tech/B.E. computer science & engineering 70.700000 7814 0 Orissa 2013 565 615 445 0.744758 295 -1 438 -1 -1 -1 -1 -1.451700 0.212400 0.163700 -0.741500 -0.860800
994256 340000 2014-04-01 00:00:00 2015-04-01 00:00:00 web application developer Bangalore m 1991-12-13 00:00:00 74.000000 state board 2009 78.000000 state board 10389 2 B.Tech/B.E. electronics & telecommunications 73.720000 10389 0 Madhya Pradesh 2013 405 470 585 0.783304 505 388 -1 -1 -1 -1 -1 0.559100 0.045900 0.624800 0.526200 1.630200
109166 380000 2012-02-01 00:00:00 2014-08-01 00:00:00 software engineer Pune f 1989-09-03 00:00:00 79.830000 gshseb 2006 68.330000 gshseb 988 2 B.Tech/B.E. electronics and communication engineering 68.740000 988 0 Gujarat 2010 435 605 685 0.824666 -1 400 -1 -1 -1 -1 -1 0.200900 0.032800 -0.053700 -1.465300 0.186400
1193139 325000 2014-08-01 00:00:00 2015-04-01 00:00:00 software engineer Bangalore m 1992-06-25 00:00:00 71.840000 state board 2010 66.830000 state board 3770 2 B.Tech/B.E. computer science & engineering 70.350000 3770 0 Karnataka 2016 640 615 585 0.974396 615 -1 -1 -1 -1 -1 -1 0.128200 0.212400 -0.912200 1.033300 -0.094300
1226693 350000 2015-02-01 00:00:00 present front end developer Gurgaon f 1993-08-12 00:00:00 92.000000 cbse 2011 85.600000 cbse 115 2 B.Tech/B.E. computer science & engineering 91.000000 115 0 Punjab 2015 535 480 605 -1.000000 -1 -1 -1 -1 -1 -1 -1 -1.164400 0.711900 -0.604800 -0.361200 0.672100
In [ ]:
df10[['10percentage']].style.highlight_max(color='red').highlight_min(color='green')
Out[ ]:
  10percentage
ID  
902841 83.000000
89357 69.000000
984851 78.170000
1129408 69.000000
1088496 75.000000
687711 83.200000
994256 74.000000
109166 79.830000
1193139 71.840000
1226693 92.000000

For every cell in the DataFrame, if the value is less than 6 then we will highlight the cell with red color, otherwise with blue color.

link: https://www.geeksforgeeks.org/highlight-pandas-dataframes-specific-columns-using-applymap/?ref=rp

Write a function to find the max value and make it bold

  • apply() is used to apply a function along an axis or column of the DataFrame or on values of Series.
  • applymap() is used to apply a function to each element in a DataFrame.
  • map() is used to substitute each value in a Series with another value
In [ ]:
# importing pandas as pd
import pandas as pd

# creating the dataframe
df = pd.DataFrame({"A" : [14, 4, 5, 4, 1],
				"B" : [5, 2, 54, 3, 2],
				"C" : [20, 20, 7, 3, 8],
				"D" : [14, 3, 6, 2, 6]})

print("Original DataFrame :")
display(df)
Original DataFrame :
A B C D
0 14 5 20 14
1 4 2 20 3
2 5 54 7 6
3 4 3 3 2
4 1 2 8 6
In [ ]:
# function definition
def highlight_cols(s):
    color = 'red' if s < 6 else 'blue'
    return 'background-color: % s' % color
  
# highlighting the cells
display(df.style.applymap(highlight_cols))
  A B C D
0 14 5 20 14
1 4 2 20 3
2 5 54 7 6
3 4 3 3 2
4 1 2 8 6
In [ ]:
# function definition
def highlight_cols(s):
    color = "red" if s < 10 else "blue"
    # return 'background-color: % s' % 'green' if s < 10 else "blue"
    return "color:" + color
    # return 'background-color:' + color
  
# highlighting the cells
display(df.style.applymap(highlight_cols, 
                          subset = pd.IndexSlice[:, ['B', 'C']]))
  A B C D
0 14 5 20 14
1 4 2 20 3
2 5 54 7 6
3 4 3 3 2
4 1 2 8 6
In [ ]:
df10.head(2)
Out[ ]:
Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation ... ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID
902841 430000 2014-05-01 2014-08-01 00:00:00 software engineer Hyderabad m 1992-05-19 83.0 state board 2010 ... -1 -1 -1 -1 -1 -0.7335 -0.4536 0.1637 1.0333 -0.2859
89357 225000 2011-02-01 2011-07-01 00:00:00 technical support engineer Bangalore m 1989-01-05 69.0 sslc 2006 ... -1 -1 -1 -1 -1 1.4374 -1.2153 -0.6343 -0.2902 -2.0253

2 rows × 37 columns

apply color code for multiple colums with IndexSlice Option

In [ ]:
# function definition
def highlight_cols(s):
    color = "red" if s <= 70 else "green"
    # return 'background-color: % s' % 'green'
    # return "color:" + color
    return 'background-color: ' + color
  
# highlighting the cells
display(df10.style.applymap(highlight_cols, 
                          subset = pd.IndexSlice[:, ['10percentage', '12percentage']]))
  Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation 12percentage 12board CollegeID CollegeTier Degree Specialization collegeGPA CollegeCityID CollegeCityTier CollegeState GraduationYear English Logical Quant Domain ComputerProgramming ElectronicsAndSemicon ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID                                                                          
902841 430000 2014-05-01 00:00:00 2014-08-01 00:00:00 software engineer Hyderabad m 1992-05-19 00:00:00 83.000000 state board 2010 82.000000 state board 9775 2 B.Tech/B.E. computer science & engineering 71.000000 9775 1 Telangana 2014 425 465 470 -1.000000 -1 -1 -1 -1 -1 -1 -1 -0.733500 -0.453600 0.163700 1.033300 -0.285900
89357 225000 2011-02-01 00:00:00 2011-07-01 00:00:00 technical support engineer Bangalore m 1989-01-05 00:00:00 69.000000 sslc 2006 50.000000 puc 1648 2 B.Tech/B.E. information technology 60.000000 1648 1 Karnataka 2010 404 375 395 0.488348 405 -1 -1 -1 -1 -1 -1 1.437400 -1.215300 -0.634300 -0.290200 -2.025300
984851 320000 2015-03-01 00:00:00 2015-05-01 00:00:00 system engineer Ahmedabad m 1993-08-20 00:00:00 78.170000 state board 2010 77.850000 state board 4948 2 B.Tech/B.E. electrical engineering 76.850000 4948 1 Rajasthan 2014 675 495 545 0.997698 -1 -1 -1 -1 676 -1 -1 1.133600 0.378900 0.163700 -0.741500 -0.669200
1129408 250000 2013-06-01 00:00:00 present system engineer Chennai m 1990-04-19 00:00:00 69.000000 state board 2009 61.300000 state board 5039 2 B.Tech/B.E. electronics and communication engineering 69.000000 5039 0 Andhra Pradesh 2013 430 425 295 0.338786 175 292 -1 -1 -1 -1 -1 0.128200 0.545400 -0.604800 0.019200 -1.052400
1088496 120000 2014-08-01 00:00:00 present junior software engineer Trivandrum m 1990-11-16 00:00:00 75.000000 cbse 2009 80.000000 state board 10361 2 B.Tech/B.E. electronics and communication engineering 60.850000 10361 0 Kerala 2013 570 580 750 -1.000000 495 -1 -1 -1 -1 -1 -1 -0.446300 0.045900 -0.758500 -1.248600 -0.477600
687711 300000 2014-06-01 00:00:00 present software engineer noida m 1990-10-31 00:00:00 83.200000 cbse 2009 67.000000 state board 7814 2 B.Tech/B.E. computer science & engineering 70.700000 7814 0 Orissa 2013 565 615 445 0.744758 295 -1 438 -1 -1 -1 -1 -1.451700 0.212400 0.163700 -0.741500 -0.860800
994256 340000 2014-04-01 00:00:00 2015-04-01 00:00:00 web application developer Bangalore m 1991-12-13 00:00:00 74.000000 state board 2009 78.000000 state board 10389 2 B.Tech/B.E. electronics & telecommunications 73.720000 10389 0 Madhya Pradesh 2013 405 470 585 0.783304 505 388 -1 -1 -1 -1 -1 0.559100 0.045900 0.624800 0.526200 1.630200
109166 380000 2012-02-01 00:00:00 2014-08-01 00:00:00 software engineer Pune f 1989-09-03 00:00:00 79.830000 gshseb 2006 68.330000 gshseb 988 2 B.Tech/B.E. electronics and communication engineering 68.740000 988 0 Gujarat 2010 435 605 685 0.824666 -1 400 -1 -1 -1 -1 -1 0.200900 0.032800 -0.053700 -1.465300 0.186400
1193139 325000 2014-08-01 00:00:00 2015-04-01 00:00:00 software engineer Bangalore m 1992-06-25 00:00:00 71.840000 state board 2010 66.830000 state board 3770 2 B.Tech/B.E. computer science & engineering 70.350000 3770 0 Karnataka 2016 640 615 585 0.974396 615 -1 -1 -1 -1 -1 -1 0.128200 0.212400 -0.912200 1.033300 -0.094300
1226693 350000 2015-02-01 00:00:00 present front end developer Gurgaon f 1993-08-12 00:00:00 92.000000 cbse 2011 85.600000 cbse 115 2 B.Tech/B.E. computer science & engineering 91.000000 115 0 Punjab 2015 535 480 605 -1.000000 -1 -1 -1 -1 -1 -1 -1 -1.164400 0.711900 -0.604800 -0.361200 0.672100

apply color code for one column

In [ ]:
def highlight_cols(s):
    color = "red" if s <= 70 else "green"
    return 'background-color: ' + color
In [ ]:
display(df10.style.applymap(highlight_cols, subset = pd.IndexSlice[:, ['12percentage']]))
  Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation 12percentage 12board CollegeID CollegeTier Degree Specialization collegeGPA CollegeCityID CollegeCityTier CollegeState GraduationYear English Logical Quant Domain ComputerProgramming ElectronicsAndSemicon ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID                                                                          
902841 430000 2014-05-01 00:00:00 2014-08-01 00:00:00 software engineer Hyderabad m 1992-05-19 00:00:00 83.000000 state board 2010 82.000000 state board 9775 2 B.Tech/B.E. computer science & engineering 71.000000 9775 1 Telangana 2014 425 465 470 -1.000000 -1 -1 -1 -1 -1 -1 -1 -0.733500 -0.453600 0.163700 1.033300 -0.285900
89357 225000 2011-02-01 00:00:00 2011-07-01 00:00:00 technical support engineer Bangalore m 1989-01-05 00:00:00 69.000000 sslc 2006 50.000000 puc 1648 2 B.Tech/B.E. information technology 60.000000 1648 1 Karnataka 2010 404 375 395 0.488348 405 -1 -1 -1 -1 -1 -1 1.437400 -1.215300 -0.634300 -0.290200 -2.025300
984851 320000 2015-03-01 00:00:00 2015-05-01 00:00:00 system engineer Ahmedabad m 1993-08-20 00:00:00 78.170000 state board 2010 77.850000 state board 4948 2 B.Tech/B.E. electrical engineering 76.850000 4948 1 Rajasthan 2014 675 495 545 0.997698 -1 -1 -1 -1 676 -1 -1 1.133600 0.378900 0.163700 -0.741500 -0.669200
1129408 250000 2013-06-01 00:00:00 present system engineer Chennai m 1990-04-19 00:00:00 69.000000 state board 2009 61.300000 state board 5039 2 B.Tech/B.E. electronics and communication engineering 69.000000 5039 0 Andhra Pradesh 2013 430 425 295 0.338786 175 292 -1 -1 -1 -1 -1 0.128200 0.545400 -0.604800 0.019200 -1.052400
1088496 120000 2014-08-01 00:00:00 present junior software engineer Trivandrum m 1990-11-16 00:00:00 75.000000 cbse 2009 80.000000 state board 10361 2 B.Tech/B.E. electronics and communication engineering 60.850000 10361 0 Kerala 2013 570 580 750 -1.000000 495 -1 -1 -1 -1 -1 -1 -0.446300 0.045900 -0.758500 -1.248600 -0.477600
687711 300000 2014-06-01 00:00:00 present software engineer noida m 1990-10-31 00:00:00 83.200000 cbse 2009 67.000000 state board 7814 2 B.Tech/B.E. computer science & engineering 70.700000 7814 0 Orissa 2013 565 615 445 0.744758 295 -1 438 -1 -1 -1 -1 -1.451700 0.212400 0.163700 -0.741500 -0.860800
994256 340000 2014-04-01 00:00:00 2015-04-01 00:00:00 web application developer Bangalore m 1991-12-13 00:00:00 74.000000 state board 2009 78.000000 state board 10389 2 B.Tech/B.E. electronics & telecommunications 73.720000 10389 0 Madhya Pradesh 2013 405 470 585 0.783304 505 388 -1 -1 -1 -1 -1 0.559100 0.045900 0.624800 0.526200 1.630200
109166 380000 2012-02-01 00:00:00 2014-08-01 00:00:00 software engineer Pune f 1989-09-03 00:00:00 79.830000 gshseb 2006 68.330000 gshseb 988 2 B.Tech/B.E. electronics and communication engineering 68.740000 988 0 Gujarat 2010 435 605 685 0.824666 -1 400 -1 -1 -1 -1 -1 0.200900 0.032800 -0.053700 -1.465300 0.186400
1193139 325000 2014-08-01 00:00:00 2015-04-01 00:00:00 software engineer Bangalore m 1992-06-25 00:00:00 71.840000 state board 2010 66.830000 state board 3770 2 B.Tech/B.E. computer science & engineering 70.350000 3770 0 Karnataka 2016 640 615 585 0.974396 615 -1 -1 -1 -1 -1 -1 0.128200 0.212400 -0.912200 1.033300 -0.094300
1226693 350000 2015-02-01 00:00:00 present front end developer Gurgaon f 1993-08-12 00:00:00 92.000000 cbse 2011 85.600000 cbse 115 2 B.Tech/B.E. computer science & engineering 91.000000 115 0 Punjab 2015 535 480 605 -1.000000 -1 -1 -1 -1 -1 -1 -1 -1.164400 0.711900 -0.604800 -0.361200 0.672100
In [ ]:
df10.style.applymap(highlight_cols, subset = pd.IndexSlice[:, ['10percentage']]).bar(color='blue')
Out[ ]:
  Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation 12percentage 12board CollegeID CollegeTier Degree Specialization collegeGPA CollegeCityID CollegeCityTier CollegeState GraduationYear English Logical Quant Domain ComputerProgramming ElectronicsAndSemicon ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID                                                                          
902841 430000 2014-05-01 00:00:00 2014-08-01 00:00:00 software engineer Hyderabad m 1992-05-19 00:00:00 83.000000 state board 2010 82.000000 state board 9775 2 B.Tech/B.E. computer science & engineering 71.000000 9775 1 Telangana 2014 425 465 470 -1.000000 -1 -1 -1 -1 -1 -1 -1 -0.733500 -0.453600 0.163700 1.033300 -0.285900
89357 225000 2011-02-01 00:00:00 2011-07-01 00:00:00 technical support engineer Bangalore m 1989-01-05 00:00:00 69.000000 sslc 2006 50.000000 puc 1648 2 B.Tech/B.E. information technology 60.000000 1648 1 Karnataka 2010 404 375 395 0.488348 405 -1 -1 -1 -1 -1 -1 1.437400 -1.215300 -0.634300 -0.290200 -2.025300
984851 320000 2015-03-01 00:00:00 2015-05-01 00:00:00 system engineer Ahmedabad m 1993-08-20 00:00:00 78.170000 state board 2010 77.850000 state board 4948 2 B.Tech/B.E. electrical engineering 76.850000 4948 1 Rajasthan 2014 675 495 545 0.997698 -1 -1 -1 -1 676 -1 -1 1.133600 0.378900 0.163700 -0.741500 -0.669200
1129408 250000 2013-06-01 00:00:00 present system engineer Chennai m 1990-04-19 00:00:00 69.000000 state board 2009 61.300000 state board 5039 2 B.Tech/B.E. electronics and communication engineering 69.000000 5039 0 Andhra Pradesh 2013 430 425 295 0.338786 175 292 -1 -1 -1 -1 -1 0.128200 0.545400 -0.604800 0.019200 -1.052400
1088496 120000 2014-08-01 00:00:00 present junior software engineer Trivandrum m 1990-11-16 00:00:00 75.000000 cbse 2009 80.000000 state board 10361 2 B.Tech/B.E. electronics and communication engineering 60.850000 10361 0 Kerala 2013 570 580 750 -1.000000 495 -1 -1 -1 -1 -1 -1 -0.446300 0.045900 -0.758500 -1.248600 -0.477600
687711 300000 2014-06-01 00:00:00 present software engineer noida m 1990-10-31 00:00:00 83.200000 cbse 2009 67.000000 state board 7814 2 B.Tech/B.E. computer science & engineering 70.700000 7814 0 Orissa 2013 565 615 445 0.744758 295 -1 438 -1 -1 -1 -1 -1.451700 0.212400 0.163700 -0.741500 -0.860800
994256 340000 2014-04-01 00:00:00 2015-04-01 00:00:00 web application developer Bangalore m 1991-12-13 00:00:00 74.000000 state board 2009 78.000000 state board 10389 2 B.Tech/B.E. electronics & telecommunications 73.720000 10389 0 Madhya Pradesh 2013 405 470 585 0.783304 505 388 -1 -1 -1 -1 -1 0.559100 0.045900 0.624800 0.526200 1.630200
109166 380000 2012-02-01 00:00:00 2014-08-01 00:00:00 software engineer Pune f 1989-09-03 00:00:00 79.830000 gshseb 2006 68.330000 gshseb 988 2 B.Tech/B.E. electronics and communication engineering 68.740000 988 0 Gujarat 2010 435 605 685 0.824666 -1 400 -1 -1 -1 -1 -1 0.200900 0.032800 -0.053700 -1.465300 0.186400
1193139 325000 2014-08-01 00:00:00 2015-04-01 00:00:00 software engineer Bangalore m 1992-06-25 00:00:00 71.840000 state board 2010 66.830000 state board 3770 2 B.Tech/B.E. computer science & engineering 70.350000 3770 0 Karnataka 2016 640 615 585 0.974396 615 -1 -1 -1 -1 -1 -1 0.128200 0.212400 -0.912200 1.033300 -0.094300
1226693 350000 2015-02-01 00:00:00 present front end developer Gurgaon f 1993-08-12 00:00:00 92.000000 cbse 2011 85.600000 cbse 115 2 B.Tech/B.E. computer science & engineering 91.000000 115 0 Punjab 2015 535 480 605 -1.000000 -1 -1 -1 -1 -1 -1 -1 -1.164400 0.711900 -0.604800 -0.361200 0.672100

apply style with bar only for two cols with SUBSET option

In [ ]:
df10.style.bar(subset=['10percentage','12percentage', 'English', 'Logical', 'Quant'], color="blue")
Out[ ]:
  Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation 12percentage 12board CollegeID CollegeTier Degree Specialization collegeGPA CollegeCityID CollegeCityTier CollegeState GraduationYear English Logical Quant Domain ComputerProgramming ElectronicsAndSemicon ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID                                                                          
902841 430000 2014-05-01 00:00:00 2014-08-01 00:00:00 software engineer Hyderabad m 1992-05-19 00:00:00 83.000000 state board 2010 82.000000 state board 9775 2 B.Tech/B.E. computer science & engineering 71.000000 9775 1 Telangana 2014 425 465 470 -1.000000 -1 -1 -1 -1 -1 -1 -1 -0.733500 -0.453600 0.163700 1.033300 -0.285900
89357 225000 2011-02-01 00:00:00 2011-07-01 00:00:00 technical support engineer Bangalore m 1989-01-05 00:00:00 69.000000 sslc 2006 50.000000 puc 1648 2 B.Tech/B.E. information technology 60.000000 1648 1 Karnataka 2010 404 375 395 0.488348 405 -1 -1 -1 -1 -1 -1 1.437400 -1.215300 -0.634300 -0.290200 -2.025300
984851 320000 2015-03-01 00:00:00 2015-05-01 00:00:00 system engineer Ahmedabad m 1993-08-20 00:00:00 78.170000 state board 2010 77.850000 state board 4948 2 B.Tech/B.E. electrical engineering 76.850000 4948 1 Rajasthan 2014 675 495 545 0.997698 -1 -1 -1 -1 676 -1 -1 1.133600 0.378900 0.163700 -0.741500 -0.669200
1129408 250000 2013-06-01 00:00:00 present system engineer Chennai m 1990-04-19 00:00:00 69.000000 state board 2009 61.300000 state board 5039 2 B.Tech/B.E. electronics and communication engineering 69.000000 5039 0 Andhra Pradesh 2013 430 425 295 0.338786 175 292 -1 -1 -1 -1 -1 0.128200 0.545400 -0.604800 0.019200 -1.052400
1088496 120000 2014-08-01 00:00:00 present junior software engineer Trivandrum m 1990-11-16 00:00:00 75.000000 cbse 2009 80.000000 state board 10361 2 B.Tech/B.E. electronics and communication engineering 60.850000 10361 0 Kerala 2013 570 580 750 -1.000000 495 -1 -1 -1 -1 -1 -1 -0.446300 0.045900 -0.758500 -1.248600 -0.477600
687711 300000 2014-06-01 00:00:00 present software engineer noida m 1990-10-31 00:00:00 83.200000 cbse 2009 67.000000 state board 7814 2 B.Tech/B.E. computer science & engineering 70.700000 7814 0 Orissa 2013 565 615 445 0.744758 295 -1 438 -1 -1 -1 -1 -1.451700 0.212400 0.163700 -0.741500 -0.860800
994256 340000 2014-04-01 00:00:00 2015-04-01 00:00:00 web application developer Bangalore m 1991-12-13 00:00:00 74.000000 state board 2009 78.000000 state board 10389 2 B.Tech/B.E. electronics & telecommunications 73.720000 10389 0 Madhya Pradesh 2013 405 470 585 0.783304 505 388 -1 -1 -1 -1 -1 0.559100 0.045900 0.624800 0.526200 1.630200
109166 380000 2012-02-01 00:00:00 2014-08-01 00:00:00 software engineer Pune f 1989-09-03 00:00:00 79.830000 gshseb 2006 68.330000 gshseb 988 2 B.Tech/B.E. electronics and communication engineering 68.740000 988 0 Gujarat 2010 435 605 685 0.824666 -1 400 -1 -1 -1 -1 -1 0.200900 0.032800 -0.053700 -1.465300 0.186400
1193139 325000 2014-08-01 00:00:00 2015-04-01 00:00:00 software engineer Bangalore m 1992-06-25 00:00:00 71.840000 state board 2010 66.830000 state board 3770 2 B.Tech/B.E. computer science & engineering 70.350000 3770 0 Karnataka 2016 640 615 585 0.974396 615 -1 -1 -1 -1 -1 -1 0.128200 0.212400 -0.912200 1.033300 -0.094300
1226693 350000 2015-02-01 00:00:00 present front end developer Gurgaon f 1993-08-12 00:00:00 92.000000 cbse 2011 85.600000 cbse 115 2 B.Tech/B.E. computer science & engineering 91.000000 115 0 Punjab 2015 535 480 605 -1.000000 -1 -1 -1 -1 -1 -1 -1 -1.164400 0.711900 -0.604800 -0.361200 0.672100
In [ ]:
## highlight min and max values
In [ ]:
df10.style.highlight_max(subset=['10percentage', '12percentage'], color='red')
Out[ ]:
  Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation 12percentage 12board CollegeID CollegeTier Degree Specialization collegeGPA CollegeCityID CollegeCityTier CollegeState GraduationYear English Logical Quant Domain ComputerProgramming ElectronicsAndSemicon ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID                                                                          
902841 430000 2014-05-01 00:00:00 2014-08-01 00:00:00 software engineer Hyderabad m 1992-05-19 00:00:00 83.000000 state board 2010 82.000000 state board 9775 2 B.Tech/B.E. computer science & engineering 71.000000 9775 1 Telangana 2014 425 465 470 -1.000000 -1 -1 -1 -1 -1 -1 -1 -0.733500 -0.453600 0.163700 1.033300 -0.285900
89357 225000 2011-02-01 00:00:00 2011-07-01 00:00:00 technical support engineer Bangalore m 1989-01-05 00:00:00 69.000000 sslc 2006 50.000000 puc 1648 2 B.Tech/B.E. information technology 60.000000 1648 1 Karnataka 2010 404 375 395 0.488348 405 -1 -1 -1 -1 -1 -1 1.437400 -1.215300 -0.634300 -0.290200 -2.025300
984851 320000 2015-03-01 00:00:00 2015-05-01 00:00:00 system engineer Ahmedabad m 1993-08-20 00:00:00 78.170000 state board 2010 77.850000 state board 4948 2 B.Tech/B.E. electrical engineering 76.850000 4948 1 Rajasthan 2014 675 495 545 0.997698 -1 -1 -1 -1 676 -1 -1 1.133600 0.378900 0.163700 -0.741500 -0.669200
1129408 250000 2013-06-01 00:00:00 present system engineer Chennai m 1990-04-19 00:00:00 69.000000 state board 2009 61.300000 state board 5039 2 B.Tech/B.E. electronics and communication engineering 69.000000 5039 0 Andhra Pradesh 2013 430 425 295 0.338786 175 292 -1 -1 -1 -1 -1 0.128200 0.545400 -0.604800 0.019200 -1.052400
1088496 120000 2014-08-01 00:00:00 present junior software engineer Trivandrum m 1990-11-16 00:00:00 75.000000 cbse 2009 80.000000 state board 10361 2 B.Tech/B.E. electronics and communication engineering 60.850000 10361 0 Kerala 2013 570 580 750 -1.000000 495 -1 -1 -1 -1 -1 -1 -0.446300 0.045900 -0.758500 -1.248600 -0.477600
687711 300000 2014-06-01 00:00:00 present software engineer noida m 1990-10-31 00:00:00 83.200000 cbse 2009 67.000000 state board 7814 2 B.Tech/B.E. computer science & engineering 70.700000 7814 0 Orissa 2013 565 615 445 0.744758 295 -1 438 -1 -1 -1 -1 -1.451700 0.212400 0.163700 -0.741500 -0.860800
994256 340000 2014-04-01 00:00:00 2015-04-01 00:00:00 web application developer Bangalore m 1991-12-13 00:00:00 74.000000 state board 2009 78.000000 state board 10389 2 B.Tech/B.E. electronics & telecommunications 73.720000 10389 0 Madhya Pradesh 2013 405 470 585 0.783304 505 388 -1 -1 -1 -1 -1 0.559100 0.045900 0.624800 0.526200 1.630200
109166 380000 2012-02-01 00:00:00 2014-08-01 00:00:00 software engineer Pune f 1989-09-03 00:00:00 79.830000 gshseb 2006 68.330000 gshseb 988 2 B.Tech/B.E. electronics and communication engineering 68.740000 988 0 Gujarat 2010 435 605 685 0.824666 -1 400 -1 -1 -1 -1 -1 0.200900 0.032800 -0.053700 -1.465300 0.186400
1193139 325000 2014-08-01 00:00:00 2015-04-01 00:00:00 software engineer Bangalore m 1992-06-25 00:00:00 71.840000 state board 2010 66.830000 state board 3770 2 B.Tech/B.E. computer science & engineering 70.350000 3770 0 Karnataka 2016 640 615 585 0.974396 615 -1 -1 -1 -1 -1 -1 0.128200 0.212400 -0.912200 1.033300 -0.094300
1226693 350000 2015-02-01 00:00:00 present front end developer Gurgaon f 1993-08-12 00:00:00 92.000000 cbse 2011 85.600000 cbse 115 2 B.Tech/B.E. computer science & engineering 91.000000 115 0 Punjab 2015 535 480 605 -1.000000 -1 -1 -1 -1 -1 -1 -1 -1.164400 0.711900 -0.604800 -0.361200 0.672100
In [ ]:
df10.style.highlight_max(subset=['10percentage', '12percentage'], color='red').highlight_min(subset = ['10percentage', "12percentage"], color='blue')
Out[ ]:
  Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation 12percentage 12board CollegeID CollegeTier Degree Specialization collegeGPA CollegeCityID CollegeCityTier CollegeState GraduationYear English Logical Quant Domain ComputerProgramming ElectronicsAndSemicon ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID                                                                          
902841 430000 2014-05-01 00:00:00 2014-08-01 00:00:00 software engineer Hyderabad m 1992-05-19 00:00:00 83.000000 state board 2010 82.000000 state board 9775 2 B.Tech/B.E. computer science & engineering 71.000000 9775 1 Telangana 2014 425 465 470 -1.000000 -1 -1 -1 -1 -1 -1 -1 -0.733500 -0.453600 0.163700 1.033300 -0.285900
89357 225000 2011-02-01 00:00:00 2011-07-01 00:00:00 technical support engineer Bangalore m 1989-01-05 00:00:00 69.000000 sslc 2006 50.000000 puc 1648 2 B.Tech/B.E. information technology 60.000000 1648 1 Karnataka 2010 404 375 395 0.488348 405 -1 -1 -1 -1 -1 -1 1.437400 -1.215300 -0.634300 -0.290200 -2.025300
984851 320000 2015-03-01 00:00:00 2015-05-01 00:00:00 system engineer Ahmedabad m 1993-08-20 00:00:00 78.170000 state board 2010 77.850000 state board 4948 2 B.Tech/B.E. electrical engineering 76.850000 4948 1 Rajasthan 2014 675 495 545 0.997698 -1 -1 -1 -1 676 -1 -1 1.133600 0.378900 0.163700 -0.741500 -0.669200
1129408 250000 2013-06-01 00:00:00 present system engineer Chennai m 1990-04-19 00:00:00 69.000000 state board 2009 61.300000 state board 5039 2 B.Tech/B.E. electronics and communication engineering 69.000000 5039 0 Andhra Pradesh 2013 430 425 295 0.338786 175 292 -1 -1 -1 -1 -1 0.128200 0.545400 -0.604800 0.019200 -1.052400
1088496 120000 2014-08-01 00:00:00 present junior software engineer Trivandrum m 1990-11-16 00:00:00 75.000000 cbse 2009 80.000000 state board 10361 2 B.Tech/B.E. electronics and communication engineering 60.850000 10361 0 Kerala 2013 570 580 750 -1.000000 495 -1 -1 -1 -1 -1 -1 -0.446300 0.045900 -0.758500 -1.248600 -0.477600
687711 300000 2014-06-01 00:00:00 present software engineer noida m 1990-10-31 00:00:00 83.200000 cbse 2009 67.000000 state board 7814 2 B.Tech/B.E. computer science & engineering 70.700000 7814 0 Orissa 2013 565 615 445 0.744758 295 -1 438 -1 -1 -1 -1 -1.451700 0.212400 0.163700 -0.741500 -0.860800
994256 340000 2014-04-01 00:00:00 2015-04-01 00:00:00 web application developer Bangalore m 1991-12-13 00:00:00 74.000000 state board 2009 78.000000 state board 10389 2 B.Tech/B.E. electronics & telecommunications 73.720000 10389 0 Madhya Pradesh 2013 405 470 585 0.783304 505 388 -1 -1 -1 -1 -1 0.559100 0.045900 0.624800 0.526200 1.630200
109166 380000 2012-02-01 00:00:00 2014-08-01 00:00:00 software engineer Pune f 1989-09-03 00:00:00 79.830000 gshseb 2006 68.330000 gshseb 988 2 B.Tech/B.E. electronics and communication engineering 68.740000 988 0 Gujarat 2010 435 605 685 0.824666 -1 400 -1 -1 -1 -1 -1 0.200900 0.032800 -0.053700 -1.465300 0.186400
1193139 325000 2014-08-01 00:00:00 2015-04-01 00:00:00 software engineer Bangalore m 1992-06-25 00:00:00 71.840000 state board 2010 66.830000 state board 3770 2 B.Tech/B.E. computer science & engineering 70.350000 3770 0 Karnataka 2016 640 615 585 0.974396 615 -1 -1 -1 -1 -1 -1 0.128200 0.212400 -0.912200 1.033300 -0.094300
1226693 350000 2015-02-01 00:00:00 present front end developer Gurgaon f 1993-08-12 00:00:00 92.000000 cbse 2011 85.600000 cbse 115 2 B.Tech/B.E. computer science & engineering 91.000000 115 0 Punjab 2015 535 480 605 -1.000000 -1 -1 -1 -1 -1 -1 -1 -1.164400 0.711900 -0.604800 -0.361200 0.672100
In [ ]:
df10.style.background_gradient(cmap = 'red')
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/IPython/core/formatters.py in __call__(self, obj)
    332                 pass
    333             else:
--> 334                 return printer(obj)
    335             # Finally look for special method names
    336             method = get_real_method(obj, self.print_method)

/usr/local/lib/python3.7/dist-packages/google/colab/_reprs.py in new_formatter(dataframe)
     86 
     87   def new_formatter(dataframe):
---> 88     return dataframe.set_table_attributes('class="dataframe"')._repr_html_()  # pylint: disable=protected-access
     89 
     90   _original_df_formatters[key] = formatters[key].for_type_by_name(

/usr/local/lib/python3.7/dist-packages/pandas/io/formats/style.py in _repr_html_(self)
    214         Hooks into Jupyter notebook rich display system.
    215         """
--> 216         return self.render()
    217 
    218     def render(

/usr/local/lib/python3.7/dist-packages/pandas/io/formats/style.py in render(self, sparse_index, sparse_columns, **kwargs)
    270         if sparse_columns is None:
    271             sparse_columns = get_option("styler.sparse.columns")
--> 272         return self._render_html(sparse_index, sparse_columns, **kwargs)
    273 
    274     def set_tooltips(

/usr/local/lib/python3.7/dist-packages/pandas/io/formats/style_render.py in _render_html(self, sparse_index, sparse_columns, **kwargs)
    119         Generates a dict with necessary kwargs passed to jinja2 template.
    120         """
--> 121         self._compute()
    122         # TODO: namespace all the pandas keys
    123         d = self._translate(sparse_index, sparse_columns)

/usr/local/lib/python3.7/dist-packages/pandas/io/formats/style_render.py in _compute(self)
    158         r = self
    159         for func, args, kwargs in self._todo:
--> 160             r = func(self)(*args, **kwargs)
    161         return r
    162 

/usr/local/lib/python3.7/dist-packages/pandas/io/formats/style.py in _apply(self, func, axis, subset, **kwargs)
   1053         data = self.data.loc[subset]
   1054         if axis is not None:
-> 1055             result = data.apply(func, axis=axis, result_type="expand", **kwargs)
   1056             result.columns = data.columns
   1057         else:

/usr/local/lib/python3.7/dist-packages/pandas/core/frame.py in apply(self, func, axis, raw, result_type, args, **kwargs)
   8738             kwargs=kwargs,
   8739         )
-> 8740         return op.apply()
   8741 
   8742     def applymap(

/usr/local/lib/python3.7/dist-packages/pandas/core/apply.py in apply(self)
    686             return self.apply_raw()
    687 
--> 688         return self.apply_standard()
    689 
    690     def agg(self):

/usr/local/lib/python3.7/dist-packages/pandas/core/apply.py in apply_standard(self)
    810 
    811     def apply_standard(self):
--> 812         results, res_index = self.apply_series_generator()
    813 
    814         # wrap results

/usr/local/lib/python3.7/dist-packages/pandas/core/apply.py in apply_series_generator(self)
    826             for i, v in enumerate(series_gen):
    827                 # ignore SettingWithCopy here in case the user mutates
--> 828                 results[i] = self.f(v)
    829                 if isinstance(results[i], ABCSeries):
    830                     # If we have a view on v, we need to make a copy because

/usr/local/lib/python3.7/dist-packages/pandas/core/apply.py in f(x)
    129 
    130             def f(x):
--> 131                 return func(x, *args, **kwargs)
    132 
    133         else:

/usr/local/lib/python3.7/dist-packages/pandas/io/formats/style.py in _background_gradient(data, cmap, low, high, text_color_threshold, vmin, vmax, gmap, text_only)
   2816         # extend lower / upper bounds, compresses color range
   2817         norm = colors.Normalize(smin - (rng * low), smax + (rng * high))
-> 2818         rgbas = plt.cm.get_cmap(cmap)(norm(gmap))
   2819 
   2820         def relative_luminance(rgba) -> float:

/usr/local/lib/python3.7/dist-packages/matplotlib/cm.py in get_cmap(name, lut)
    132     if isinstance(name, colors.Colormap):
    133         return name
--> 134     cbook._check_in_list(sorted(cmap_d), name=name)
    135     if lut is None:
    136         return cmap_d[name]

/usr/local/lib/python3.7/dist-packages/matplotlib/cbook/__init__.py in _check_in_list(_values, **kwargs)
   2143             raise ValueError(
   2144                 "{!r} is not a valid value for {}; supported values are {}"
-> 2145                 .format(v, k, ', '.join(map(repr, values))))
   2146 
   2147 

ValueError: 'red' is not a valid value for name; supported values are 'Accent', 'Accent_r', 'Blues', 'Blues_r', 'BrBG', 'BrBG_r', 'BuGn', 'BuGn_r', 'BuPu', 'BuPu_r', 'CMRmap', 'CMRmap_r', 'Dark2', 'Dark2_r', 'GnBu', 'GnBu_r', 'Greens', 'Greens_r', 'Greys', 'Greys_r', 'OrRd', 'OrRd_r', 'Oranges', 'Oranges_r', 'PRGn', 'PRGn_r', 'Paired', 'Paired_r', 'Pastel1', 'Pastel1_r', 'Pastel2', 'Pastel2_r', 'PiYG', 'PiYG_r', 'PuBu', 'PuBuGn', 'PuBuGn_r', 'PuBu_r', 'PuOr', 'PuOr_r', 'PuRd', 'PuRd_r', 'Purples', 'Purples_r', 'RdBu', 'RdBu_r', 'RdGy', 'RdGy_r', 'RdPu', 'RdPu_r', 'RdYlBu', 'RdYlBu_r', 'RdYlGn', 'RdYlGn_r', 'Reds', 'Reds_r', 'Set1', 'Set1_r', 'Set2', 'Set2_r', 'Set3', 'Set3_r', 'Spectral', 'Spectral_r', 'Wistia', 'Wistia_r', 'YlGn', 'YlGnBu', 'YlGnBu_r', 'YlGn_r', 'YlOrBr', 'YlOrBr_r', 'YlOrRd', 'YlOrRd_r', 'afmhot', 'afmhot_r', 'autumn', 'autumn_r', 'binary', 'binary_r', 'bone', 'bone_r', 'brg', 'brg_r', 'bwr', 'bwr_r', 'cividis', 'cividis_r', 'cool', 'cool_r', 'coolwarm', 'coolwarm_r', 'copper', 'copper_r', 'crest', 'crest_r', 'cubehelix', 'cubehelix_r', 'flag', 'flag_r', 'flare', 'flare_r', 'gist_earth', 'gist_earth_r', 'gist_gray', 'gist_gray_r', 'gist_heat', 'gist_heat_r', 'gist_ncar', 'gist_ncar_r', 'gist_rainbow', 'gist_rainbow_r', 'gist_stern', 'gist_stern_r', 'gist_yarg', 'gist_yarg_r', 'gnuplot', 'gnuplot2', 'gnuplot2_r', 'gnuplot_r', 'gray', 'gray_r', 'hot', 'hot_r', 'hsv', 'hsv_r', 'icefire', 'icefire_r', 'inferno', 'inferno_r', 'jet', 'jet_r', 'magma...
Out[ ]:
<pandas.io.formats.style.Styler at 0x7f53ca4c9850>
In [ ]:
df10.style.background_gradient(cmap = 'Blues')
Out[ ]:
  Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation 12percentage 12board CollegeID CollegeTier Degree Specialization collegeGPA CollegeCityID CollegeCityTier CollegeState GraduationYear English Logical Quant Domain ComputerProgramming ElectronicsAndSemicon ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID                                                                          
902841 430000 2014-05-01 00:00:00 2014-08-01 00:00:00 software engineer Hyderabad m 1992-05-19 00:00:00 83.000000 state board 2010 82.000000 state board 9775 2 B.Tech/B.E. computer science & engineering 71.000000 9775 1 Telangana 2014 425 465 470 -1.000000 -1 -1 -1 -1 -1 -1 -1 -0.733500 -0.453600 0.163700 1.033300 -0.285900
89357 225000 2011-02-01 00:00:00 2011-07-01 00:00:00 technical support engineer Bangalore m 1989-01-05 00:00:00 69.000000 sslc 2006 50.000000 puc 1648 2 B.Tech/B.E. information technology 60.000000 1648 1 Karnataka 2010 404 375 395 0.488348 405 -1 -1 -1 -1 -1 -1 1.437400 -1.215300 -0.634300 -0.290200 -2.025300
984851 320000 2015-03-01 00:00:00 2015-05-01 00:00:00 system engineer Ahmedabad m 1993-08-20 00:00:00 78.170000 state board 2010 77.850000 state board 4948 2 B.Tech/B.E. electrical engineering 76.850000 4948 1 Rajasthan 2014 675 495 545 0.997698 -1 -1 -1 -1 676 -1 -1 1.133600 0.378900 0.163700 -0.741500 -0.669200
1129408 250000 2013-06-01 00:00:00 present system engineer Chennai m 1990-04-19 00:00:00 69.000000 state board 2009 61.300000 state board 5039 2 B.Tech/B.E. electronics and communication engineering 69.000000 5039 0 Andhra Pradesh 2013 430 425 295 0.338786 175 292 -1 -1 -1 -1 -1 0.128200 0.545400 -0.604800 0.019200 -1.052400
1088496 120000 2014-08-01 00:00:00 present junior software engineer Trivandrum m 1990-11-16 00:00:00 75.000000 cbse 2009 80.000000 state board 10361 2 B.Tech/B.E. electronics and communication engineering 60.850000 10361 0 Kerala 2013 570 580 750 -1.000000 495 -1 -1 -1 -1 -1 -1 -0.446300 0.045900 -0.758500 -1.248600 -0.477600
687711 300000 2014-06-01 00:00:00 present software engineer noida m 1990-10-31 00:00:00 83.200000 cbse 2009 67.000000 state board 7814 2 B.Tech/B.E. computer science & engineering 70.700000 7814 0 Orissa 2013 565 615 445 0.744758 295 -1 438 -1 -1 -1 -1 -1.451700 0.212400 0.163700 -0.741500 -0.860800
994256 340000 2014-04-01 00:00:00 2015-04-01 00:00:00 web application developer Bangalore m 1991-12-13 00:00:00 74.000000 state board 2009 78.000000 state board 10389 2 B.Tech/B.E. electronics & telecommunications 73.720000 10389 0 Madhya Pradesh 2013 405 470 585 0.783304 505 388 -1 -1 -1 -1 -1 0.559100 0.045900 0.624800 0.526200 1.630200
109166 380000 2012-02-01 00:00:00 2014-08-01 00:00:00 software engineer Pune f 1989-09-03 00:00:00 79.830000 gshseb 2006 68.330000 gshseb 988 2 B.Tech/B.E. electronics and communication engineering 68.740000 988 0 Gujarat 2010 435 605 685 0.824666 -1 400 -1 -1 -1 -1 -1 0.200900 0.032800 -0.053700 -1.465300 0.186400
1193139 325000 2014-08-01 00:00:00 2015-04-01 00:00:00 software engineer Bangalore m 1992-06-25 00:00:00 71.840000 state board 2010 66.830000 state board 3770 2 B.Tech/B.E. computer science & engineering 70.350000 3770 0 Karnataka 2016 640 615 585 0.974396 615 -1 -1 -1 -1 -1 -1 0.128200 0.212400 -0.912200 1.033300 -0.094300
1226693 350000 2015-02-01 00:00:00 present front end developer Gurgaon f 1993-08-12 00:00:00 92.000000 cbse 2011 85.600000 cbse 115 2 B.Tech/B.E. computer science & engineering 91.000000 115 0 Punjab 2015 535 480 605 -1.000000 -1 -1 -1 -1 -1 -1 -1 -1.164400 0.711900 -0.604800 -0.361200 0.672100
In [ ]:
df10.style.background_gradient(cmap = 'Pastel1')
Out[ ]:
  Salary DOJ DOL Designation JobCity Gender DOB 10percentage 10board 12graduation 12percentage 12board CollegeID CollegeTier Degree Specialization collegeGPA CollegeCityID CollegeCityTier CollegeState GraduationYear English Logical Quant Domain ComputerProgramming ElectronicsAndSemicon ComputerScience MechanicalEngg ElectricalEngg TelecomEngg CivilEngg conscientiousness agreeableness extraversion nueroticism openess_to_experience
ID                                                                          
902841 430000 2014-05-01 00:00:00 2014-08-01 00:00:00 software engineer Hyderabad m 1992-05-19 00:00:00 83.000000 state board 2010 82.000000 state board 9775 2 B.Tech/B.E. computer science & engineering 71.000000 9775 1 Telangana 2014 425 465 470 -1.000000 -1 -1 -1 -1 -1 -1 -1 -0.733500 -0.453600 0.163700 1.033300 -0.285900
89357 225000 2011-02-01 00:00:00 2011-07-01 00:00:00 technical support engineer Bangalore m 1989-01-05 00:00:00 69.000000 sslc 2006 50.000000 puc 1648 2 B.Tech/B.E. information technology 60.000000 1648 1 Karnataka 2010 404 375 395 0.488348 405 -1 -1 -1 -1 -1 -1 1.437400 -1.215300 -0.634300 -0.290200 -2.025300
984851 320000 2015-03-01 00:00:00 2015-05-01 00:00:00 system engineer Ahmedabad m 1993-08-20 00:00:00 78.170000 state board 2010 77.850000 state board 4948 2 B.Tech/B.E. electrical engineering 76.850000 4948 1 Rajasthan 2014 675 495 545 0.997698 -1 -1 -1 -1 676 -1 -1 1.133600 0.378900 0.163700 -0.741500 -0.669200
1129408 250000 2013-06-01 00:00:00 present system engineer Chennai m 1990-04-19 00:00:00 69.000000 state board 2009 61.300000 state board 5039 2 B.Tech/B.E. electronics and communication engineering 69.000000 5039 0 Andhra Pradesh 2013 430 425 295 0.338786 175 292 -1 -1 -1 -1 -1 0.128200 0.545400 -0.604800 0.019200 -1.052400
1088496 120000 2014-08-01 00:00:00 present junior software engineer Trivandrum m 1990-11-16 00:00:00 75.000000 cbse 2009 80.000000 state board 10361 2 B.Tech/B.E. electronics and communication engineering 60.850000 10361 0 Kerala 2013 570 580 750 -1.000000 495 -1 -1 -1 -1 -1 -1 -0.446300 0.045900 -0.758500 -1.248600 -0.477600
687711 300000 2014-06-01 00:00:00 present software engineer noida m 1990-10-31 00:00:00 83.200000 cbse 2009 67.000000 state board 7814 2 B.Tech/B.E. computer science & engineering 70.700000 7814 0 Orissa 2013 565 615 445 0.744758 295 -1 438 -1 -1 -1 -1 -1.451700 0.212400 0.163700 -0.741500 -0.860800
994256 340000 2014-04-01 00:00:00 2015-04-01 00:00:00 web application developer Bangalore m 1991-12-13 00:00:00 74.000000 state board 2009 78.000000 state board 10389 2 B.Tech/B.E. electronics & telecommunications 73.720000 10389 0 Madhya Pradesh 2013 405 470 585 0.783304 505 388 -1 -1 -1 -1 -1 0.559100 0.045900 0.624800 0.526200 1.630200
109166 380000 2012-02-01 00:00:00 2014-08-01 00:00:00 software engineer Pune f 1989-09-03 00:00:00 79.830000 gshseb 2006 68.330000 gshseb 988 2 B.Tech/B.E. electronics and communication engineering 68.740000 988 0 Gujarat 2010 435 605 685 0.824666 -1 400 -1 -1 -1 -1 -1 0.200900 0.032800 -0.053700 -1.465300 0.186400
1193139 325000 2014-08-01 00:00:00 2015-04-01 00:00:00 software engineer Bangalore m 1992-06-25 00:00:00 71.840000 state board 2010 66.830000 state board 3770 2 B.Tech/B.E. computer science & engineering 70.350000 3770 0 Karnataka 2016 640 615 585 0.974396 615 -1 -1 -1 -1 -1 -1 0.128200 0.212400 -0.912200 1.033300 -0.094300
1226693 350000 2015-02-01 00:00:00 present front end developer Gurgaon f 1993-08-12 00:00:00 92.000000 cbse 2011 85.600000 cbse 115 2 B.Tech/B.E. computer science & engineering 91.000000 115 0 Punjab 2015 535 480 605 -1.000000 -1 -1 -1 -1 -1 -1 -1 -1.164400 0.711900 -0.604800 -0.361200 0.672100
In [ ]:
d.groupby('Designation')['Designation'].count()
Out[ ]:
Designation
.net developer                   48
.net web developer                5
account executive                 4
account manager                   1
admin assistant                   2
                                 ..
web designer and seo              1
web developer                    77
web intern                        1
website developer/tester          2
windows systems administrator     1
Name: Designation, Length: 419, dtype: int64
In [ ]:
c = df10.groupby('JobCity')['JobCity'].count()
In [ ]:
plt.pie(c, labels = c.index)
Out[ ]:
([<matplotlib.patches.Wedge at 0x7f53ca96f350>,
  <matplotlib.patches.Wedge at 0x7f53ca96fa10>,
  <matplotlib.patches.Wedge at 0x7f53ca9b5290>,
  <matplotlib.patches.Wedge at 0x7f53ca9b5390>,
  <matplotlib.patches.Wedge at 0x7f53ca9bb4d0>,
  <matplotlib.patches.Wedge at 0x7f53ca9bbd90>,
  <matplotlib.patches.Wedge at 0x7f53ca96d3d0>,
  <matplotlib.patches.Wedge at 0x7f53ca96d050>],
 [Text(1.0461621663333946, 0.3399186987098808, 'Ahmedabad'),
  Text(-5.149471629032507e-08, 1.0999999999999988, 'Bangalore'),
  Text(-1.0461621981588756, 0.3399186007611085, 'Chennai'),
  Text(-1.0461621345079049, -0.3399187966586502, 'Gurgaon'),
  Text(-0.646563681703485, -0.8899187634284573, 'Hyderabad'),
  Text(1.2873679044788556e-07, -1.0999999999999925, 'Pune'),
  Text(0.646563890003987, -0.8899186120892812, 'Trivandrum'),
  Text(1.0461622140716127, -0.3399185517867209, 'noida')])

use semi-colon ";" to supress the running text before graph

In [ ]:
plt.pie(c, labels = c.index);
In [ ]:
plt.pie(c, labels = c.index, autopct = "%.2f%%");
In [ ]:
plt.pie(c, labels = c.index, autopct = "%.2f%%", rotatelabels = True);
In [ ]:
plt.pie(d.groupby('Designation')['Designation'].count());
In [ ]:
plt.pie(d.groupby('Designation')['Designation'].count(), autopct = "%2.f%%", pctdistance = 1.2);
In [ ]:
plt.pie(df10.groupby('Designation')['Designation'].count(), autopct="%.2f%%", pctdistance = 0.6, shadow=False, labeldistance = 2.1);