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 dataframe_metainformation(df): | |
meta = dict() | |
descr = pd.DataFrame({'dtype': df.dtypes, 'NAs': df.isna().sum()}) | |
categorical_features = descr.loc[descr['dtype'] == 'object'].index.values.tolist() | |
numerical_features = descr.loc[descr['dtype'] != 'object'].index.values.tolist() | |
numerical_features_na = descr.loc[(descr['dtype'] != 'object') & (descr['NAs'] > 0)].index.values.tolist() | |
categorical_features_na = descr.loc[(descr['dtype'] == 'object') & (descr['NAs'] > 0)].index.values.tolist() | |
complete_features = descr.loc[descr['NAs'] == 0].index.values.tolist() | |
meta['description'] = descr | |
meta['categorical_features'] = categorical_features |
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 fizz_buzz(lower=1, upper=101): | |
return ["Fizz"*(x % 3 == 0) + "Buzz"*(x % 5 == 0) or str(x) \ | |
for x in range(lower, upper)] | |
print('\n'.join(fizz_buzz())) |
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
data = open("/Users/macbookssd/Desktop/faster_ds/sample_data/titanic.csv", "r") | |
data = data.read() | |
data = data.split("\n") | |
row_data=[] |
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 mediana(lista): | |
N = len(lista) | |
lista.sort() | |
ind=N//2 | |
if N%2==1: | |
return lista[ind] | |
else: | |
return (lista[ind-1]+lista[ind])/2 |
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 find_min(lista): | |
min_ = lista[0] | |
for x in lista: | |
if x<min_: | |
min_=x | |
return min_ | |
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
num_of_class = 7; | |
model = Sequential() | |
model.add(Conv2D(10, (2, 2), activation='softmax', input_shape=(48,48,1))) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Conv2D(64, (5, 5), activation='softmax')) | |
model.add(MaxPooling2D(pool_size=(2, 2))) | |
model.add(Flatten()) | |
model.add(Dense(1000, activation='relu')) | |
model.add(Dropout(0.5)) |
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 dump_to_pickle(model, filename): | |
import pickle | |
pickle.dump(model, open(filename, 'wb')) | |
def load_from_pickle(filename): | |
import pickle | |
loaded_model = pickle.load(open(filename, 'rb')) | |
return loaded_model |
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
import random | |
import traceback | |
import urllib.request | |
import re | |
import requests | |
import time | |
from PIL import Image | |
from bs4 import BeautifulSoup |
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
{ | |
"lastUpdateDate": "27/08/2019", | |
"sections": [ | |
{ | |
"name": "Sekcja past", | |
"link": "https://facebook.com/groups/1607563912830342", | |
"members": 69942, | |
"category": "Humor" | |
}, | |
{ |
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
{ | |
"lastUpdateDate": "27/08/2019", | |
"sections": [ | |
{ | |
"name": "Sekcja past", | |
"link": "https://facebook.com/groups/1607563912830342", | |
"members": 69942, | |
"category": "Humor" | |
}, | |
{ |