The Most Common First Names of MLB Draftees

For some reason I wanted to know if there was any trend in first names of MLB draftees. If you ask me, the first names of MLB draftees & players have some kind of perceived stereotype, and I wanted to see if that was true. For example, it seems like a lot of JJs are drafted. First Step: Get (Extract) the data From googling around and just looking at data on the internet for many years, I knew there was an MLB Stats-API. I had been a member of the mlbdata subreddit for many years. I knew there was a draft endpoint from looking around at the Python wrapper for MLB Stats API Created by Todd Roberts. You can look at what the results of an API call to the draft endpoint looks like for a specific year. For this project, I wanted the useName value in the person object to analyze, as the firstName field has Christopher’s while I wanted Chris’s. At the beginning I wasn’t sure what I would do with this data, so for now I wanted to just loop through every year of MLB drafts and throw the data into a csv. I included some other fields in my final dataframe, in case I wanted to use them. The blank dataframe I created (with pandas as pd) looked like this: ...

August 28, 2024 · Chris Campana

Supercommunicators: How to Unlock the Secret Language of Connection by Charles Duhigg | Notes

What this book is about: This is a book about the art of conversation It has some case studies and lays some rules out on how to have good conversations Notes people love talking to people who let them come away feeling “a little smarter, funnier, more interesting” people want to feel as if they have been heard and like they have some kind of bond with who they are talking a goal for meaning for discussions is to have a “learning conversation” learn how people around us see the world and help them understand out perspectives to communicate with someone we must connect with them absorb what someone is saying and comprehend what we say when a good conversation happens brains align, bodies synchronize and neural simultaneity occurs To become a supercomminiucator: listen close to what is said and unsaid ask right questions recognize and match others moods make our own feelings easy for others to perceive Three types of conversations: Decision Making - What’s this really about? “within every conversation there is a quiet negotiation, where the prize is not winning, but rather determining what everyone wants, so that something meaningful can occur” Simply ask “what do you want?” ask lots of questions “ask open-ended questions and listen closely. Get people talking about how they see the world and what they value most.”" You can at least inspire them to listen back, even if you don’t get the answers. Emotional - How do we feel? About Identity - Who we are? Recognize what kind of conversation is occurring and match each other when someone makes noises as they listen (“yeah”, “Uh-huh”, or laughing) it’s a sign they’re engaged. As well as follow up questions ask open-ended questions. examples: Ask about beliefs or values (“How’d you decide to become a teacher?”) Ask someone to make a judgment (“Are you glad you went to law school?”) Asking about someone’s experiences (“What was it like to visit Europe?”) Talk about intimate things. When people discuss feelings/emotions, other people can’t help but listen to us we become prone to “emotional contagion” when we hear each others deeply held beliefs or values exposing ourselves to someone’s scrutiny engenders a sense of intimacy Asking Questions -> Vulnerability -> Emotional Contagion -> Connection slightly modify fact based questions to make them more emotional, eg: instead of “where do you live?”, “what do you like about where you live?” Prove that you are listening. Demonstrate it after the speaker finishes talking. Repeat in their own words what we just heard them say. be a more desirable partner for future collaboration The Learning Conversation (Rules): Pay attention to what kind of conversation is occuring specify goal(s) before the conversation formulate what we hope to say and how to say it Share your goals, and ask what others are seeking Ask about others feelings, and share your own Explore if identities are important to the discussion do you want to be Helped, Hugged or Heard ? One thing I want to take away from this book is actions I can take to make a better conversation. An actionable item I can do is write down what I want to get out of a call or interview or meeting before it occurs. I can write down answers to questions like: What are the specific topics I might discuss One thing I hope to say One question I will ask just writing these down will help to make for a better conversation, even if I don’t actually use anything I’ve written down I heard of this book through the EconTalk podcast and I kept hearing about it through other sources like this Tim Ferris instagram post, among other places. I read it over three days in August 2024 while traveling from New York to Denver. ...

August 19, 2024 · Chris Campana

Social Network Relationship Graph | SQL Use Case

Here is SQL test I took during a job interview. First is the description, or you can skip directly to the answer. Description: A social network under development needs a query that returns all profiles and the types of their relationships with each other. The result should have the following columns: profile | %related_profile_1% .. %related_profile_N% - type of relation of specific profiles: The column name is the related profile username. Columns are sorted in ascending order by name. The result should be sorted in ascending order by profile. ...

August 18, 2024 · Chris Campana

Dialer Application Weekly Call Stats | SQL Use Case

Here is SQL test I took during a job interview. First is the description, or you can skip directly to the answer. Description: As part of developing the call history functionality of a dialer application, create a query that returns a list of all contacts, the total duration of their calls, and the number of calls during the work week and weekends. The result should have the following column: full_name | phone | type | workweek | weekend. ...

July 22, 2024 · Chris Campana

Using a table of users and their transactions, a SQL query that shows users' first and last transaction | SQL Use Case

I took this SQL test during a job interview. The instructions are (spelling mistake is theirs): “We’d like a data model for quick lookup per user. Create a query that returns 1 row per user containing information on their first purchance and their last.” We have a table that looks like this - the table is called subscriptions which can also be considered transactions. Table "public.subscriptions" Column | Type | Collation | Nullable | Default ----------------+-----------------------------+-----------+----------+--------- transaction_id | character(36) | | not null | purchased_at | timestamp without time zone | | not null | purchase_price | double precision | | not null | user_id | character varying(255) | | not null | The way I did this was with two sub queries. One sub query ranked each user’s transactions. The other sub query counted total transactions per user - use this number to know which transaction was their last. The query with total transactions per user has one row for every user, so in the main query start with that, then join to the ranking query twice, once for the first transaction and once for the last. ...

May 22, 2024 · Chris Campana

Convert seconds to HH:MM:SS PostgreSQL

Here’s how to convert a numeric integer field of seconds to HH:MM:SS. Use the INTERVAL PostgreSQL data type. The INTERVAL data type is used to store and manipulate a time period. Example SELECT 120 * interval '1 sec'; Output |120 seconds to HH:MM:SS| |-----------------------| |00:02:00| An example with a table of rows of call records that have the length of call in seconds in a column called duration. select duration , duration * interval '1 sec' seconds_to_hh_mm_ss , duration * interval '1 min' min_to_hh_mm_ss from calls; Output ...

May 1, 2024 · Chris Campana

Using RStudio – editing your user level and project level .RProfile file

Using the .Rprofile file in RStudio is a great way to automatically load packages and functions upon startup. If you know of additional ways to use this file, let me know. For now, here are easy ways to edit these files at each level. Very simply, use the usethis::edit_r_profile() command to edit your .RProfile file. It defaults to edit the user level file but you can add scope = c("user", "project") to the argument of the function. For example, if you wanted to edit the project level .RProfile file, use this command: usethis::edit_r_profile(scope = c("project")). ...

March 21, 2021 · Chris Campana

How to download (export) your WordPress posts and data from your free WordPress blog

It is real easy. First go to the WP Admin page of your blog. It is the same URL as your blog with /wp-admin/ appended to the end. Then click Tools > Export. You should now be on the “Export Content” screen. Follow the instructions on this screen to get your posts and other data.

January 15, 2021 · Chris Campana

R – how to select all rows of a data frame where a condition is met

Here is an example, the data looks like this with 3 columns. > fd_nba_raw Position Nickname Injury.Indicator 1 PG Luka Doncic 2 PF Giannis Antetokounmpo 3 C Karl-Anthony Towns GTD 4 SF Kevin Durant 5 SF LeBron James 6 PF Anthony Davis GTD 7 PG Kyrie Irving O 8 SG CJ McCollum 9 SF Kawhi Leonard 10 PG Damian Lillard GTD To select only those with Injury.Indicator = ‘O’ ...

January 13, 2021 · Chris Campana

AB or Hypothesis test comparing the mean of two samples (using R)

To compare means of two samples, we need to perform an independent samples t-test, more commonly called Student’s t-Test. To perform this test, we need to know some statistics about the samples: each sample’s mean (x̄), standard deviation (s), and sample size (n). Here is an example: There is data contained in a table of two columns. Column 1 is called ‘category’ and Column 2 is called ‘length.’ The category column contains two options, a and b, while the length column contains lengths in R type num. We want to find out if the mean length of the a values are different than the mean length of the b values. The data looks something like this. The hypothesis statements look like this: ...

December 24, 2020 · Chris Campana