ReadHospitalData Class#

class ReadHospitalData.readHospitalData#

Bases: object

This class is designed to help wrangle data from the monthly hospital spreadsheets found at

https://www.england.nhs.uk/statistics/statistical-work-areas/covid-19-hospital-activity/

This version of the class will allow you to get regonal data from any worksheet.

join_totals_datasets(directory, ws)#

This will scan the directory open each excel file and join the dataframes for totals for a specific worksheet.

This methods similar to the above one however it will onlt merge data for the selected worksheet.

Args:
directory

String Value, this is the directory where the hospital data is.

ws

String Value, this is the worksheet that you want to read.

read_in_all_totals(directory)#

This will read in totals from all worksheets, takes around 7 seconds for each worksheet it will also merge files from the directory so ensure you just have your hospital data in there!

Args:
directory

String Value, the directory that contains hospital data.

Returns:

A dataframe that contains totals data from all files within the directory and for all worksheets. This function will merge the excel files.

Note

This method is very slow and can take up to 7 seconds per worksheet.

read_in_totals(excel_file, ws)#

This will read the selected owrksheet form a given excel file. Then turn the top of the worksheet into a dataframe, this only reads the totals from each worksheet for ENGLAND and the english regions, it does not read in data for each trust.

Args:
excel_file

String Value, location of the excel file to be used.

ws

String Value, worksheet name within the excel file to read.

Returns:

A dataframe with all data from the totals part of any given worksheet.