Instantly share code, notes, and snippets.

# Alla Tambovtseva allatambov

Created Apr 5, 2018
View lecture-intro-vars.ipynb
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Last active Jun 26, 2018
26-06
View numpy-tutorial
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 numpy as np # списки L = [1, 2, 4, 0] E = [[1, 0, 3], [3, 6, 7], []] D = [[1, 3, 6], ['a', 'b', 'c']] # массивы numpy A = np.array(L)
Last active Jun 26, 2018
View Matplotlib
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 matplotlib.pyplot as plt % matplotlib inline # создать простой график на основе двух списков X = [-2, -0.5, 0, 2, 5, 8, 9, 10] Y = [4, 0.25, 0, 4, 25, 64, 81, 100] Z = [10, 9, 8, 5, 2, 0, -1, -2]
Created Jun 26, 2018
View Matplotlib
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 matplotlib.pyplot as plt # создать простой график на основе двух списков X = [-2, -0.5, 0, 2, 5, 8, 9, 10] Y = [4, 0.25, 0, 4, 25, 64, 81, 100] plt.plot(X,Y) plt.plot(X, Y, 'lightblue')
Last active Jun 27, 2018
View scipy_sklearn
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
 # загрузить stats из scipy # pandas - для базы данных import scipy.stats as st import pandas as pd # загрузить базу df = pd.read_csv('swiss.csv') # работа df[df.Catholic > 50]
Last active Jun 28, 2018
View texts-part1
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
 # загружаем txt-file f = open('mytext.txt', 'r', encoding = 'UTF-8') f.readlines() lines = f.readlines() lines # ха-ха f.readlines()
Last active Jun 28, 2018
View texts-part2
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 pandas as pd df = pd.read_csv('articles.csv', encoding= 'UTF-8') df df.text[3] # пока сами - взять функцию normalize() из прошлой части # и создать новый столбец с text_norm с нормализованным текстом # с помощью apply
Last active Jun 28, 2018
View texts-part3
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 pandas as pd df = pd.read_csv('articles.csv', encoding= 'UTF-8') # normalization import string def normalize(x): to_remove = string.punctuation + '«»—' translator = str.maketrans('', '', to_remove) res = x.translate(translator) res = res.lower()
Last active Jun 28, 2018
View classes
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
 class Student: def __init__(self, name="name", mark=0, age=None): self.name = name self.mark = mark self.age = age def mark5(self): if self.mark >= 8: m = 5 if self.mark in [6, 7]:
Last active Oct 2, 2019
We couldn’t find that file to show.