Skip to content

Commit

Permalink
Noicceeee
Browse files Browse the repository at this point in the history
  • Loading branch information
Carter-Baumgart committed Apr 6, 2024
1 parent d59f538 commit 51c6d3c
Show file tree
Hide file tree
Showing 27 changed files with 9,765 additions and 21 deletions.
240 changes: 240 additions & 0 deletions Projects/project1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,240 @@
{
"cells": [
{
"cell_type": "raw",
"metadata": {},
"source": [
"---\n",
"title: \"Client Report - What's in a name?\"\n",
"subtitle: \"Course DS 250\"\n",
"author: \"Carter Baumgart\"\n",
"format:\n",
" html:\n",
" self-contained: true\n",
" page-layout: full\n",
" title-block-banner: true\n",
" toc: true\n",
" toc-depth: 3\n",
" toc-location: body\n",
" number-sections: false\n",
" html-math-method: katex\n",
" code-fold: true\n",
" code-summary: \"Show the code\"\n",
" code-overflow: wrap\n",
" code-copy: hover\n",
" code-tools:\n",
" source: false\n",
" toggle: true\n",
" caption: See code\n",
"execute: \n",
" warning: false\n",
" \n",
"---"
],
"id": "e2a1c13b"
},
{
"cell_type": "code",
"metadata": {},
"source": [
"#| label: libraries\n",
"#| include: false\n",
"import pandas as pd\n",
"import numpy as np\n",
"import plotly.express as px"
],
"id": "libraries",
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Elevator pitch\n",
"\n",
"_Christian names seem to be on the decline while other names seem to take turns having spikes and fall offs. A much more comprehensive analysis would need to be done to find further trends and to identify why certain names increase or decrease in popularity._\n"
],
"id": "d48d526e"
},
{
"cell_type": "code",
"metadata": {},
"source": [
"#| label: project data\n",
"#| code-summary: Read and format project data\n",
"# Include and execute your code here\n",
"df = pd.read_csv(\"https://github.com/byuidatascience/data4names/raw/master/data-raw/names_year/names_year.csv\")"
],
"id": "project-data",
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"__How does your name at your birth year compare to its use historically?__\n",
"\n",
"My name is in higher usage than previous years, and in general is a part of an upswing in the use of the name Carter overall.\n"
],
"id": "4e238ebf"
},
{
"cell_type": "code",
"metadata": {},
"source": [
"#| label: Q1\n",
"#| code-summary: Read and format data\n",
"# Include and execute your code here\n",
"\n",
"oliver_data = df[(df['name'] == 'Oliver') & (df['UT'] == 'Utah')]\n",
"total_births = oliver_data['Total'].sum()\n",
"chart = px.line(oliver_data, x='year', y='Total', title='Frequency of Oliver in Utah',\n",
" labels={'year': 'Year', 'Total': 'Births'},\n",
" line_shape='linear', color='name')\n",
"chart.show()\n",
"\n",
"\n",
"\"\"\"carter_data = df[(df['name'] == 'Oliver') & (df['UT'] == 'Utah')]\n",
"\n",
"chart = px.line(carter_data, x='year', y='Total', title='Frequency of Oliver in Utah',\n",
" labels={'year': 'Year', 'Total': 'Births'},\n",
" line_shape='linear', color='name')\n",
"\n",
"chart.show()\"\"\""
],
"id": "Q1",
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The usage of Carter increased significantly starting in 1994\n",
"\n",
"__If you talked to someone named Brittany on the phone, what is your guess of his or her age? What ages would you not guess?__\n",
"\n",
"My guess would be that they were 33 years old since the most common year of Brittany was 1990, and I wouldn't guess that they were older than 41 or younger than 22.\n"
],
"id": "2f227562"
},
{
"cell_type": "code",
"metadata": {},
"source": [
"#| label: Q2\n",
"#| code-summary: Read and format data\n",
"# Include and execute your code here\n",
"\n",
"brittany_table = (df\n",
" .groupby(['name', 'year'])\n",
" .sum().query('name == \"Brittany\"')\n",
" .reset_index().filter(['name', 'year', 'Total'])\n",
" .sort_values('Total'))\n",
"\n",
"chart = px.bar(brittany_table, x='year', y='Total', title='Brittany Total over the Years',\n",
" labels={'Total': 'Total Value'}, text='Total', height=600)\n",
"\n",
"chart.show()"
],
"id": "Q2",
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"THe most common range of Brittany falls between 1982 and 2001, peaking 1990\n",
"\n",
"__Mary, Martha, Peter, and Paul are all Christian names. From 1920 - 2000, compare the name usage of each of the four names. What trends do you notice?__\n",
"\n",
"The usage of all four names decreased significantly around the 1970s. The usage of Mary was also much higher previous to the 1970s than any of the other names.\n"
],
"id": "49961d2a"
},
{
"cell_type": "code",
"metadata": {},
"source": [
"#| label: Q3\n",
"#| code-summary: Read and format data\n",
"# Include and execute your code here\n",
"mmpp_table = (df\n",
" .groupby(['name', 'year'])\n",
" .sum().query('name == \"Mary\" | name == \"Martha\" | name == \"Peter\" | name == \"Paul\"')\n",
" .reset_index().filter(['name', 'year', 'Total'])\n",
" .sort_values('Total'))\n",
"\n",
"# Filter for the years 1920-2000\n",
"mmpp_table = mmpp_table[(mmpp_table['year'] >= 1920) & (mmpp_table['year'] <= 2000)]\n",
"\n",
"chart = px.scatter(mmpp_table, x='year', y='Total', color='name',\n",
" title='Names Total over the Years (1920-2000)',\n",
" labels={'Total': 'Total Value'}, height=600)\n",
"\n",
"chart.show()"
],
"id": "Q3",
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Christian names spiked post WWII but quickly fell off again\n",
"\n",
"__Think of a unique name from a famous movie. Plot the usage of that name and see how changes line up with the movie release. Does it look like the movie had an effect on usage?__\n",
"\n",
"It doesn't look like the usage of the name Harry increased during the time when the first Harry Potter movie was released.\n"
],
"id": "5799b88f"
},
{
"cell_type": "code",
"metadata": {},
"source": [
"#| label: Q3\n",
"#| code-summary: Read and format data\n",
"# Include and execute your code here\n",
"\n",
"harry_data = df[df['name'] == 'Harry']\n",
"\n",
"chart = px.line(harry_data, x='year', y='Total', title='Frequency of Harry',\n",
" labels={'year': 'Year', 'Total': 'Births'},\n",
" line_shape='linear', color='name')\n",
"\n",
"chart.add_shape(dict(type=\"line\", x0=2001, x1=2001, y0=0, y1=max(harry_data['Total']),\n",
" line=dict(color=\"black\", dash=\"dash\")))\n",
"\n",
"chart.add_annotation(x=2001, y=max(harry_data['Total']), text=\"Release Year (2001)\",\n",
" showarrow=True, arrowhead=4, ax=0, ay=-40)\n",
"\n",
"chart.show()"
],
"id": "Q3",
"execution_count": null,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Harry Potter had no noticeable influence on the steady decline of the usage of the name Harry.\n"
],
"id": "e7bdc0a2"
}
],
"metadata": {
"kernelspec": {
"name": "python3",
"language": "python",
"display_name": "Python 3 (ipykernel)"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
2 changes: 1 addition & 1 deletion _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ website:
title: "Carter_Baumgart Data Science Portfolio"
favicon: Images/favicon.png
back-to-top-navigation: true
repo-url: https://github.com/my_projects
repo-url: https://github.com/Carter-Baumgart/Carter-Baumgart.github.io
#repo-actions: [issue] #if you want to allow others to report issues on your site uncomment this line

page-footer:
Expand Down
Loading

0 comments on commit 51c6d3c

Please sign in to comment.