Here's some advice from Zac Hatfield-Dodds, Python maintainer extraordinaire, about getting started with open source:
I don't think I can offer advice for applying to [a specific job], but general principles for developing software engineering skills via OSS contributions I can do!
- Think of "efforts to help the alignment ecosystem" as a separate goal that should be pursued through separate activities (carry a knife and a hammer, not a knife/hammer multitool).
- There's going to be a lot of "just execute on the obvious thing for impact" where it's neglected. It's not all going to be interesting or educational.
- The open secret to success is consistent persistence. If you work on meaningful projects for a few hours every week for three years, you'll almost certainly come out the other side with lots of valuable skills and experience!
- You will at times take on overly ambitious projects and get stuck: recognize this, back off, write up your notes for the next person, and then g
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| plt.figure(figsize=(16, 6)) | |
| ax = sns.countplot(x='plant', hue=TARGET, | |
| data=data[(data[TARGET] == 1) | (data[TARGET] == 5)]) | |
| ax.set_xticklabels(ax.get_xticklabels(), rotation=90); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| import seaborn as sns | |
| %matplotlib inline | |
| data = pd.read_csv('greenhouse.csv') | |
| TARGET = 'prize_worthiness' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| data['orchid'] = data['plant'].apply(lambda x: 1 if 'orchid' in x else 0) | |
| piv = pd.pivot_table(data2, index=['orchid', 'plant'], values='price', aggfunc=np.sum) | |
| piv0 = data[['orchid','plant','price']].groupby(by=['orchid','plant']).sum() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| data['new_shelf'] = np.where( (data['condition'] == 'full sun') | |
| & (data['music'] == 'bach'), 1, 0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def sunny_shelf(col1, col2): | |
| return (1 if ((col1 == 'full sun') & (col2 == 'bach')) else 0) | |
| data['new_shelf'] = data.apply(lambda x: sunny_shelf(x.condition, x.music), axis=1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import pandas as pd | |
| data = pd.DataFrame({'plant': greenhouse, | |
| 'height_(cm)': [50, 20, 15, 40, 50, | |
| 60, 45, 50, 50, 20, 20], | |
| 'condition': ['full sun', 'shade', 'partial sun', 'partial sun', 'partial sun', | |
| 'full sun', 'shade', 'partial sun', 'full sun', 'partial sun', 'full sun'], | |
| 'water_(cm/week)': [2.5, 4, 2.5, 2.5, 3, | |
| 0.5, 4.5, 2.5, 2, 2.5, 2.5], | |
| 'music': ['bach', 'bach', 'beyonce', 'bach', 'cardi b', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| greenhouse = ['boat orchid', 'bird\'s nest fern', 'dancing-lady orchid', | |
| 'nun\'s hood orchid', 'pennywort', 'snake plant', | |
| 'maidenhair fern', 'chinese ground orchid', | |
| 'vanilla orchid', 'tiger orchid', 'pothos'] | |
| [print(plant) for plant in greenhouse if 'orchid' in plant]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def read_excel_sheets(xls_path): | |
| """Read all sheets of an Excel workbook and return a single DataFrame""" | |
| print(f'Loading {xls_path} into pandas') | |
| xl = pd.ExcelFile(xls_path) | |
| df = pd.DataFrame() | |
| columns = None | |
| for idx, name in enumerate(xl.sheet_names): | |
| print(f'Reading sheet #{idx}: {name}') | |
| sheet = xl.parse(name) | |
| if idx == 0: |
NewerOlder