Skip to content

Instantly share code, notes, and snippets.

View ryanorsinger's full-sized avatar
🎏
Reading the readme... again :)

Ryan Orsinger ryanorsinger

🎏
Reading the readme... again :)
View GitHub Profile
@ryanorsinger
ryanorsinger / groupby column rename
Created January 31, 2023 19:34
Groupby Column Rename to Have Name and Percentage (or other Aggregate Function)
# Say we have a number of records per year
# And we need to get the percentage breakdown/makeup of a category for each year
# If we leave the column name as "SomeCategory", but it shows a percent, then we need to rename in order to keep the category's name
x = pd.DataFrame(df.groupby("year").SomeCategory.value_counts(normalize=True).round(2))
x.columns = ["percentage"]
x.reset_index()
@ryanorsinger
ryanorsinger / attrition.csv
Last active December 26, 2023 16:20
HR Attrition Analysis
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 35 columns, instead of 8 in line 4.
Age,Attrition,BusinessTravel,DailyRate,Department,DistanceFromHome,Education,EducationField,EmployeeCount,EmployeeNumber,EnvironmentSatisfaction,Gender,HourlyRate,JobInvolvement,JobLevel,JobRole,JobSatisfaction,MaritalStatus,MonthlyIncome,MonthlyRate,NumCompaniesWorked,Over18,OverTime,PercentSalaryHike,PerformanceRating,RelationshipSatisfaction,StandardHours,StockOptionLevel,TotalWorkingYears,TrainingTimesLastYear,WorkLifeBalance,YearsAtCompany,YearsInCurrentRole,YearsSinceLastPromotion,YearsWithCurrManager
41,Yes,Travel_Rarely,1102,Sales,1,2,Life Sciences,1,1,2,Female,94,3,2,Sales Executive,4,Single,5993,19479,8,Y,Yes,11,3,1,80,0,8,0,1,6,4,0,5
49,No,Travel_Frequently,279,Research & Development,8,1,Life Sciences,1,2,3,Male,61,2,2,Research Scientist,2,Married,5130,24907,1,Y,No,23,4,4,80,1,10,3,3,10,7,1,7
37,Yes,Travel_Rarely,1373,Research & Development,2,2,Other,1,4,4,Male,92,2,1,Laboratory Technician,3,Single,2090,2396,6,Y,Yes,15,3,2,80,0,7,3,3,0,0,0,0
33,No,Travel_Frequently,1392,Research & Development,3,4,L
[
{
"quote": "We don't make mistakes, just happy little accidents.",
"author": "Bob Ross"
},
{
"quote": "Talent is a pursued interest. In other words, anything you are willing to practice, you can do.",
"author": "Bob Ross"
},
{
@ryanorsinger
ryanorsinger / outline.md
Created December 3, 2022 17:27
JointProb group from SciCloj

What is Jointprob?

Jointprob is a probabilistic modelling and Bayesian statistics study group.

https://scicloj.github.io/docs/community/groups/jointprob/

Why is Scicloj organizing this Group

Scicloj is an open-source group working on a stack of tools and libraries for data science using the Clojure programming language.

A few of us care a lot about the probabilistic/Bayesian paradigm and find it a promising approach in general

@ryanorsinger
ryanorsinger / setup.md
Last active August 4, 2022 03:17
Installing rstan, cmdstan, and rethinking packages on a relatively fresh OS install.

Goal: Install rstan, cmdstan, and rethinking in order to work through Rethinking Statistics.

Computing Environment

  • MacOS Monterrey running on M1 chip
  • MacOS Big Sur running on an Intel chip
  • Existing dependencies:
    • Installed XCode command line tools with xcode-select --install.
    • I installed R, RStudio, and could install and run other R packages.

Problem:

@ryanorsinger
ryanorsinger / curricula.md
Created June 8, 2022 19:46
Jen_Looper's_Crown_Jewel_Content

copy of https://github.com/microsoft/AcademicContent/blob/main/curricula.md

Curricula

Here you will find curated, semester-long experiences for students and educators who would like to use this MIT-licensed content in their classrooms.

Title Description
Web Development for Beginners, 24 lessons A curriculum with 24 lessons, assignments and five projects to build. Covers HTML, CSS and JavaScript. Also includes Pre- and Post- Quizzes. Made with teachers in mind, or as self paced learning
Machine Learning for Beginners, 25 lessons A curriculum with 25 lessons with assignments covering classic Machine Learning primarily using Scikit-learn. Covers Regression, Classification, Clustering, NLP, Time Series Forecasting, and Reinforcement Learning, with two Applied ML lessons. Also inclu
@ryanorsinger
ryanorsinger / mall_customers.csv
Created January 4, 2022 02:07
Mall Customers Dataset (A "Hello World" for Clustering examples)
customer_id gender age annual_income spending_score
0001 Male 19 15 39
0002 Male 21 15 81
0003 Female 20 16 6
0004 Female 23 16 77
0005 Female 31 17 40
0006 Female 22 17 76
0007 Female 35 18 6
0008 Female 23 18 94
0009 Male 64 19 3
@ryanorsinger
ryanorsinger / scope.py
Last active October 25, 2021 16:49
Critical difference between global variables and function parameters and local variables
# Consider the following
# This global variable is defined outside the scope of all functions
global_variable = 1
# The parameter is the "input variable". Calling the function "sends in" a value, assigning it to parameter_variable
# The scope of the parameter variable is only inside of a function
def add_one(parameter_variable):
return global_variable + 1
@ryanorsinger
ryanorsinger / tips.csv
Last active February 27, 2024 21:51
Tips Dataset
total_bill tip sex smoker day time size
16.99 1.01 Female No Sun Dinner 2
10.34 1.66 Male No Sun Dinner 3
21.01 3.5 Male No Sun Dinner 3
23.68 3.31 Male No Sun Dinner 2
24.59 3.61 Female No Sun Dinner 4
25.29 4.71 Male No Sun Dinner 4
8.77 2.0 Male No Sun Dinner 2
26.88 3.12 Male No Sun Dinner 4
15.04 1.96 Male No Sun Dinner 2
@ryanorsinger
ryanorsinger / readme.md
Created October 4, 2021 20:47
My Mac Setup Preferences

I ran defaults -currentHost write -g AppleFontSmoothing -int 0 from the terminal and I've noticed that the display of my typing speed is now appropriate instead of feeling like the computer is borked.