Skip to content

Commit

Permalink
District Data to Dataframe
Browse files Browse the repository at this point in the history
- Added the district data provided at the edbuild website
- Added code in loading_data.py to load the district data provided at the edbuild website to get around paying for Cost of Living Index Adjustments
  • Loading branch information
KVSRoyal committed Mar 29, 2019
1 parent 9f874b8 commit 1a6725e
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 37 deletions.
3 changes: 3 additions & 0 deletions .idea/dictionaries/Koriann.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 36 additions & 33 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions funding_analysis/loading_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,13 @@
assert len(relevant_raw_data_df.index) == 14325
assert len(relevant_raw_data_df.columns) == 66


# Load the district data values given in the original analysis
edbuild_district_data_workbook_path = workbooks_directory_path.parents[0] / 'edbuild_district_data.xlsx'
edbuild_district_data = pandas.read_excel(edbuild_district_data_workbook_path)

# Do some shallow testing to verify everything went well
assert len(edbuild_district_data.index) == 12944
assert len(edbuild_district_data.columns) == 21

print('SUCCESS: Sheets parsed as expected.')
9 changes: 5 additions & 4 deletions funding_analysis/sampling.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
relevant_raw_data_workbook_path = workbooks_directory_path / 'relevant_raw_data.xls'
relevant_raw_data_df = pandas.read_excel(relevant_raw_data_workbook_path)

def sample_column(variable):

def select_column(variable):
"""
Returns a pandas dataframe of all data for this variable / data item tag
:param variable: The type of data item for which all available data is being sampled
Expand All @@ -18,7 +19,7 @@ def sample_column(variable):
return relevant_raw_data_df[variable].to_frame()


def sample_columns(variables):
def select_columns(variables):
"""
Returns a pandas dataframe of all data for the given list of variables / data item tags
:param variables: A list of data items for which all available data is being sampled
Expand All @@ -27,5 +28,5 @@ def sample_columns(variables):
return relevant_raw_data_df[variables]


print(str(sample_column('CONUM')) + '\n')
print(str(sample_columns(['NAME', 'TOTALREV'])) + '\n')
print(str(select_column('CONUM')) + '\n')
print(str(select_columns(['NAME', 'TOTALREV'])) + '\n')
Binary file modified resources/datademo.xls
Binary file not shown.
Binary file added resources/edbuild_district_data.xlsx
Binary file not shown.

0 comments on commit 1a6725e

Please sign in to comment.