{"id":15050575,"url":"https://github.com/invictusaman/socioeconomic-indicators-in-chicago-sql-python","last_synced_at":"2026-02-12T00:34:02.571Z","repository":{"id":254746429,"uuid":"847381626","full_name":"invictusaman/Socioeconomic-Indicators-in-Chicago-SQL-Python","owner":"invictusaman","description":"This project displays how to create a database connection in notebook, update database using python and how to run Python program and SQL queries together. It uses SQLite and Chicago dataset for analysis.","archived":false,"fork":false,"pushed_at":"2024-08-25T18:18:24.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-07T12:57:15.415Z","etag":null,"topics":["data-analysis","jupyter-notebook","python","sql","sql-queries","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/invictusaman.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-25T17:02:54.000Z","updated_at":"2025-02-01T19:02:32.000Z","dependencies_parsed_at":"2024-08-25T20:38:23.906Z","dependency_job_id":"f45c8bf1-5395-4fb0-893d-cd588b637cfb","html_url":"https://github.com/invictusaman/Socioeconomic-Indicators-in-Chicago-SQL-Python","commit_stats":null,"previous_names":["invictusaman/socioeconomic-indicators-in-chicago-sql-python"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/invictusaman/Socioeconomic-Indicators-in-Chicago-SQL-Python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invictusaman%2FSocioeconomic-Indicators-in-Chicago-SQL-Python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invictusaman%2FSocioeconomic-Indicators-in-Chicago-SQL-Python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invictusaman%2FSocioeconomic-Indicators-in-Chicago-SQL-Python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invictusaman%2FSocioeconomic-Indicators-in-Chicago-SQL-Python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/invictusaman","download_url":"https://codeload.github.com/invictusaman/Socioeconomic-Indicators-in-Chicago-SQL-Python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/invictusaman%2FSocioeconomic-Indicators-in-Chicago-SQL-Python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273523553,"owners_count":25120863,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-analysis","jupyter-notebook","python","sql","sql-queries","sqlite"],"created_at":"2024-09-24T21:27:32.893Z","updated_at":"2026-02-12T00:34:02.565Z","avatar_url":"https://github.com/invictusaman.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Socioeconomic Indicators in Chicago\n\n*This project is to showcase my SQL and Python skills working with real world dataset and how to use them together.*  \n\n## Objectives\n\n*   Understand a dataset of selected socioeconomic indicators in Chicago\n*   Read Dataset using Python and store data in an SQLite database.\n*   Solve example problems to practice SQL skills   \n\n\n### About the dataset\n\nThe city of Chicago released a dataset of socioeconomic data to the Chicago City Portal. This dataset contains a selection of six socioeconomic indicators of public health significance and a “hardship index,” for each Chicago community area, for the years 2008 – 2012.\n\nScores on the hardship index can range from 1 to 100, with a higher index number representing a greater level of hardship.\n\nA detailed description of the dataset can be found on [the city of Chicago's website](https://data.cityofchicago.org/Health-Human-Services/Census-Data-Selected-socioeconomic-indicators-in-C/kn9c-c2s2?utm_medium=Exinfluencer\u0026utm_source=Exinfluencer\u0026utm_content=000026UJ\u0026utm_term=10006555\u0026utm_id=NA-SkillsNetwork-Channel-SkillsNetworkCoursesIBMDeveloperSkillsNetworkDB0201ENSkillsNetwork20127838-2021-01-01), but to summarize, the dataset has the following variables:\n\n*   **Community Area Number** (`ca`): Used to uniquely identify each row of the dataset\n\n*   **Community Area Name** (`community_area_name`): The name of the region in the city of Chicago\n\n*   **Percent of Housing Crowded** (`percent_of_housing_crowded`): Percent of occupied housing units with more than one person per room\n\n*   **Percent Households Below Poverty** (`percent_households_below_poverty`): Percent of households living below the federal poverty line\n\n*   **Percent Aged 16+ Unemployed** (`percent_aged_16_unemployed`): Percent of persons over the age of 16 years that are unemployed\n\n*   **Percent Aged 25+ without High School Diploma** (`percent_aged_25_without_high_school_diploma`): Percent of persons over the age of 25 years without a high school education\n\n*   **Percent Aged Under** 18 or Over 64:Percent of population under 18 or over 64 years of age (`percent_aged_under_18_or_over_64`): (ie. dependents)\n\n*   **Per Capita Income** (`per_capita_income_`): Community Area per capita income is estimated as the sum of tract-level aggragate incomes divided by the total population\n\n*   **Hardship Index** (`hardship_index`): Score that incorporates each of the six selected socioeconomic indicators\n\n### Questions \u0026 SQL Queries\n\n#### Problem 1 - How many rows are in the dataset?\n\n```sql\n%sql SELECT COUNT(*) AS TOTAL_ROWS FROM chicago_socioeconomic_data;\n```\n\n#### Problem 2 - How many community areas in Chicago have a hardship index greater than 50.0?\n\n```sql\n%%sql\n\nSELECT COUNT(community_area_name) AS COMMUNITY_AREAS_WITH_BETTER_HARDSHIP_INDEX\nFROM chicago_socioeconomic_data\nWHERE hardship_index \u003e 50.0;\n```\n\n#### Problem 3 - What is the maximum value of hardship index in this dataset?\n\n```sql\n%%sql\n\nSELECT MAX(hardship_index) AS MAX_HARDSHIP_INDEX\nFROM chicago_socioeconomic_data;\n```\n\n#### Problem 4 - Which community area which has the highest hardship index?\n\n```sql\n%%sql\n\nSELECT community_area_name AS COMMUNITY_WITH_HIGHEST_INDEX\nFROM chicago_socioeconomic_data\nORDER BY hardship_index DESC\nLIMIT 1;\n```\n\n#### Problem 5 - Which Chicago community areas have per-capita incomes greater than $60,000?\n\n```sql\n%%sql\n\nSELECT community_area_name AS COMMUNITY_WITH_PCI_GT_$60000\nFROM chicago_socioeconomic_data\nWHERE per_capita_income_ \u003e 60000;\n```\n\n#### Problem 6 - Create a scatter plot using the variables `per_capita_income_` and `hardship_index`. Explain the correlation between the two variables.\n\n```python\nimport matplotlib.pyplot as plt\n%matplotlib inline\nimport seaborn as sns\n\nperCapitaIncome_vs_hardshipIndex = %sql SELECT per_capita_income_, hardship_index FROM chicago_socioeconomic_data;\ndfCopy = perCapitaIncome_vs_hardshipIndex.DataFrame()\n\nplot = sns.jointplot(x ='per_capita_income_', y='hardship_index', data = dfCopy, height=10, ratio=2)\n\n# Rename the axis labels\nplot.set_axis_labels('Per Capita Income (USD)', 'Hardship Index')\n\n# Adjust layout\nplt.tight_layout()\n\n# Display the plot\nplt.show()\n```\n\n\n\n##### Important Links\n\n[SQLite](https://www.sqlite.org/about.html)\n[Pandas](https://pandas.pydata.org/)\n[Seaborn](https://seaborn.pydata.org/)\n[MatplotLib](https://matplotlib.org/)\n[Coursera](https://www.coursera.org/professional-certificates/ibm-data-science)\n\n---\n##### Follow my data-analyst journey: [Portfolio_Link](https://www.amanbhattarai.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finvictusaman%2Fsocioeconomic-indicators-in-chicago-sql-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finvictusaman%2Fsocioeconomic-indicators-in-chicago-sql-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finvictusaman%2Fsocioeconomic-indicators-in-chicago-sql-python/lists"}