gpt4 book ai didi

python - 如何打印想要的职业的平均值/中位数?

转载 作者:行者123 更新时间:2023-12-01 01:08:47 26 4
gpt4 key购买 nike

这是我的代码,用于打印所有职业的平均值和中位数。

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)))

但我想找到含有“工程师”一词的职业的平均值和中位数,但不知道如何去做。我需要一些帮助。

最佳答案

创建另一个仅包含所需职业的列表,并在该列表上执行计算。

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)))

关于python - 如何打印想要的职业的平均值/中位数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55074173/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com