"Latest year compared with Mar 19$$2$$"
},
                                       inplace=True)

vehicle_damage_recovery_table_4.reset_index(inplace=True)

vehicle_damage_recovery_table_4 = vehicle_damage_recovery_table_4.drop(
    ['index'], axis=1)

##################################################################################
#RUNNING FINAL DATAFRAME THROUGH GPTABLES PACKAGE
##################################################################################

vehicle_damage_recovery_table_4_gptable = gpt.GPTable(
    table=vehicle_damage_recovery_table_4,
    index_columns={2: 0},
    title=
    "Table 4: Stolen vehicles returned to owners - rates of return and damage, year ending March 2010 to year ending March 2020 CSEW$$1$$",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "For survey years ending March 2014 through to March 2020 estimates are based on fewer than 50 respondents and should be interpreted with caution.",
        "2":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
    },
    additional_formatting=formatting)
コード例 #2
0
notes = ["This note hath no reference."]

# or use kwargs to pass these to the appropriate parameters
kwargs = {
    "title": title,
    "subtitles": subtitles,
    "units": units,
    "scope": scope,
    "source": source,
    "index_columns": index,
    "annotations": annotations,
    "notes": notes,
    }

## Define our GPTable
iris_table = gpt.GPTable(table=iris_summary, **kwargs)

iris_table_copy = deepcopy(iris_table)
iris_table_copy.set_title("A copy of the first sheet$$note2$$")

cover = gpt.Cover(
    cover_label="Notes",
    title="A Worbook containing good practice tables",
    intro=["This is some introductory information", "And some more"],
    about=["Even more info about my data", "And a little more"],
    contact=["John Doe", "Tel: 345345345"],
    additional_elements=["subtitles", "scope", "source", "notes"]
    )

## Use write_workbook to win!
if __name__ == "__main__":
コード例 #3
0
vehicle_items_stolen_table_6 = vehicle_items_stolen_table_6.drop(['index'],
                                                                 axis=1)

##################################################################################
#RUNNING FINAL DATAFRAME THROUGH GPTABLES PACKAGE
##################################################################################

vehicle_items_stolen_table_6_gptable = gpt.GPTable(
    table=vehicle_items_stolen_table_6,
    index_columns={2: 0},
    title=
    "Table 6: Items stolen in incidents of theft from vehicles, year ending March 2010 to year ending March 2020 CSEW$$1$$",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "Figures may not sum to 100 as more than one response possible.",
        "2":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
        "3":
        "'Valuables' includes jewellery, handbag/briefcase/shopping bag, purses/wallets, cash, cheque books, credit cards, clothes and documents.",
        "4":
        "'Electrical equipment' includes satellite navigation systems, televisions, videos, MP3 players, DVD players and computer equipment.",
        "5":
        "Theft of bicycles only is not included in the category of theft from vehicles; hence bicycles stolen here are as a result of vehicle theft, e.g. being within a car when it is stolen. Theft of bicycles only can be found in the Nature of crime: bicycle theft tables.",
    },
    additional_formatting=formatting)
コード例 #4
0
bicycle_lock_table_6.reset_index(inplace=True)
bicycle_lock_table_6 = bicycle_lock_table_6.drop(['index'], axis=1)

##################################################################################
#RUNNING FINAL DATAFRAM THROUGH GPTABLES PACKAGE
##################################################################################

bicycle_lock_gptable_6 = gpt.GPTable(
    table=bicycle_lock_table_6,
    index_columns={
        1: 0,
        2: 1
    },
    title=
    "Table 6: Whether bicycle was locked at the time it was stolen and reasons why not, year ending March 2010 to year ending March 2020 CSEW",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
        "2":
        "Question asks whether bicycle had a lock (chain, cable, shackle etc) on it when stolen; if bicycle was in a locked garage, shed or similar but not actually secured by a lock itself, this counts as not being locked.",
        "3":
        "Question asked since year ending March 2011. Question only asked of respondents who said their bicycle was not locked at the time of being stolen.",
    },
    notes=[": denotes not applicable"],
    additional_formatting=formatting)
コード例 #5
0
scope = "Titanic$$note2$$"
source = "Source: Kaggle"
index = {2: 0}
annotations = {
    "note1": "www.kaggle.com/titanic",
    "note2": "Celine Dion.",
    "note3": "Total count.",
    }
notes = ["This note hath no reference."]

kwargs = {
    "title": title,
    "subtitles": subtitles,
    "units": units,
    "scope": scope,
    "source": source,
    "index_columns": index,
    "annotations": annotations,
    "notes": notes,
    }

# define our GPTable
titanic_table = gpt.GPTable(table=titanic_analysis, **kwargs)

if __name__ is "__main__":
    output_path = parent_dir / "python_titanic_gptable.xlsx"
    gpt.write_workbook(
        filename=output_path, sheets={"titanic analysis by sex": titanic_table}
        )
    print("Output written at: ", output_path)
vehicle_cost_damage_table_5 = vehicle_cost_damage_table_5.drop(['index'],
                                                               axis=1)

##################################################################################
#RUNNING FINAL DATAFRAME THROUGH GPTABLES PACKAGE
##################################################################################

vehicle_cost_damage_table_5_gptable = gpt.GPTable(
    table=vehicle_cost_damage_table_5,
    index_columns={2: 0},
    title=
    "Table 5: Cost of damage in incidents of theft of and from vehicles, year ending March 2010 to year ending March 20120 CSEW",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
        "2":
        "Respondents were asked to estimate the total cost of items damaged. The mean is affected by the small number of offences with high costs, hence the median (or middle value in the range) is also presented.",
        "3":
        "Values include all respondents who said an item(s) were damaged, even if the cost was valued at zero.",
        "4":
        "It is not possible to calculate statistical significance for the median cost.",
    },
    notes=[": denotes not applicable"],
    additional_formatting=formatting + cost_formatting)
コード例 #7
0
##################################################################################
#RUNNING FINAL DATAFRAME THROUGH GPTABLES PACKAGE
##################################################################################

personal_theft_emotional_impact_gptable_5a = gpt.GPTable(
    table=personal_theft_emotional_impact_table_5a,
    index_columns={
        1: 0,
        2: 1
    },
    title=
    "Table 5a: Emotional impact of incidents of theft from the person, year ending March 2010 to year ending March 2020 CSEW$$1$$$$2$$",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "Figures here are based on incidents in which the victim reported that they were emotionally affected by the incident.",
        "2":
        "Figures may not sum to 100 as more than one response possible.",
        "3":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
    },
    additional_formatting=formatting)

#########################################################################################################################################
#EMOTIONAL IMPACT TABLE 5b
#########################################################################################################################################
コード例 #8
0
##################################################################################
#RUNNING FINAL DATAFRAM THROUGH GPTABLES PACKAGE
##################################################################################

household_theft_items_table_2a_gptable = gpt.GPTable(
    table=household_theft_items_table_2a,
    index_columns={2: 0},
    title=
    "Table 2a: Items stolen in incidents of other household theft, year ending March 2010 to year ending March 2020 CSEW CSEW$$1$$",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "Figures may not sum to 100 as more than one response possible.",
        "2":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
        "3":
        "Separate categories for jewellery and watches were introduced in the year ending March 2015.",
        "4":
        "Electrical goods/cameras' includes televisions, videos, stereos, cameras, MP3 players and DVD players.",
    },
    notes=[": denotes not applicable"],
    additional_formatting=formatting)

############################################################################################################
#HOUSEHOLD THEFT IN A DWELLING
############################################################################################################
コード例 #9
0
bicycle_location_table_2["table_label"].replace({
        "Home - Semi-private":"Home - Semi-private$$3$$",
        "Other - Grounds of a public place": "Other - Grounds of a public place$$4$$",
        }, inplace=True)

bicycle_location_table_2.reset_index(inplace=True) 
bicycle_location_table_2 = bicycle_location_table_2.drop(['index'], axis = 1) 
    
##################################################################################
#RUNNING FINAL DATAFRAM THROUGH GPTABLES PACKAGE
##################################################################################

bicycle_location_gptable_2 = gpt.GPTable(
        table = bicycle_location_table_2,
        index_columns = {2: 0},
        title = "Table 2: Where incidents of bicycle theft occurred, year ending March 2010 to year ending March 2020 CSEW$$1$$",
        subtitles = ["Household incidents, percentages"],
        scope = "England and Wales",
        units = "",
        source = "Source: Office for National Statistics - Crime Survey for England and Wales",
        annotations = {
                "1": "Due to changes in the year ending March 2013 questionnaire and year ending March 2018 questionnaire, data cannot be compared to earlier years. As a result, no significance testing is available for the year ending March 2020 compared with the year ending March 2010.",
                "2": "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
                "3": "'Semi-private' includes outside areas on the premises and garages or car parks around but not connected to the home.",
                "4": "Data not available prior to the year ending March 2013. Grounds of a public place includes: shop, supermarket, shopping centre or precinct; school, college or university; pub, bar or working mens club; place of entertainment; nightclub; sports centre; football ground.",
                },
        notes = [": denotes not applicable"],
        additional_formatting = formatting
        )
##################################################################################
#RUNNING FINAL DATAFRAME THROUGH GPTABLES PACKAGE
##################################################################################

personal_theft_items_gptable_3a = gpt.GPTable(
    table=personal_theft_items_table_3a,
    index_columns={2: 0},
    title=
    "Table 3a: Items stolen in incidents of theft from the person, year ending March 2010 to year ending March 2020 CSEW$$1$$",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "Figures may not sum to 100 as more than one response possible.",
        "2":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
        "3":
        "Cheque book' was incorporated into the 'Documents' category from the year ending March 2012 onwards.",
        "4":
        "Electrical goods/cameras' includes televisions, videos, stereos, cameras, MP3 players and DVD players.",
        "5":
        "Separate categories for jewellery and watches were introduced in the year ending March 2015.",
    },
    notes=[": denotes not applicable"],
    additional_formatting=formatting)

#########################################################################################################################################
#Items stolen TABLE 3b
########################################################################################################################################
コード例 #11
0
},
                                               inplace=True)

##################################################################################
#RUNNING FINAL DATAFRAM THROUGH GPTABLES PACKAGE
##################################################################################

criminal_damage_type_of_damage_gptable_3a = gpt.GPTable(
    table=criminal_damage_type_of_damage_table_3a,
    index_columns={2: 0},
    title=
    "Table 3a: Type of damage caused in incidents of criminal damage to a vehicle, year ending March 2010 to year ending March 2018 CSEW$$1$$",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "Figures may not sum to 100 as more than one response possible.",
        "2":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
    },
    notes=[": denotes not applicable"],
    additional_formatting=formatting)

#########################################################################################################################################
#ARSON AND OTHER CRIMINAL DAMAGE.
#########################################################################################################################################

##################################################################################
#RUNNING FINAL DATAFRAM THROUGH GPTABLES PACKAGE
コード例 #12
0
# -*- coding: utf-8 -*-
import gptables as gpt

from pipeline.vehicle_related_theft.age_vehicle.table_10_age_vehicle import vehicle_age_table_10
from pipeline.additional_formatting import formatting

##################################################################################
#RUNNING FINAL DATAFRAME THROUGH GPTABLES PACKAGE
##################################################################################
vehicle_age_table_10.rename(columns={
         "Latest year compared with Mar 10" : "Latest year compared with Mar 10$$2$$",
         "Latest year compared with Mar 19" :  "Latest year compared with Mar 19$$2$$"
         }, inplace=True)


vehicle_age_table_10_gptable = gpt.GPTable(
        table = vehicle_age_table_10,
        index_columns = {2: 0},
        title = "Table 10: Age of stolen vehicles, year ending March 2010 to year ending March 2020 CSEW$$1$$",
        subtitles = ["Household incidents, percentages"],
        scope = "England and Wales",
        units = "",
        source = "Source: Office for National Statistics - Crime Survey for England and Wales",
        annotations = {
                "1": "Includes car/van, motorbike/moped.",
                "2": "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
               },
        additional_formatting = formatting
        )
コード例 #13
0
##################################################################################
#RUNNING FINAL DATAFRAME THROUGH GPTABLES PACKAGE
##################################################################################

personal_theft_location_gptable_2a = gpt.GPTable(
    table=personal_theft_location_table_2a,
    index_columns={2: 0},
    title=
    "Table 2a: Where incidents of theft from the person occurred, year ending March 2010 to year ending March 2020 CSEW$$1$$",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "Due to changes in the year ending March 2013 questionnaire and year ending March 2018 questionnaire, data cannot be compared to earlier years. As a result, no significance testing is available for the year ending March 2020 compared with the year ending March 2010.",
        "2":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
        "3":
        "Categories changed in the year ending March 2009 so that nightclubs are now included in 'public entertainment' and not 'a pub'",
        "4":
        "Includes own home, inside a friend or relatives' home, inside or near place of work, car park, a school/college/university and somewhere else",
    },
    notes=[": denotes not applicable"],
    additional_formatting=formatting)

#########################################################################################################################################
#LOCATION TABLE 2b
#########################################################################################################################################
##################################################################################
コード例 #14
0
    frame = frame.groupby("reoffence_group").sum().reset_index()
    dct[key] = frame

dct["summary"] = summ

## Define table elements for each table

example = {
    "title": "Cost of Reoffending",
    "subtitles": ["12-month follow-up period for the 2016 offender cohort"],
    "units": "£",
    "scope": "England and Wales",
    "source": "Office for National Statistics",
}

elements = {
    "summary": example,
    "Adults": example,
    "Children and young people": example
}

## Generate a dictionary of sheet names to GPTable objects
## using the elements defined above
sheets = {name: gpt.GPTable(dct[name], **elements[name]) for name in dct}

## Use write_workbook to win!
if __name__ == "__main__":
    output_path = parent_dir / "python_cor_multiple_gptables.xlsx"
    gpt.write_workbook(filename=output_path, sheets=sheets)
    print("Output written at: ", output_path)
コード例 #15
0
    inplace=True)

bicycle_timing_table_1.reset_index(inplace=True)

bicycle_timing_table_1 = bicycle_timing_table_1.drop(['index'], axis=1)

##################################################################################
#RUNNING FINAL DATAFRAM THROUGH GPTABLES PACKAGE
##################################################################################

bicycle_timing_gptable_1 = gpt.GPTable(
    table=bicycle_timing_table_1,
    index_columns={2: 0},
    title=
    "Table 1: Timing of when incidents of bicycle thefts occurred, year ending March 2010 to year ending March 2020 CSEW",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
        "2": "Weekend is from Friday 6pm to Monday 6am.",
        "3": "Morning is from 6am to noon; afternoon is from noon to 6pm.",
        "4": "Evening is from 6pm to midnight; night is midnight to 6am.",
        "5": "Early evening is from 6pm to 10pm.",
        "6": "Late evening is from 10pm to midnight. ",
    },
    additional_formatting=formatting)
コード例 #16
0
    "Latest year compared with Mar 10$$2$$",
    "Latest year compared with Mar 19":
    "Latest year compared with Mar 19$$2$$"
},
                                    inplace=True)

vehicle_seriousness_table_9a_gptable = gpt.GPTable(
    table=vehicle_seriousness_table_9a,
    index_columns={
        1: 0,
        2: 1
    },
    title=
    "Table 9a: Perceived seriousness of incidents of vehicle-related theft, year ending March 2010 to year ending March 2020 CSEW$$1$$",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "1-6 represents the least serious assessment and 14-20 represents the most serious.",
        "2":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
    },
    additional_formatting=formatting)

vehicle_seriousness_table_9b.rename(columns={
    "Latest year compared with Mar 10":
    "Latest year compared with Mar 10$$2$$",
    "Latest year compared with Mar 19":
    "Latest year compared with Mar 19$$2$$"
household_theft_offender_table_6a_gptable = gpt.GPTable(
    table=household_theft_offender_table_6a,
    index_columns={
        1: 0,
        2: 1
    },
    title=
    "Table 6a: Offender characteristics in incidents of other household theft, year ending March 2010 to year ending March 2020 CSEW$$1$$$$2$$$$3$$",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "Figures here are based on incidents in which the victim could say something about the offender(s).",
        "2":
        "The offender-victim relationship is classified as: 'strangers' if the victim did not have any information about the offender(s), or did not know and had never seen the offender(s) before; 'known by sight or to speak to' if at least one offender falls into either category; and 'known well' if at least one offender falls into this category (for multiple offenders this takes priority over any less well-known offenders).",
        "3":
        "All respondents were asked about their relationship to the offender(s) - this includes detailed questions of victims who experienced three or less offences and brief questions to those who experienced more than three but less than six offences in the last year. ",
        "4":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
        "5":
        "Unweighted base given for sex and age of offender is for the question asking about number of offenders; other bases are similar.",
        "6":
        "Figures may not sum to 100 as more than one response possible.",
        "7":
        "All respondents were asked about their relationship to the offender(s) - this includes detailed questions of victims who experienced three or less offences and brief questions to those who experienced more than three but less than six offences in the last year.",
    },
    additional_formatting=formatting)
コード例 #18
0
personal_theft_seriousness_table_6a["table_title"].replace({
        "Rated seriousness of crime": "Rated seriousness of crime$$2$$",
        }, inplace=True)

##################################################################################
#RUNNING FINAL DATAFRAME THROUGH GPTABLES PACKAGE
##################################################################################

personal_theft_seriousness_gptable_6a = gpt.GPTable(
        table = personal_theft_seriousness_table_6a,
        index_columns = {1: 0, 2: 1},
        title = "Table 6a: Perceived seriousness of incidents of personal, year ending March 2010 to year ending March 2020 CSEW",
        subtitles = ["Household incidents, percentages"],
        scope = "England and Wales",
        units = "",
        source = "Source: Office for National Statistics - Crime Survey for England and Wales",
        annotations = {
                "1": "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
                "2": "1-6 represents the least serious assessment and 14-20 represents the most serious.",
                },
        additional_formatting = formatting
        )

#########################################################################################################################################
#SERIOUSNESS TABLE 6b
#########################################################################################################################################

other_personal_theft_seriousness_table_6b.rename(columns={
         "Latest year compared with Mar 10" : "Latest year compared with Mar 10$$1$$",
         "Latest year compared with Mar 19" :  "Latest year compared with Mar 19$$1$$"
         }, inplace=True)
##################################################################################
#RUNNING FINAL DATAFRAME THROUGH GPTABLES PACKAGE
##################################################################################

personal_theft_cost_gptable_4a = gpt.GPTable(
    table=personal_theft_cost_table_4a,
    index_columns={2: 0},
    title=
    "Table 4a: Cost of stolen items in incidents of theft from the person, year ending March 2010 to year ending March 2020 CSEW",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
        "2":
        " No cost includes respondents who said no item(s) were stolen.",
        "3":
        "Respondents were asked to estimate the total cost of items stolen. The mean is affected by the small number of offences with high costs, hence the median (or middle value in the range) is also presented.",
        "4":
        "Values include all respondents who said an item(s) were stolen, even if the cost was valued at zero.",
        "5":
        "It is not possible to calculate statistical significance for the median cost.",
    },
    additional_formatting=formatting + cost_formatting)

##########################################################################################
#cost table 4b
#############################################################################################
コード例 #20
0
##################################################################################
#RUNNING FINAL DATAFRAME THROUGH GPTABLES PACKAGE
##################################################################################

vehicle_entry_table_3a_gptable = gpt.GPTable(
    table=vehicle_entry_table_3a,
    index_columns={2: 0},
    title=
    "Table 3a: Method of entry in incidents of all vehicle-related theft, year ending March 2010 to year ending March 2020 CSEW$$1$$",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "Figures may not sum to 100 as respondents can provide up to two options.",
        "2":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
        "3":
        "A new category was added into the survey from the year ending March 2019.",
        "4":
        "Base includes theft of and from vehicles and attempts where there was entry.",
    },
    notes=[": denotes not applicable"],
    additional_formatting=formatting)

##################################################################################
#Table 3b
##################################################################################
##################################################################################
        "Home - Semi-private": "Home - Semi-private$$3$$",
    }, inplace=True)

criminal_damage_location_table_2.reset_index(inplace=True)
criminal_damage_location_table_2 = criminal_damage_location_table_2.drop(
    ['index'], axis=1)

##################################################################################
#RUNNING FINAL DATAFRAME THROUGH GPTABLES PACKAGE
##################################################################################

criminal_damage_location_gptable_2 = gpt.GPTable(
    table=criminal_damage_location_table_2,
    index_columns={2: 0},
    title=
    "Table 2: Where incidents of criminal damage to a vehicle occurred, year ending March 2010 to year ending March 2020 CSEW$$1$$",
    subtitles=["Household incidents, percentages"],
    scope="England and Wales",
    units="",
    source=
    "Source: Office for National Statistics - Crime Survey for England and Wales",
    annotations={
        "1":
        "Due to changes in the year ending March 2013 questionnaire and year ending March 2018 questionnaire, data cannot be compared to earlier years. As a result, no significance testing is available for the year ending March 2020 compared with the year ending March 2010.",
        "2":
        "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
        "3":
        "'Semi-private' includes outside areas on the premises and garages or car parks around but not connected to the home.",
    },
    additional_formatting=formatting)
vehicle_security_table_11a.reset_index(inplace = True)

vehicle_security_table_11a = vehicle_security_table_11a.drop(['index'], axis = 1)

##################################################################################
#RUNNING FINAL DATAFRAME THROUGH GPTABLES PACKAGE
##################################################################################

vehicle_security_table_11a_gptable = gpt.GPTable(
        table = vehicle_security_table_11a,
        index_columns = {2: 0},
        title = "Table 11a: Vehicle security precautions on cars/vans targeted in all vehicle-related theft, year ending March 2010 to year ending March 2020 CSEW$$1$$$$2$$",
        subtitles = ["Household incidents, percentages"],
        scope = "England and Wales",
        units = "",
        source = "Source: Office for National Statistics - Crime Survey for England and Wales",
        annotations = {
                "1": "Figures are based on all cars or light vans subject to all vehicle-related theft and are based on what security measures were in place at the time of the vehicle-related theft.",
                "2": "Figures may not sum to 100 as more than one response possible.",
                "3": "Statistically significant change at the 5% level is indicated by an asterisk. For more information on statistical significance, see Chapter 8 of the User Guide.",
                "4": "Base given is for 'Central locking'. Others bases are similar."
                },
         additional_formatting = formatting
        )


##################################################################################
#Table 11b
##################################################################################
##################################################################################
#ADDING FOOTNOTES - AMENDING TABLE LABELS TO INCORPORATE '$$X$$' AS THIS SIGNIFIES A FOOTNOTE.
##################################################################################