Getting Back Into Coding

Raizel Bernstein
5 min readApr 22, 2021

I finished a data science bootcamp about 2 months ago, and I’d be lying if I said I spent those 2 months sharpening up my code skills. I needed to get back in the swing of things, and learning SQL from scratch was not keeping me entertained. [If I get hired at a company that uses SQL I will spend more time getting acquainted … I just missed Pandas]. So I created a mini project to see what I remembered from learning Pandas! I sent out a questionnaire to a bunch of relatives, and used matplotlib to depict their answers in graphs. Here are some of the answers I received.

Photo by Tyler Nix on Unsplash … not my actual family just an online photo
fig, ax = plt.subplots(figsize = (15, 7.5))
plt.title(label = 'Blood Type', fontsize = 22, color = 'red')
plt.xlabel('Blood Type', fontdict={'fontsize': 15})
plt.ylabel('number of people', fontdict={'fontsize': 15})
plt.bar(df['Blood Type'].value_counts().index, df['Blood Type'].value_counts().values, color = ['goldenrod', 'teal', 'silver'])
fig, ax = plt.subplots(figsize = (15, 7.5))
x = ['control over time','eliminate the pandemic','flying', 'healing sick/keeping family healthy', 'invisible',
'grow money on trees','pause time to workout more','shoot lightning out of my hands','talk to bugs','telepathy' ]
y = [1, 1, 4, 3, 2, 1, 1, 1, 1, 4]
color = ["midnightblue", "fuchsia", "darkmagenta"]
plt.yticks(np.arange(0, 7))
plt.xticks(rotation = 90)
plt.title(label = 'Super Power', fontsize = 22)
plt.xlabel('superpower', fontdict={'fontsize': 15})
plt.ylabel('number of people', fontdict={'fontsize': 15})
plt.bar(x, y, color=color
I would personally rather have a superpower that allows me to eat junk food while staying healthy over pausing time to workout more, but to each their own.
df['What is your favorite holiday?'].map(lambda x: x.lower().strip(' (duh)')).value_counts()
df['Holiday'] = df['What is your favorite holiday?'].replace(['chanuka', 'channuka'],'channukah')
df['Holiday']
fig, ax = plt.subplots(figsize = (16, 8))
# x = df['What is your favorite holiday?'].map(lambda x: x.lower().strip(' (duh)'))
# y = df['What is your favorite holiday?'].map(lambda x: x.lower().strip(' (duh)')).value_counts()
y = df['Holiday'].value_counts()
plt.yticks(np.arange(0, 15))
plt.title(label = 'Favorite Holidays', fontsize = 22)
plt.xlabel('Holidays', fontdict={'fontsize': 15})
plt.ylabel('Number of Family', fontdict={'fontsize': 15})
plt.bar(y.index, y.values, color = ['sandybrown', 'mediumpurple', 'springgreen', 'dodgerblue', 'silver', 'lightcoral'])
‘my birthday’ encompasses 2 different birthdays
fig, ax = plt.subplots(figsize = (16, 7.5))
plt.title(label = 'Introvert or Extrovert', fontsize = 22)
plt.xlabel('Can you hang?', fontdict={'fontsize': 15})
plt.ylabel('Number of Family Members', fontdict={'fontsize': 15})
plt.bar(df['Introvert or Extrovert'].value_counts().index, df['Introvert or Extrovert'].value_counts().values,
color = ['royalblue', 'red'])
I don’t know why I gave the x-axis a ‘Can you hang?’ title. I’m introverted and I can hang. I just need to nap or sleep after the hang.
fig, ax = plt.subplots(figsize = (16, 7.5))
plt.title(label = 'Podcast or Music', fontsize = 22)
plt.xlabel('What do you want to listen to?', fontdict={'fontsize': 15})
plt.ylabel('Number of Family Members', fontdict={'fontsize': 15})
plt.bar(df['Podcast or Music'].value_counts().index, df['Podcast or Music'].value_counts().values,
color = ['plum', 'pink'])
fig, ax = plt.subplots(figsize = (16, 7.5))
plt.title(label = 'Beach or Mountains', fontsize = 22)
plt.xlabel('Would you rather', fontdict={'fontsize': 15})
plt.ylabel('Number of Family Members', fontdict={'fontsize': 15})
plt.bar(df['beach or mountains'].value_counts().index, df['beach or mountains'].value_counts().values,
color = ['mistyrose', 'darkgreen'])
fig, ax = plt.subplots(figsize = (16, 7.5))
plt.title(label = 'Meals', fontsize = 22)
plt.xlabel("What's your fav?", fontdict={'fontsize': 15})
plt.ylabel('Number of Family Members', fontdict={'fontsize': 15})
plt.bar(df["what's your favorite: breakfast, lunch, dinner"].value_counts().index, df["what's your favorite: breakfast, lunch, dinner"].value_counts().values,
color = ['salmon', 'firebrick', 'maroon'])
fig, ax = plt.subplots(figsize = (16, 7.5))
plt.title(label = 'Ugh', fontsize = 22)
plt.xlabel('Are you brainwashed by an evil monopoly?', fontdict={'fontsize': 15})
plt.ylabel('Number of Family Members', fontdict={'fontsize': 15})
plt.bar(df['apple products or not apple products'].value_counts().index, df['apple products or not apple products'].value_counts().values,
color = ['red', 'gray'])
From the title you might be able to tell I am biased from bad experiences.
fig, ax = plt.subplots(figsize = (16, 7.5))
plt.title(label = 'Dranks', fontsize = 22)
plt.xlabel('Coffee Tea or Other', fontdict={'fontsize': 15})
plt.ylabel('Number of Family Members', fontdict={'fontsize': 15})
plt.bar(df['coffee or tea'].value_counts().index, df['coffee or tea'].value_counts().values,
color = ['peru', 'coral', 'sienna', 'deeppink', 'aqua', 'gainsboro'])
fig, ax = plt.subplots(figsize = (16, 7.5))
plt.title(label = 'Attachment Style', fontsize = 22)
plt.xlabel('Attachment Style', fontdict={'fontsize': 15})
plt.ylabel('Number of Liars', fontdict={'fontsize': 15})
plt.bar(df['Attachment Style'].value_counts().index,
df['Attachment Style'].value_counts().values,
color = ['indigo', 'cyan', 'deeppink', 'lime'])
fig, ax = plt.subplots(figsize = (16, 7.5))
plt.title(label = 'Birth Order', fontsize = 22)
plt.xlabel('Which is the best?', fontdict={'fontsize': 15})
plt.ylabel('Number of Family Members', fontdict={'fontsize': 15})
plt.bar(df['Which is best?'].value_counts().index,
df['Which is best?'].value_counts().values,
color = ['lightpink', 'deepskyblue'])
fig, ax = plt.subplots(figsize = (16, 7.5))
plt.title(label = 'Political Stance', fontsize = 22)
plt.xlabel('Politicking', fontdict={'fontsize': 15})
plt.ylabel('Number of Family Members', fontdict={'fontsize': 15})
plt.bar(df['Which describes you best?'].value_counts().index,
df['Which describes you best?'].value_counts().values,
color = ['blue', 'red'])
Everyone wears a mask though
fig, ax = plt.subplots(figsize = (16, 7.5))
plt.title(label = 'Survey', fontsize = 22)
plt.xlabel('Survey', fontdict={'fontsize': 15})
plt.ylabel('Number of Family Members', fontdict={'fontsize': 15})
plt.bar(df['Raizel, HOW MANY MORE QUESTIONS ARE THERE?'].value_counts().index,
df['Raizel, HOW MANY MORE QUESTIONS ARE THERE?'].value_counts().values,
color = ['fuchsia', 'plum', 'orchid'])
fig, ax = plt.subplots(figsize = (16, 7.5))
plt.title(label = 'Travel Bucket List Next Destination', fontsize = 22)
plt.xlabel('Where to?', fontdict={'fontsize': 15})
plt.ylabel('Number of Family Members', fontdict={'fontsize': 15})
plt.xticks(rotation = 45)
plt.bar(df['Next place on your travel bucket list'].value_counts().index,
df['Next place on your travel bucket list'].value_counts().values)

This was fun for the family! Next my friends ?

--

--