Spaces:
Sleeping
Sleeping
File size: 6,084 Bytes
f950742 1aba3ba f950742 42078dd f950742 42078dd f950742 42078dd f950742 42078dd 9a4e516 836af53 f950742 42078dd f950742 02e9842 f950742 02e9842 1aba3ba 6f2a4fb 1aba3ba | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | """ Codebook for REF 2021 data """
import pandas as pd
# about the ref process
COL_PANEL_CODE = 'Main panel code'
COL_PANEL_NAME = 'Main panel'
COL_UOA_NUMBER = 'Unit of assessment number'
COL_UOA_NAME = 'Unit of assessment'
# about the institution etc
COL_INST_CODE = 'Institution UKPRN code'
COL_INST_NAME = 'Institution'
COL_RG_CODE = 'Research group code'
COL_RG_NAME = 'Research group'
# about the submissions
COL_MULT_SUB_LETTER = 'Multiple submission letter'
COL_MULT_SUB_NAME = 'Multiple submission name'
COL_JOINT_SUB = 'Joint submission'
# about the institution etc
COL_INST_CODE = 'Institution UKPRN code'
COL_INST_NAME = 'Institution'
COL_RG_CODE = 'Research group code'
COL_RG_NAME = 'Research group'
# about the submissions
COL_MULT_SUB_LETTER = 'Multiple submission letter'
COL_MULT_SUB_NAME = 'Multiple submission name'
COL_JOINT_SUB = 'Joint submission'
# about the outputs
COL_OUTPUT_TYPE_CODE = 'Output type code'
COL_OUTPUT_TYPE_NAME = 'Output type'
COL_OPEN_ACCESS = 'Open access status'
COL_OUTPUT_TITLE = 'Title'
COL_OUTPUT_SUPP = 'Supplementary information'
COL_OUTPUT_CITATIONS = 'Citations applicable'
COL_OUTPUT_INTERDISCIPLINARY = 'Interdisciplinary'
# about the impact case studies
COL_IMPACT_TITLE = 'Title'
COL_IMPACT_FUNDING_PROGS = 'Funding programmes'
COL_IMPACT_FUNDERS = 'Name of funders'
COL_IMPACT_SUMMARY = '1. Summary of the impact'
COL_IMPACT_UNDERPIN_RESEARCH = '2. Underpinning research'
COL_IMPACT_REFERENCES_RESEARCH = '3. References to the research'
COL_IMPACT_DETAILS = '4. Details of the impact'
COL_IMPACT_CORROBORATE = '5. Sources to corroborate the impact'
# about results
COL_RESULTS_FTE_STAFF = 'FTE of submitted staff'
COL_RESULTS_PERC_STAFF_SUBMITTED = '% of eligible staff submitted'
COL_RESULTS_PERC_STAFF_SUBMITTED_BINNED = f"{COL_RESULTS_PERC_STAFF_SUBMITTED} (binned)"
COL_RESULTS_4star = '4 stars'
COL_RESULTS_3star = '3 stars'
COL_RESULTS_2star = '2 stars'
COL_RESULTS_1star = '1 star'
COL_RESULTS_UNCLASSIFIED = 'Unclassified'
COL_RESULTS_4star_BINNED = f"{COL_RESULTS_4star} (binned)"
COL_RESULTS_3star_BINNED = f"{COL_RESULTS_3star} (binned)"
COL_RESULTS_2star_BINNED = f"{COL_RESULTS_2star} (binned)"
COL_RESULTS_1star_BINNED = f"{COL_RESULTS_1star} (binned)"
COL_RESULTS_UNCLASSIFIED_BINNED = f"{COL_RESULTS_UNCLASSIFIED} (binned)"
# value to add if no entry in the data
VALUE_ADDED_NOT_SPECIFIED = 'Not specified'
# source: website
PANEL_NAMES = {
"A": "Medicine, health and life sciences",
"B": "Physical sciences, engineering and mathematics",
"C": "Social sciences",
"D": "Arts and humanities"
}
# source: https://results2021.ref.ac.uk/filters/unit-of-assessment
UOA_NAMES = {
1: 'Clinical Medicine',
2: 'Public Health, Health Services and Primary Care',
3: 'Allied Health Professions, Dentistry, Nursing and Pharmacy',
4: 'Psychology, Psychiatry and Neuroscience',
5: 'Biological Sciences',
6: 'Agriculture, Food and Veterinary Sciences',
7: 'Earth Systems and Environmental Sciences',
8: 'Chemistry',
9: 'Physics',
10: 'Mathematical Sciences',
11: 'Computer Science and Informatics',
12: 'Engineering',
13: 'Architecture, Built Environment and Planning',
14: 'Geography and Environmental Studies',
15: 'Archaeology',
16: 'Economics and Econometrics',
17: 'Business and Management Studies',
18: 'Law',
19: 'Politics and International Studies',
20: 'Social Work and Social Policy',
21: 'Sociology',
22: 'Anthropology and Development Studies',
23: 'Education',
24: 'Sport and Exercise Sciences, Leisure and Tourism',
25: 'Area Studies',
26: 'Modern Languages and Linguistics',
27: 'English Language and Literature',
28: 'History',
29: 'Classics',
30: 'Philosophy',
31: 'Theology and Religious Studies',
32: 'Art and Design: History, Practice and Theory',
33: 'Music, Drama, Dance, Performing Arts, Film and Screen Studies',
34: 'Communication, Cultural and Media Studies, Library and Information Management'
}
# source: https://results2021.ref.ac.uk/outputs
OUTPUT_TYPE_NAMES = {
'A': 'Authored book',
'B': 'Edited book',
'C': 'Chapter in book',
'D': 'Journal article',
'E': 'Conference contribution',
'F': 'Patent/ published patent application',
'G': 'Software',
'H': 'Website content',
'I': 'Performance',
'J': 'Composition',
'K': 'Design',
'L': 'Artefact',
'M': 'Exhibition',
'N': 'Research report for external body',
'P': 'Devices and products',
'Q': 'Digital or visual media',
'R': 'Scholarly edition',
'S': 'Research data sets and databases',
'T': 'Other',
'U': 'Working paper',
'V': 'Translation'
}
OPEN_ACCESS_NAMES = [
"Access exception",
"Compliant",
"Deposit exception",
"Exception within 3 months of publication",
"Not compliant",
"Other exception",
"Out of scope for open access requirements",
"Technical exception"
]
PERCENTAGE_BINS = range(0, 101, 10)
def bin_percentages_labels():
""" Create bin percentage labels.
Returns:
labels (list): list of labels
"""
bins = PERCENTAGE_BINS
labels = [f"{bins[i]} to {bins[i+1]} %" for i in range(len(bins)-1)]
# labels = [f"({bins[i]}, {bins[i+1]}]" for i in range(len(bins)-1)]
# labels[0] = f"[{bins[0]}, {bins[1]}]"
return labels
def bin_percentages(dset, column, column_binned):
""" Bin percentages in a column of a dataset.
Args:
dset (pandas.DataFrame): dataset
column (str): column name
column_binned (str): new column name for the binned column
Returns:
dset (pandas.DataFrame): dataset with new column
"""
labels = bin_percentages_labels()
dset[column_binned] = pd.cut(dset[column],
bins=PERCENTAGE_BINS,
right=True,
include_lowest=True,
labels=labels
)
return dset
|