How to print mean/median of the wanted occupation? Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How to merge two dictionaries in a single expression?How do I check if a list is empty?How do I check whether a file exists without exceptions?How to flush output of print function?How can I safely create a nested directory in Python?Print in terminal with colors?How to print without newline or space?How do I sort a dictionary by value?How do I list all files of a directory?Meaning of @classmethod and @staticmethod for beginner?
Has a Nobel Peace laureate ever been accused of war crimes?
Does every subgroup of an abelian group have to be abelian?
Is it OK if I do not take the receipt in Germany?
Why do people think Winterfell crypts is the safest place for women, children and old people?
What is the ongoing value of the Kanban board to the developers as opposed to management
Are these square matrices always diagonalisable?
What does the black goddess statue do and what is it?
Determinant of a matrix with 2 equal rows
My admission is revoked after accepting the admission offer
What were wait-states, and why was it only an issue for PCs?
Why is arima in R one time step off?
What is a 'Key' in computer science?
When speaking, how do you change your mind mid-sentence?
Is Bran literally the world's memory?
"Working on a knee"
Why did Israel vote against lifting the American embargo on Cuba?
Retract an already submitted Recommendation Letter (written for an undergrad student)
So I pre ordered a game on my friends home screen but on my Xbox, does that mean I don't get the game and I lost 60$?
Does Prince Arnaud cause someone holding the Princess to lose?
Are there existing rules/lore for MTG planeswalkers?
Raising a bilingual kid. When should we introduce the majority language?
Was Objective-C really a hindrance to Apple software development?
Array Dynamic resize in heap
Where to find documentation for `whois` command options?
How to print mean/median of the wanted occupation?
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How to merge two dictionaries in a single expression?How do I check if a list is empty?How do I check whether a file exists without exceptions?How to flush output of print function?How can I safely create a nested directory in Python?Print in terminal with colors?How to print without newline or space?How do I sort a dictionary by value?How do I list all files of a directory?Meaning of @classmethod and @staticmethod for beginner?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Here's my code to print the mean and median of all the occupations.
occupation_lst = ['ALL OCCUPATIONS', 'MANAGEMENT', 'Chief executives', 'General and operations managers', 'Marketing and sales managers', 'Administrative services managers', 'Computer and information systems managers', 'Financial managers', 'Human resources managers', 'Industrial production managers', 'Purchasing managers', 'Transportation storage and distribution managers', 'Farmers ranchers and other agricultural managers', 'Construction managers', 'Education administrators', 'Architectural and engineering managers', 'Food service managers', 'Lodging managers', 'Medical and health services managers', 'Property real estate and community association managers', 'Social and community service managers', 'Managers all other', 'BUSINESS', 'Wholesale and retail buyers except farm products', 'Purchasing agents except wholesale retail and farm products', 'Claims adjusters appraisers examiners and investigators', 'Compliance officers', 'Cost estimators', 'Human resources workers', 'Logisticians', 'Management analysts', 'Market research analysts and marketing specialists', 'Business operations specialists all other', 'Accountants and auditors', 'Financial analysts', 'Personal financial advisors', 'Credit counselors and loan officers', 'COMPUTATIONAL', 'Computer systems analysts', 'Information security analysts', 'Computer programmers', 'Software developers applications and systems software', 'Web developers', 'Computer support specialists', 'Database administrators', 'Network and computer systems administrators', 'Computer network architects', 'Computer occupations all other', 'Operations research analysts', 'ENGINEERING', 'Architects except naval', 'Aerospace engineers', 'Chemical engineers', 'Civil engineers', 'Computer hardware engineers', 'Electrical and electronics engineers', 'Industrial engineers including health and safety', 'Mechanical engineers', 'Engineers all other', 'Drafters', 'Engineering technicians except drafters', 'Surveying and mapping technicians', 'SCIENCE', 'Medical scientists', 'Chemists and materials scientists', 'Environmental scientists and geoscientists', 'Physical scientists all other', 'Miscellaneous life physical and social science technicians', 'SOCIAL SERVICE', 'Counselors', 'Social workers', 'Clergy', 'LEGAL', 'Lawyers', 'EDUCATION', 'Postsecondary teachers', 'Elementary and middle school teachers', 'Secondary school teachers', 'Other teachers and instructors', 'ARTS', 'Designers', 'Producers and directors', 'Athletes coaches umpires and related workers', 'Editors', 'Broadcast and sound engineering technicians and radio operators', 'HEALTHCARE PROFESSIONAL', 'Pharmacists', 'Physicians and surgeons', 'Physical therapists', 'Registered nurses', 'Clinical laboratory technologists and technicians', 'Diagnostic related technologists and technicians', 'Emergency medical technicians and paramedics', 'Health practitioner support technologists and technicians', 'HEALTHCARE SUPPORT', 'Nursing psychiatric and home health aides', 'PROTECTIVE SERVICE', 'First-line supervisors of police and detectives', 'First-line supervisors of protective service workers all other', 'Firefighters', 'Bailiffs correctional officers and jailers', 'Detectives and criminal investigators', "Police and sheriff's patrol officers", 'Security guards and gaming surveillance officers', 'CULINARY', 'Chefs and head cooks', 'First-line supervisors of food preparation and serving workers', 'Cooks', 'Food preparation workers', 'Bartenders', 'Combined food preparation and serving workers including fast food', 'Waiters and waitresses', 'Dining room and cafeteria attendants and bartender helpers', 'Dishwashers', 'GROUNDSKEEPING', 'First-line supervisors of housekeeping and janitorial workers', 'First-line supervisors of landscaping lawn service and groundskeeping workers', 'Janitors and building cleaners', 'Maids and housekeeping cleaners', 'Pest control workers', 'Grounds maintenance workers', 'SERVICE', 'First-line supervisors of gaming workers', 'Baggage porters bellhops and concierges', 'Personal care aides', 'Recreation and fitness workers', 'SALES', 'First-line supervisors of retail sales workers', 'First-line supervisors of non-retail sales workers', 'Cashiers', 'Parts salespersons', 'Retail salespersons', 'Advertising sales agents', 'Insurance sales agents', 'Securities commodities and financial services sales agents', 'Sales representatives services all other', 'Sales representatives wholesale and manufacturing', 'Real estate brokers and sales agents', 'Sales and related workers all other', 'OFFICE', 'First-line supervisors of office and administrative support workers', 'Bill and account collectors', 'Bookkeeping accounting and auditing clerks', 'Customer service representatives', 'Hotel motel and resort desk clerks', 'Receptionists and information clerks', 'Couriers and messengers', 'Dispatchers', 'Postal service clerks', 'Postal service mail carriers', 'Production planning and expediting clerks', 'Shipping receiving and traffic clerks', 'Stock clerks and order fillers', 'Secretaries and administrative assistants', 'Data entry keyers', 'Insurance claims and policy processing clerks', 'Office clerks general', 'Office and administrative support workers all other', 'AGRICULTURAL', 'Miscellaneous agricultural workers', 'CONSTRUCTION', 'First-line supervisors of construction trades and extraction workers', 'Brickmasons blockmasons and stonemasons', 'Carpenters', 'Carpet floor and tile installers and finishers', 'Construction laborers', 'Operating engineers and other construction equipment operators', 'Drywall installers ceiling tile installers and tapers', 'Electricians', 'Painters construction and maintenance', 'Pipelayers plumbers pipefitters and steamfitters', 'Roofers', 'Sheet metal workers', 'Structural iron and steel workers', 'Construction and building inspectors', 'Highway maintenance workers', 'Mining machine operators', 'Other extraction workers', 'MAINTENANCE', 'First-line supervisors of mechanics installers and repairers', 'Computer automated teller and office machine repairers', 'Radio and telecommunications equipment installers and repairers', 'Security and fire alarm systems installers', 'Aircraft mechanics and service technicians', 'Automotive body and related repairers', 'Automotive service technicians and mechanics', 'Bus and truck mechanics and diesel engine specialists', 'Heavy vehicle and mobile equipment service technicians and mechanics', 'Miscellaneous vehicle and mobile equipment mechanics installers and repairers', 'Heating air conditioning and refrigeration mechanics and installers', 'Industrial and refractory machinery mechanics', 'Maintenance and repair workers general', 'Electrical power-line installers and repairers', 'Telecommunications line installers and repairers', 'Precision instrument and equipment repairers', 'Other installation maintenance and repair workers', 'PRODUCTION', 'First-line supervisors of production and operating workers', 'Electrical electronics and electromechanical assemblers', 'Miscellaneous assemblers and fabricators', 'Bakers', 'Butchers and other meat poultry and fish processing workers', 'Food processing workers all other', 'Computer control programmers and operators', 'Cutting punching and press machine setters operators and tenders metal and plastic', 'Machinists', 'Welding soldering and brazing workers', 'Metal workers and plastic workers all other', 'Printing press operators', 'Laundry and dry-cleaning workers', 'Stationary engineers and boiler operators', 'Water and wastewater treatment plant and system operators', 'Chemical processing machine setters operators and tenders', 'Crushing grinding polishing mixing and blending workers', 'Inspectors testers sorters samplers and weighers', 'Packaging and filling machine operators and tenders', 'Painting workers', 'Production workers all other', 'TRANSPORTATION', 'Supervisors of transportation and material moving workers', 'Aircraft pilots and flight engineers', 'Bus drivers', 'Driver/sales workers and truck drivers', 'Taxi drivers and chauffeurs', 'Railroad conductors and yardmasters', 'Automotive and watercraft service attendants', 'Crane and tower operators', 'Industrial truck and tractor operators', 'Cleaners of vehicles and equipment', 'Laborers and freight stock and material movers hand', 'Packers and packagers hand', 'Refuse and recyclable material collectors']
weekly_lst = [1351, 2041, 1260, 1462, 1191, 1728, 1408, 1365, 1485, 1348, 966, 769, 1329, 1423, 1899, 742, 985, 1210, 914, 1022, 1408, 1137, 926, 1009, 963, 1198, 1232, 1002, 1028, 1431, 1284, 1090, 1132, 1426, 1419, 997, 1428, 1389, 1538, 1438, 1682, 1165, 1079, 1536, 1242, 1552, 1227, 1441, 1424, 1441, 1662, 1532, 1460, 1876, 1778, 1447, 1534, 1527, 977, 963, 1012, 1206, 1250, 1432, 1423, 1553, 846, 889, 904, 877, 1002, 1391, 1886, 956, 1258, 974, 1066, 896, 1001, 993, 1270, 780, 1148, 954, 1041, 1920, 1824, 1265, 1116, 901, 964, 811, 636, 498, 467, 796, 1427, 808, 1033, 754, 1159, 1002, 567, 441, 619, 498, 416, 402, 521, 391, 451, 403, 398, 486, 620, 649, 507, 416, 585, 469, 498, 769, 608, 462, 555, 716, 711, 1028, 415, 601, 590, 925, 815, 1155, 966, 1020, 837, 916, 656, 812, 657, 692, 621, 481, 575, 752, 698, 927, 954, 838, 591, 520, 687, 619, 689, 620, 745, 464, 445, 749, 1040, 652, 687, 637, 639, 856, 596, 888, 585, 863, 584, 766, 869, 939, 754, 1106, 900, 839, 1032, 856, 862, 911, 1025, 846, 722, 831, 928, 592, 806, 895, 773, 1105, 882, 996, 792, 663, 875, 554, 581, 505, 542, 594, 833, 633, 834, 760, 639, 707, 466, 996, 880, 1052, 652, 710, 518, 708, 625, 646, 894, 1735, 615, 747, 585, 1117, 452, 988, 609, 485, 526, 438, 501]
print("Median: %s" % statistics.median(weekly_lst))
print("Mean: %s" % float(statistics.mean(weekly_lst)))
But I wanted to do find the mean and median of the occupations that have the word engineer in them, but not sure how to go about it. I need some assistance.
python python-3.x
add a comment |
Here's my code to print the mean and median of all the occupations.
occupation_lst = ['ALL OCCUPATIONS', 'MANAGEMENT', 'Chief executives', 'General and operations managers', 'Marketing and sales managers', 'Administrative services managers', 'Computer and information systems managers', 'Financial managers', 'Human resources managers', 'Industrial production managers', 'Purchasing managers', 'Transportation storage and distribution managers', 'Farmers ranchers and other agricultural managers', 'Construction managers', 'Education administrators', 'Architectural and engineering managers', 'Food service managers', 'Lodging managers', 'Medical and health services managers', 'Property real estate and community association managers', 'Social and community service managers', 'Managers all other', 'BUSINESS', 'Wholesale and retail buyers except farm products', 'Purchasing agents except wholesale retail and farm products', 'Claims adjusters appraisers examiners and investigators', 'Compliance officers', 'Cost estimators', 'Human resources workers', 'Logisticians', 'Management analysts', 'Market research analysts and marketing specialists', 'Business operations specialists all other', 'Accountants and auditors', 'Financial analysts', 'Personal financial advisors', 'Credit counselors and loan officers', 'COMPUTATIONAL', 'Computer systems analysts', 'Information security analysts', 'Computer programmers', 'Software developers applications and systems software', 'Web developers', 'Computer support specialists', 'Database administrators', 'Network and computer systems administrators', 'Computer network architects', 'Computer occupations all other', 'Operations research analysts', 'ENGINEERING', 'Architects except naval', 'Aerospace engineers', 'Chemical engineers', 'Civil engineers', 'Computer hardware engineers', 'Electrical and electronics engineers', 'Industrial engineers including health and safety', 'Mechanical engineers', 'Engineers all other', 'Drafters', 'Engineering technicians except drafters', 'Surveying and mapping technicians', 'SCIENCE', 'Medical scientists', 'Chemists and materials scientists', 'Environmental scientists and geoscientists', 'Physical scientists all other', 'Miscellaneous life physical and social science technicians', 'SOCIAL SERVICE', 'Counselors', 'Social workers', 'Clergy', 'LEGAL', 'Lawyers', 'EDUCATION', 'Postsecondary teachers', 'Elementary and middle school teachers', 'Secondary school teachers', 'Other teachers and instructors', 'ARTS', 'Designers', 'Producers and directors', 'Athletes coaches umpires and related workers', 'Editors', 'Broadcast and sound engineering technicians and radio operators', 'HEALTHCARE PROFESSIONAL', 'Pharmacists', 'Physicians and surgeons', 'Physical therapists', 'Registered nurses', 'Clinical laboratory technologists and technicians', 'Diagnostic related technologists and technicians', 'Emergency medical technicians and paramedics', 'Health practitioner support technologists and technicians', 'HEALTHCARE SUPPORT', 'Nursing psychiatric and home health aides', 'PROTECTIVE SERVICE', 'First-line supervisors of police and detectives', 'First-line supervisors of protective service workers all other', 'Firefighters', 'Bailiffs correctional officers and jailers', 'Detectives and criminal investigators', "Police and sheriff's patrol officers", 'Security guards and gaming surveillance officers', 'CULINARY', 'Chefs and head cooks', 'First-line supervisors of food preparation and serving workers', 'Cooks', 'Food preparation workers', 'Bartenders', 'Combined food preparation and serving workers including fast food', 'Waiters and waitresses', 'Dining room and cafeteria attendants and bartender helpers', 'Dishwashers', 'GROUNDSKEEPING', 'First-line supervisors of housekeeping and janitorial workers', 'First-line supervisors of landscaping lawn service and groundskeeping workers', 'Janitors and building cleaners', 'Maids and housekeeping cleaners', 'Pest control workers', 'Grounds maintenance workers', 'SERVICE', 'First-line supervisors of gaming workers', 'Baggage porters bellhops and concierges', 'Personal care aides', 'Recreation and fitness workers', 'SALES', 'First-line supervisors of retail sales workers', 'First-line supervisors of non-retail sales workers', 'Cashiers', 'Parts salespersons', 'Retail salespersons', 'Advertising sales agents', 'Insurance sales agents', 'Securities commodities and financial services sales agents', 'Sales representatives services all other', 'Sales representatives wholesale and manufacturing', 'Real estate brokers and sales agents', 'Sales and related workers all other', 'OFFICE', 'First-line supervisors of office and administrative support workers', 'Bill and account collectors', 'Bookkeeping accounting and auditing clerks', 'Customer service representatives', 'Hotel motel and resort desk clerks', 'Receptionists and information clerks', 'Couriers and messengers', 'Dispatchers', 'Postal service clerks', 'Postal service mail carriers', 'Production planning and expediting clerks', 'Shipping receiving and traffic clerks', 'Stock clerks and order fillers', 'Secretaries and administrative assistants', 'Data entry keyers', 'Insurance claims and policy processing clerks', 'Office clerks general', 'Office and administrative support workers all other', 'AGRICULTURAL', 'Miscellaneous agricultural workers', 'CONSTRUCTION', 'First-line supervisors of construction trades and extraction workers', 'Brickmasons blockmasons and stonemasons', 'Carpenters', 'Carpet floor and tile installers and finishers', 'Construction laborers', 'Operating engineers and other construction equipment operators', 'Drywall installers ceiling tile installers and tapers', 'Electricians', 'Painters construction and maintenance', 'Pipelayers plumbers pipefitters and steamfitters', 'Roofers', 'Sheet metal workers', 'Structural iron and steel workers', 'Construction and building inspectors', 'Highway maintenance workers', 'Mining machine operators', 'Other extraction workers', 'MAINTENANCE', 'First-line supervisors of mechanics installers and repairers', 'Computer automated teller and office machine repairers', 'Radio and telecommunications equipment installers and repairers', 'Security and fire alarm systems installers', 'Aircraft mechanics and service technicians', 'Automotive body and related repairers', 'Automotive service technicians and mechanics', 'Bus and truck mechanics and diesel engine specialists', 'Heavy vehicle and mobile equipment service technicians and mechanics', 'Miscellaneous vehicle and mobile equipment mechanics installers and repairers', 'Heating air conditioning and refrigeration mechanics and installers', 'Industrial and refractory machinery mechanics', 'Maintenance and repair workers general', 'Electrical power-line installers and repairers', 'Telecommunications line installers and repairers', 'Precision instrument and equipment repairers', 'Other installation maintenance and repair workers', 'PRODUCTION', 'First-line supervisors of production and operating workers', 'Electrical electronics and electromechanical assemblers', 'Miscellaneous assemblers and fabricators', 'Bakers', 'Butchers and other meat poultry and fish processing workers', 'Food processing workers all other', 'Computer control programmers and operators', 'Cutting punching and press machine setters operators and tenders metal and plastic', 'Machinists', 'Welding soldering and brazing workers', 'Metal workers and plastic workers all other', 'Printing press operators', 'Laundry and dry-cleaning workers', 'Stationary engineers and boiler operators', 'Water and wastewater treatment plant and system operators', 'Chemical processing machine setters operators and tenders', 'Crushing grinding polishing mixing and blending workers', 'Inspectors testers sorters samplers and weighers', 'Packaging and filling machine operators and tenders', 'Painting workers', 'Production workers all other', 'TRANSPORTATION', 'Supervisors of transportation and material moving workers', 'Aircraft pilots and flight engineers', 'Bus drivers', 'Driver/sales workers and truck drivers', 'Taxi drivers and chauffeurs', 'Railroad conductors and yardmasters', 'Automotive and watercraft service attendants', 'Crane and tower operators', 'Industrial truck and tractor operators', 'Cleaners of vehicles and equipment', 'Laborers and freight stock and material movers hand', 'Packers and packagers hand', 'Refuse and recyclable material collectors']
weekly_lst = [1351, 2041, 1260, 1462, 1191, 1728, 1408, 1365, 1485, 1348, 966, 769, 1329, 1423, 1899, 742, 985, 1210, 914, 1022, 1408, 1137, 926, 1009, 963, 1198, 1232, 1002, 1028, 1431, 1284, 1090, 1132, 1426, 1419, 997, 1428, 1389, 1538, 1438, 1682, 1165, 1079, 1536, 1242, 1552, 1227, 1441, 1424, 1441, 1662, 1532, 1460, 1876, 1778, 1447, 1534, 1527, 977, 963, 1012, 1206, 1250, 1432, 1423, 1553, 846, 889, 904, 877, 1002, 1391, 1886, 956, 1258, 974, 1066, 896, 1001, 993, 1270, 780, 1148, 954, 1041, 1920, 1824, 1265, 1116, 901, 964, 811, 636, 498, 467, 796, 1427, 808, 1033, 754, 1159, 1002, 567, 441, 619, 498, 416, 402, 521, 391, 451, 403, 398, 486, 620, 649, 507, 416, 585, 469, 498, 769, 608, 462, 555, 716, 711, 1028, 415, 601, 590, 925, 815, 1155, 966, 1020, 837, 916, 656, 812, 657, 692, 621, 481, 575, 752, 698, 927, 954, 838, 591, 520, 687, 619, 689, 620, 745, 464, 445, 749, 1040, 652, 687, 637, 639, 856, 596, 888, 585, 863, 584, 766, 869, 939, 754, 1106, 900, 839, 1032, 856, 862, 911, 1025, 846, 722, 831, 928, 592, 806, 895, 773, 1105, 882, 996, 792, 663, 875, 554, 581, 505, 542, 594, 833, 633, 834, 760, 639, 707, 466, 996, 880, 1052, 652, 710, 518, 708, 625, 646, 894, 1735, 615, 747, 585, 1117, 452, 988, 609, 485, 526, 438, 501]
print("Median: %s" % statistics.median(weekly_lst))
print("Mean: %s" % float(statistics.mean(weekly_lst)))
But I wanted to do find the mean and median of the occupations that have the word engineer in them, but not sure how to go about it. I need some assistance.
python python-3.x
add a comment |
Here's my code to print the mean and median of all the occupations.
occupation_lst = ['ALL OCCUPATIONS', 'MANAGEMENT', 'Chief executives', 'General and operations managers', 'Marketing and sales managers', 'Administrative services managers', 'Computer and information systems managers', 'Financial managers', 'Human resources managers', 'Industrial production managers', 'Purchasing managers', 'Transportation storage and distribution managers', 'Farmers ranchers and other agricultural managers', 'Construction managers', 'Education administrators', 'Architectural and engineering managers', 'Food service managers', 'Lodging managers', 'Medical and health services managers', 'Property real estate and community association managers', 'Social and community service managers', 'Managers all other', 'BUSINESS', 'Wholesale and retail buyers except farm products', 'Purchasing agents except wholesale retail and farm products', 'Claims adjusters appraisers examiners and investigators', 'Compliance officers', 'Cost estimators', 'Human resources workers', 'Logisticians', 'Management analysts', 'Market research analysts and marketing specialists', 'Business operations specialists all other', 'Accountants and auditors', 'Financial analysts', 'Personal financial advisors', 'Credit counselors and loan officers', 'COMPUTATIONAL', 'Computer systems analysts', 'Information security analysts', 'Computer programmers', 'Software developers applications and systems software', 'Web developers', 'Computer support specialists', 'Database administrators', 'Network and computer systems administrators', 'Computer network architects', 'Computer occupations all other', 'Operations research analysts', 'ENGINEERING', 'Architects except naval', 'Aerospace engineers', 'Chemical engineers', 'Civil engineers', 'Computer hardware engineers', 'Electrical and electronics engineers', 'Industrial engineers including health and safety', 'Mechanical engineers', 'Engineers all other', 'Drafters', 'Engineering technicians except drafters', 'Surveying and mapping technicians', 'SCIENCE', 'Medical scientists', 'Chemists and materials scientists', 'Environmental scientists and geoscientists', 'Physical scientists all other', 'Miscellaneous life physical and social science technicians', 'SOCIAL SERVICE', 'Counselors', 'Social workers', 'Clergy', 'LEGAL', 'Lawyers', 'EDUCATION', 'Postsecondary teachers', 'Elementary and middle school teachers', 'Secondary school teachers', 'Other teachers and instructors', 'ARTS', 'Designers', 'Producers and directors', 'Athletes coaches umpires and related workers', 'Editors', 'Broadcast and sound engineering technicians and radio operators', 'HEALTHCARE PROFESSIONAL', 'Pharmacists', 'Physicians and surgeons', 'Physical therapists', 'Registered nurses', 'Clinical laboratory technologists and technicians', 'Diagnostic related technologists and technicians', 'Emergency medical technicians and paramedics', 'Health practitioner support technologists and technicians', 'HEALTHCARE SUPPORT', 'Nursing psychiatric and home health aides', 'PROTECTIVE SERVICE', 'First-line supervisors of police and detectives', 'First-line supervisors of protective service workers all other', 'Firefighters', 'Bailiffs correctional officers and jailers', 'Detectives and criminal investigators', "Police and sheriff's patrol officers", 'Security guards and gaming surveillance officers', 'CULINARY', 'Chefs and head cooks', 'First-line supervisors of food preparation and serving workers', 'Cooks', 'Food preparation workers', 'Bartenders', 'Combined food preparation and serving workers including fast food', 'Waiters and waitresses', 'Dining room and cafeteria attendants and bartender helpers', 'Dishwashers', 'GROUNDSKEEPING', 'First-line supervisors of housekeeping and janitorial workers', 'First-line supervisors of landscaping lawn service and groundskeeping workers', 'Janitors and building cleaners', 'Maids and housekeeping cleaners', 'Pest control workers', 'Grounds maintenance workers', 'SERVICE', 'First-line supervisors of gaming workers', 'Baggage porters bellhops and concierges', 'Personal care aides', 'Recreation and fitness workers', 'SALES', 'First-line supervisors of retail sales workers', 'First-line supervisors of non-retail sales workers', 'Cashiers', 'Parts salespersons', 'Retail salespersons', 'Advertising sales agents', 'Insurance sales agents', 'Securities commodities and financial services sales agents', 'Sales representatives services all other', 'Sales representatives wholesale and manufacturing', 'Real estate brokers and sales agents', 'Sales and related workers all other', 'OFFICE', 'First-line supervisors of office and administrative support workers', 'Bill and account collectors', 'Bookkeeping accounting and auditing clerks', 'Customer service representatives', 'Hotel motel and resort desk clerks', 'Receptionists and information clerks', 'Couriers and messengers', 'Dispatchers', 'Postal service clerks', 'Postal service mail carriers', 'Production planning and expediting clerks', 'Shipping receiving and traffic clerks', 'Stock clerks and order fillers', 'Secretaries and administrative assistants', 'Data entry keyers', 'Insurance claims and policy processing clerks', 'Office clerks general', 'Office and administrative support workers all other', 'AGRICULTURAL', 'Miscellaneous agricultural workers', 'CONSTRUCTION', 'First-line supervisors of construction trades and extraction workers', 'Brickmasons blockmasons and stonemasons', 'Carpenters', 'Carpet floor and tile installers and finishers', 'Construction laborers', 'Operating engineers and other construction equipment operators', 'Drywall installers ceiling tile installers and tapers', 'Electricians', 'Painters construction and maintenance', 'Pipelayers plumbers pipefitters and steamfitters', 'Roofers', 'Sheet metal workers', 'Structural iron and steel workers', 'Construction and building inspectors', 'Highway maintenance workers', 'Mining machine operators', 'Other extraction workers', 'MAINTENANCE', 'First-line supervisors of mechanics installers and repairers', 'Computer automated teller and office machine repairers', 'Radio and telecommunications equipment installers and repairers', 'Security and fire alarm systems installers', 'Aircraft mechanics and service technicians', 'Automotive body and related repairers', 'Automotive service technicians and mechanics', 'Bus and truck mechanics and diesel engine specialists', 'Heavy vehicle and mobile equipment service technicians and mechanics', 'Miscellaneous vehicle and mobile equipment mechanics installers and repairers', 'Heating air conditioning and refrigeration mechanics and installers', 'Industrial and refractory machinery mechanics', 'Maintenance and repair workers general', 'Electrical power-line installers and repairers', 'Telecommunications line installers and repairers', 'Precision instrument and equipment repairers', 'Other installation maintenance and repair workers', 'PRODUCTION', 'First-line supervisors of production and operating workers', 'Electrical electronics and electromechanical assemblers', 'Miscellaneous assemblers and fabricators', 'Bakers', 'Butchers and other meat poultry and fish processing workers', 'Food processing workers all other', 'Computer control programmers and operators', 'Cutting punching and press machine setters operators and tenders metal and plastic', 'Machinists', 'Welding soldering and brazing workers', 'Metal workers and plastic workers all other', 'Printing press operators', 'Laundry and dry-cleaning workers', 'Stationary engineers and boiler operators', 'Water and wastewater treatment plant and system operators', 'Chemical processing machine setters operators and tenders', 'Crushing grinding polishing mixing and blending workers', 'Inspectors testers sorters samplers and weighers', 'Packaging and filling machine operators and tenders', 'Painting workers', 'Production workers all other', 'TRANSPORTATION', 'Supervisors of transportation and material moving workers', 'Aircraft pilots and flight engineers', 'Bus drivers', 'Driver/sales workers and truck drivers', 'Taxi drivers and chauffeurs', 'Railroad conductors and yardmasters', 'Automotive and watercraft service attendants', 'Crane and tower operators', 'Industrial truck and tractor operators', 'Cleaners of vehicles and equipment', 'Laborers and freight stock and material movers hand', 'Packers and packagers hand', 'Refuse and recyclable material collectors']
weekly_lst = [1351, 2041, 1260, 1462, 1191, 1728, 1408, 1365, 1485, 1348, 966, 769, 1329, 1423, 1899, 742, 985, 1210, 914, 1022, 1408, 1137, 926, 1009, 963, 1198, 1232, 1002, 1028, 1431, 1284, 1090, 1132, 1426, 1419, 997, 1428, 1389, 1538, 1438, 1682, 1165, 1079, 1536, 1242, 1552, 1227, 1441, 1424, 1441, 1662, 1532, 1460, 1876, 1778, 1447, 1534, 1527, 977, 963, 1012, 1206, 1250, 1432, 1423, 1553, 846, 889, 904, 877, 1002, 1391, 1886, 956, 1258, 974, 1066, 896, 1001, 993, 1270, 780, 1148, 954, 1041, 1920, 1824, 1265, 1116, 901, 964, 811, 636, 498, 467, 796, 1427, 808, 1033, 754, 1159, 1002, 567, 441, 619, 498, 416, 402, 521, 391, 451, 403, 398, 486, 620, 649, 507, 416, 585, 469, 498, 769, 608, 462, 555, 716, 711, 1028, 415, 601, 590, 925, 815, 1155, 966, 1020, 837, 916, 656, 812, 657, 692, 621, 481, 575, 752, 698, 927, 954, 838, 591, 520, 687, 619, 689, 620, 745, 464, 445, 749, 1040, 652, 687, 637, 639, 856, 596, 888, 585, 863, 584, 766, 869, 939, 754, 1106, 900, 839, 1032, 856, 862, 911, 1025, 846, 722, 831, 928, 592, 806, 895, 773, 1105, 882, 996, 792, 663, 875, 554, 581, 505, 542, 594, 833, 633, 834, 760, 639, 707, 466, 996, 880, 1052, 652, 710, 518, 708, 625, 646, 894, 1735, 615, 747, 585, 1117, 452, 988, 609, 485, 526, 438, 501]
print("Median: %s" % statistics.median(weekly_lst))
print("Mean: %s" % float(statistics.mean(weekly_lst)))
But I wanted to do find the mean and median of the occupations that have the word engineer in them, but not sure how to go about it. I need some assistance.
python python-3.x
Here's my code to print the mean and median of all the occupations.
occupation_lst = ['ALL OCCUPATIONS', 'MANAGEMENT', 'Chief executives', 'General and operations managers', 'Marketing and sales managers', 'Administrative services managers', 'Computer and information systems managers', 'Financial managers', 'Human resources managers', 'Industrial production managers', 'Purchasing managers', 'Transportation storage and distribution managers', 'Farmers ranchers and other agricultural managers', 'Construction managers', 'Education administrators', 'Architectural and engineering managers', 'Food service managers', 'Lodging managers', 'Medical and health services managers', 'Property real estate and community association managers', 'Social and community service managers', 'Managers all other', 'BUSINESS', 'Wholesale and retail buyers except farm products', 'Purchasing agents except wholesale retail and farm products', 'Claims adjusters appraisers examiners and investigators', 'Compliance officers', 'Cost estimators', 'Human resources workers', 'Logisticians', 'Management analysts', 'Market research analysts and marketing specialists', 'Business operations specialists all other', 'Accountants and auditors', 'Financial analysts', 'Personal financial advisors', 'Credit counselors and loan officers', 'COMPUTATIONAL', 'Computer systems analysts', 'Information security analysts', 'Computer programmers', 'Software developers applications and systems software', 'Web developers', 'Computer support specialists', 'Database administrators', 'Network and computer systems administrators', 'Computer network architects', 'Computer occupations all other', 'Operations research analysts', 'ENGINEERING', 'Architects except naval', 'Aerospace engineers', 'Chemical engineers', 'Civil engineers', 'Computer hardware engineers', 'Electrical and electronics engineers', 'Industrial engineers including health and safety', 'Mechanical engineers', 'Engineers all other', 'Drafters', 'Engineering technicians except drafters', 'Surveying and mapping technicians', 'SCIENCE', 'Medical scientists', 'Chemists and materials scientists', 'Environmental scientists and geoscientists', 'Physical scientists all other', 'Miscellaneous life physical and social science technicians', 'SOCIAL SERVICE', 'Counselors', 'Social workers', 'Clergy', 'LEGAL', 'Lawyers', 'EDUCATION', 'Postsecondary teachers', 'Elementary and middle school teachers', 'Secondary school teachers', 'Other teachers and instructors', 'ARTS', 'Designers', 'Producers and directors', 'Athletes coaches umpires and related workers', 'Editors', 'Broadcast and sound engineering technicians and radio operators', 'HEALTHCARE PROFESSIONAL', 'Pharmacists', 'Physicians and surgeons', 'Physical therapists', 'Registered nurses', 'Clinical laboratory technologists and technicians', 'Diagnostic related technologists and technicians', 'Emergency medical technicians and paramedics', 'Health practitioner support technologists and technicians', 'HEALTHCARE SUPPORT', 'Nursing psychiatric and home health aides', 'PROTECTIVE SERVICE', 'First-line supervisors of police and detectives', 'First-line supervisors of protective service workers all other', 'Firefighters', 'Bailiffs correctional officers and jailers', 'Detectives and criminal investigators', "Police and sheriff's patrol officers", 'Security guards and gaming surveillance officers', 'CULINARY', 'Chefs and head cooks', 'First-line supervisors of food preparation and serving workers', 'Cooks', 'Food preparation workers', 'Bartenders', 'Combined food preparation and serving workers including fast food', 'Waiters and waitresses', 'Dining room and cafeteria attendants and bartender helpers', 'Dishwashers', 'GROUNDSKEEPING', 'First-line supervisors of housekeeping and janitorial workers', 'First-line supervisors of landscaping lawn service and groundskeeping workers', 'Janitors and building cleaners', 'Maids and housekeeping cleaners', 'Pest control workers', 'Grounds maintenance workers', 'SERVICE', 'First-line supervisors of gaming workers', 'Baggage porters bellhops and concierges', 'Personal care aides', 'Recreation and fitness workers', 'SALES', 'First-line supervisors of retail sales workers', 'First-line supervisors of non-retail sales workers', 'Cashiers', 'Parts salespersons', 'Retail salespersons', 'Advertising sales agents', 'Insurance sales agents', 'Securities commodities and financial services sales agents', 'Sales representatives services all other', 'Sales representatives wholesale and manufacturing', 'Real estate brokers and sales agents', 'Sales and related workers all other', 'OFFICE', 'First-line supervisors of office and administrative support workers', 'Bill and account collectors', 'Bookkeeping accounting and auditing clerks', 'Customer service representatives', 'Hotel motel and resort desk clerks', 'Receptionists and information clerks', 'Couriers and messengers', 'Dispatchers', 'Postal service clerks', 'Postal service mail carriers', 'Production planning and expediting clerks', 'Shipping receiving and traffic clerks', 'Stock clerks and order fillers', 'Secretaries and administrative assistants', 'Data entry keyers', 'Insurance claims and policy processing clerks', 'Office clerks general', 'Office and administrative support workers all other', 'AGRICULTURAL', 'Miscellaneous agricultural workers', 'CONSTRUCTION', 'First-line supervisors of construction trades and extraction workers', 'Brickmasons blockmasons and stonemasons', 'Carpenters', 'Carpet floor and tile installers and finishers', 'Construction laborers', 'Operating engineers and other construction equipment operators', 'Drywall installers ceiling tile installers and tapers', 'Electricians', 'Painters construction and maintenance', 'Pipelayers plumbers pipefitters and steamfitters', 'Roofers', 'Sheet metal workers', 'Structural iron and steel workers', 'Construction and building inspectors', 'Highway maintenance workers', 'Mining machine operators', 'Other extraction workers', 'MAINTENANCE', 'First-line supervisors of mechanics installers and repairers', 'Computer automated teller and office machine repairers', 'Radio and telecommunications equipment installers and repairers', 'Security and fire alarm systems installers', 'Aircraft mechanics and service technicians', 'Automotive body and related repairers', 'Automotive service technicians and mechanics', 'Bus and truck mechanics and diesel engine specialists', 'Heavy vehicle and mobile equipment service technicians and mechanics', 'Miscellaneous vehicle and mobile equipment mechanics installers and repairers', 'Heating air conditioning and refrigeration mechanics and installers', 'Industrial and refractory machinery mechanics', 'Maintenance and repair workers general', 'Electrical power-line installers and repairers', 'Telecommunications line installers and repairers', 'Precision instrument and equipment repairers', 'Other installation maintenance and repair workers', 'PRODUCTION', 'First-line supervisors of production and operating workers', 'Electrical electronics and electromechanical assemblers', 'Miscellaneous assemblers and fabricators', 'Bakers', 'Butchers and other meat poultry and fish processing workers', 'Food processing workers all other', 'Computer control programmers and operators', 'Cutting punching and press machine setters operators and tenders metal and plastic', 'Machinists', 'Welding soldering and brazing workers', 'Metal workers and plastic workers all other', 'Printing press operators', 'Laundry and dry-cleaning workers', 'Stationary engineers and boiler operators', 'Water and wastewater treatment plant and system operators', 'Chemical processing machine setters operators and tenders', 'Crushing grinding polishing mixing and blending workers', 'Inspectors testers sorters samplers and weighers', 'Packaging and filling machine operators and tenders', 'Painting workers', 'Production workers all other', 'TRANSPORTATION', 'Supervisors of transportation and material moving workers', 'Aircraft pilots and flight engineers', 'Bus drivers', 'Driver/sales workers and truck drivers', 'Taxi drivers and chauffeurs', 'Railroad conductors and yardmasters', 'Automotive and watercraft service attendants', 'Crane and tower operators', 'Industrial truck and tractor operators', 'Cleaners of vehicles and equipment', 'Laborers and freight stock and material movers hand', 'Packers and packagers hand', 'Refuse and recyclable material collectors']
weekly_lst = [1351, 2041, 1260, 1462, 1191, 1728, 1408, 1365, 1485, 1348, 966, 769, 1329, 1423, 1899, 742, 985, 1210, 914, 1022, 1408, 1137, 926, 1009, 963, 1198, 1232, 1002, 1028, 1431, 1284, 1090, 1132, 1426, 1419, 997, 1428, 1389, 1538, 1438, 1682, 1165, 1079, 1536, 1242, 1552, 1227, 1441, 1424, 1441, 1662, 1532, 1460, 1876, 1778, 1447, 1534, 1527, 977, 963, 1012, 1206, 1250, 1432, 1423, 1553, 846, 889, 904, 877, 1002, 1391, 1886, 956, 1258, 974, 1066, 896, 1001, 993, 1270, 780, 1148, 954, 1041, 1920, 1824, 1265, 1116, 901, 964, 811, 636, 498, 467, 796, 1427, 808, 1033, 754, 1159, 1002, 567, 441, 619, 498, 416, 402, 521, 391, 451, 403, 398, 486, 620, 649, 507, 416, 585, 469, 498, 769, 608, 462, 555, 716, 711, 1028, 415, 601, 590, 925, 815, 1155, 966, 1020, 837, 916, 656, 812, 657, 692, 621, 481, 575, 752, 698, 927, 954, 838, 591, 520, 687, 619, 689, 620, 745, 464, 445, 749, 1040, 652, 687, 637, 639, 856, 596, 888, 585, 863, 584, 766, 869, 939, 754, 1106, 900, 839, 1032, 856, 862, 911, 1025, 846, 722, 831, 928, 592, 806, 895, 773, 1105, 882, 996, 792, 663, 875, 554, 581, 505, 542, 594, 833, 633, 834, 760, 639, 707, 466, 996, 880, 1052, 652, 710, 518, 708, 625, 646, 894, 1735, 615, 747, 585, 1117, 452, 988, 609, 485, 526, 438, 501]
print("Median: %s" % statistics.median(weekly_lst))
print("Mean: %s" % float(statistics.mean(weekly_lst)))
But I wanted to do find the mean and median of the occupations that have the word engineer in them, but not sure how to go about it. I need some assistance.
python python-3.x
python python-3.x
asked Mar 9 at 5:04
idk_meuidk_meu
236
236
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Create another list of only the desired occupations, and perform your calculations on that list.
occupation_lst = ['ALL OCCUPATIONS', 'MANAGEMENT', ...]
weekly_lst = [1351, 2041, ...]
engineer_lst = []
for i, title in enumerate(occupation_list):
if 'engineer' in title:
engineer_lst.append(weekly_lst[i])
print("Median: %s" % statistics.median(engineer_lst))
print("Mean: %s" % float(statistics.mean(engineer_lst)))
Ohh Thank you! That's works!
– idk_meu
Mar 9 at 5:15
@idk_meu Glad I could help. If you would be so kind, please accept the answer (click the checkmark symbol).
– John Gordon
Mar 9 at 5:17
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074173%2fhow-to-print-mean-median-of-the-wanted-occupation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Create another list of only the desired occupations, and perform your calculations on that list.
occupation_lst = ['ALL OCCUPATIONS', 'MANAGEMENT', ...]
weekly_lst = [1351, 2041, ...]
engineer_lst = []
for i, title in enumerate(occupation_list):
if 'engineer' in title:
engineer_lst.append(weekly_lst[i])
print("Median: %s" % statistics.median(engineer_lst))
print("Mean: %s" % float(statistics.mean(engineer_lst)))
Ohh Thank you! That's works!
– idk_meu
Mar 9 at 5:15
@idk_meu Glad I could help. If you would be so kind, please accept the answer (click the checkmark symbol).
– John Gordon
Mar 9 at 5:17
add a comment |
Create another list of only the desired occupations, and perform your calculations on that list.
occupation_lst = ['ALL OCCUPATIONS', 'MANAGEMENT', ...]
weekly_lst = [1351, 2041, ...]
engineer_lst = []
for i, title in enumerate(occupation_list):
if 'engineer' in title:
engineer_lst.append(weekly_lst[i])
print("Median: %s" % statistics.median(engineer_lst))
print("Mean: %s" % float(statistics.mean(engineer_lst)))
Ohh Thank you! That's works!
– idk_meu
Mar 9 at 5:15
@idk_meu Glad I could help. If you would be so kind, please accept the answer (click the checkmark symbol).
– John Gordon
Mar 9 at 5:17
add a comment |
Create another list of only the desired occupations, and perform your calculations on that list.
occupation_lst = ['ALL OCCUPATIONS', 'MANAGEMENT', ...]
weekly_lst = [1351, 2041, ...]
engineer_lst = []
for i, title in enumerate(occupation_list):
if 'engineer' in title:
engineer_lst.append(weekly_lst[i])
print("Median: %s" % statistics.median(engineer_lst))
print("Mean: %s" % float(statistics.mean(engineer_lst)))
Create another list of only the desired occupations, and perform your calculations on that list.
occupation_lst = ['ALL OCCUPATIONS', 'MANAGEMENT', ...]
weekly_lst = [1351, 2041, ...]
engineer_lst = []
for i, title in enumerate(occupation_list):
if 'engineer' in title:
engineer_lst.append(weekly_lst[i])
print("Median: %s" % statistics.median(engineer_lst))
print("Mean: %s" % float(statistics.mean(engineer_lst)))
answered Mar 9 at 5:11
John GordonJohn Gordon
11.1k51833
11.1k51833
Ohh Thank you! That's works!
– idk_meu
Mar 9 at 5:15
@idk_meu Glad I could help. If you would be so kind, please accept the answer (click the checkmark symbol).
– John Gordon
Mar 9 at 5:17
add a comment |
Ohh Thank you! That's works!
– idk_meu
Mar 9 at 5:15
@idk_meu Glad I could help. If you would be so kind, please accept the answer (click the checkmark symbol).
– John Gordon
Mar 9 at 5:17
Ohh Thank you! That's works!
– idk_meu
Mar 9 at 5:15
Ohh Thank you! That's works!
– idk_meu
Mar 9 at 5:15
@idk_meu Glad I could help. If you would be so kind, please accept the answer (click the checkmark symbol).
– John Gordon
Mar 9 at 5:17
@idk_meu Glad I could help. If you would be so kind, please accept the answer (click the checkmark symbol).
– John Gordon
Mar 9 at 5:17
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55074173%2fhow-to-print-mean-median-of-the-wanted-occupation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown