This file contains 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
df.nlargest(3, 'lat') | |
df.nsmallest(3, 'lat') |
This file contains 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
# 'counts' will be the name of the new column | |
# 'date' will be the index of the dataframe | |
x = df['date'].value_counts().to_frame('counts') | |
x['prop'] = x['counts'] / x['counts'].sum() |
This file contains 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
qa0f,100a <Esc>50|dwjq |
This file contains 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 scrub_output_pre_save(model, **kwargs): | |
"""scrub output before saving notebooks""" | |
# only run on notebooks | |
if model['type'] != 'notebook': | |
return | |
# only run on nbformat v4 | |
if model['content']['nbformat'] != 4: | |
return | |
for cell in model['content']['cells']: |
This file contains 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
kaggle competitions submit -f <file> -m <message> <competition> |
This file contains 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
pipeline.named_steps['logisticregression'].coef_ |
This file contains 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
model = ols("SalePrice ~ C(LandContour, Treatment(reference='Lvl'))", data=df).fit() |
This file contains 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
df[df.apply(lambda x: np.any(x > 100_000), axis=1, raw=True)] |
This file contains 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
%config InlineBackend.figure_format='retina' |
This file contains 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
ls *.ipynb | entr jupyter nbconvert *.ipynb --to python --output-dir=./src |
OlderNewer