Skip to content

Instantly share code, notes, and snippets.

View mprzybyla123's full-sized avatar

Matt Przybyla mprzybyla123

View GitHub Profile
@mprzybyla123
mprzybyla123 / .py
Created May 14, 2020 21:00
medium-success-prediction
# import libraries
# sklearn reference: https://scikit-learn.org/0.19/about.html#citing-scikit-learn
# pandas reference: https://pandas.pydata.org/
from sklearn.model_selection import train_test_split, GridSearchCV, cross_val_score, StratifiedKFold
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.pipeline import Pipeline, FeatureUnion
import matplotlib.pyplot as plt
@mprzybyla123
mprzybyla123 / .py
Created May 12, 2020 19:09
pandas-append
# All the python code below for use:
# import library
import pandas as pd
# read in your dataframe
df = pd.read_csv('/Users/data.csv')
# print out your first five rows
df.head()
@mprzybyla123
mprzybyla123 / .py
Last active May 7, 2020 21:56
query-pandas
# All the python code below for use:
# import library
import pandas as pd
# read in your dataframe
df = pd.read_csv('/Users/example.csv')
# write out new rows
rows = [pd.Series([100, 100, 20,'Blue','Label_1'], index=df.columns),
@mprzybyla123
mprzybyla123 / .py
Last active April 26, 2020 21:53
nlp-example
# import libraries
# sklearn reference: https://scikit-learn.org/
# pandas reference: https://pandas.pydata.org/
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn import metrics
import pandas as pd
@mprzybyla123
mprzybyla123 / .py
Created April 26, 2020 19:16
nlp-example
# import libraries
# sklearn reference: https://scikit-learn.org/0.19/about.html#citing-scikit-learn
# pandas reference: https://pandas.pydata.org/
from sklearn.feature_extraction.text import TfidfVectorizer, CountVectorizer
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestClassifier
from sklearn.pipeline import Pipeline, FeatureUnion
from sklearn import metrics
import pandas as pd
@mprzybyla123
mprzybyla123 / .py
Created April 22, 2020 01:17
read_df.py
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
from example.introduction_class import IntroductionClass
import pandas as pd
class testClass(IntroductionClass):
@mprzybyla123
mprzybyla123 / .py
Created April 22, 2020 01:16
introduction_class.py
#!/usr/bin/env python
# coding: utf-8
# In[ ]:
class IntroductionClass:
def __init__(self, data):
self.data = data