Skip to content

Instantly share code, notes, and snippets.

View fuwiak's full-sized avatar
💭
I may be slow to respond.

Pawel fuwiak

💭
I may be slow to respond.
View GitHub Profile
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
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()))
data = open("/Users/macbookssd/Desktop/faster_ds/sample_data/titanic.csv", "r")
data = data.read()
data = data.split("\n")
row_data=[]
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
def find_min(lista):
min_ = lista[0]
for x in lista:
if x<min_:
min_=x
return min_
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))
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
import random
import traceback
import urllib.request
import re
import requests
import time
from PIL import Image
from bs4 import BeautifulSoup
{
"lastUpdateDate": "27/08/2019",
"sections": [
{
"name": "Sekcja past",
"link": "https://facebook.com/groups/1607563912830342",
"members": 69942,
"category": "Humor"
},
{
{
"lastUpdateDate": "27/08/2019",
"sections": [
{
"name": "Sekcja past",
"link": "https://facebook.com/groups/1607563912830342",
"members": 69942,
"category": "Humor"
},
{