markdown
stringlengths
0
1.02M
code
stringlengths
0
832k
output
stringlengths
0
1.02M
license
stringlengths
3
36
path
stringlengths
6
265
repo_name
stringlengths
6
127
Now let's do the same thing with the decoy molecules
decoy_df = pd.read_csv("mk01/decoys_final.ism",header=None,sep=" ") decoy_df.columns = ["SMILES","ID"] decoy_rows, decoy_cols = decoy_df.shape decoy_df["label"] = ["Decoy"]*decoy_rows PandasTools.AddMoleculeColumnToFrame(decoy_df,"SMILES","Mol") add_property_columns_to_df(decoy_df) tmp_df = active_df.append(decoy_df)
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
With properties calculated for both the active and the decoy sets, we can compare the properties of the two compound sets. To do the comparison, we will use violin plots. A violin plot can be thought of as analogous to a boxplot. The violin plot provides a mirrored, horizontal view of a frequency distribution. Ideal...
sns.violinplot(tmp_df["label"],tmp_df["mw"])
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
An examination of the distributions in the figures above show that the molecular weight distributions for the two setsare roughly equivalent. The decoy set has more low molecular weight molecules, but the center of the distribution, show as a box in the middle of each violin plot is in a similar location in both plots...
sns.violinplot(tmp_df["label"],tmp_df["logP"])
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
Finally, we will do the same comparison with the formal charges of the molecules.
sns.violinplot(tmp_df["label"],tmp_df["charge"])
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
In this case, we see a signficant difference. All of the active molecules are neutral, while some of the decoys are charged. Let see what fraction of the decoy molecules are charged. We can do this by creating a new dataframewith just the charged molecules.
charged = decoy_df[decoy_df["charge"] != 0]
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
A pandas dataframe has a property, shape, that returns the number of rows and columns in the dataframe. As such,element[0] in the shape property will be the number of rows. Let's divide the number of rows in our dataframe of charged molecules by the total number of rows in the decoy dataframe.
charged.shape[0]/decoy_df.shape[0]
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
The fact that 16% of the decoy compounds are charged, while none of the active compounds are is a concern. An examination of both sets indicate that charge states were assigned to the decoys, but not to the active molecules. In order to be consistent, we will use some code from the RDKit Cookbook to neutralize the mol...
from neutralize import NeutraliseCharges
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
Now we will create a new dataframe with the SMILES, ID, and label for the decoys.
revised_decoy_df = decoy_df[["SMILES","ID","label"]].copy()
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
With this new dataframe in hand, we can replace the SMILES with the SMILES for the neutral form of the molecule. TheNeutraliseCharges function returns two values. The first is the SMILES for the neutral form of the molecule and the second is a boolean variable indicating whether the molecule was changed. In the code ...
revised_decoy_df["SMILES"] = [NeutraliseCharges(x)[0] for x in revised_decoy_df["SMILES"]]
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
Once we've replaced the SMILES, we can add a molecule column to our new dataframe and calculated properties again.
PandasTools.AddMoleculeColumnToFrame(revised_decoy_df,"SMILES","Mol") add_property_columns_to_df(revised_decoy_df)
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
We can now append the dataframe with the active molecules to the one with the revised, neutral decoys and calculateanother box plot.
new_tmp_df = active_df.append(revised_decoy_df) sns.violinplot(new_tmp_df["label"],new_tmp_df["charge"])
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
An examination of the plot about show that there are very few charged molecules in the decoy set. We can use the same technique we used above to create a dataframe with only the charged molecules. We can then use this dataframe to determine the number of charged molecules remaining in the set.
charged = revised_decoy_df[revised_decoy_df["charge"] != 0] charged.shape[0]/revised_decoy_df.shape[0]
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
We have now reduced the fraction of charged compounds from 16% to 0.3%. We can now be confident that our active and decoy sets are reasonbly well balanced. In order to use these datasets with DeepChem we need to write the molecules out as a csv file consisting of SMILES, Name, and an integer value indicating whether...
active_df["is_active"] = [1] * active_df.shape[0] revised_decoy_df["is_active"] = [0] * revised_decoy_df.shape[0] combined_df = active_df.append(revised_decoy_df)[["SMILES","ID","is_active"]] combined_df.head()
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
Our final step in this section is to save our new combined_df as a csv file. The index=False option causes Pandas to not include the row number in the first column.
combined_df.to_csv("dude_erk1_mk01.csv")
_____no_output_____
MIT
Chapter11/chapter_11_01_preparing_to_build_a_predictive_models.ipynb
peastman/DeepLearningLifeSciences
Load features
featurepath = r'Z:\3DHistoData\Grading\LBP_features_surface.xlsx' gpath = r'Z:\3DHistoData\Grading\PTAgreiditjanaytteet.xls' save = r'Z:\3DHistoData\Grading' total = 1 surf = 2 deep = 5 cc = 6 deepcell = 7 deepECM = 8 ccECM = 9 ccVasc = 10 choice = surf pipeline_load(featurepath, gpath, save, choice)
Max grade: 3, min grade: 0 (32, 36) [-0.61126449 1.55888136 0.81372917 0.47258567 -1.55170516 -1.5287743 -0.89660894 2.45591342 -0.47300054 0.49480033] (36, 10) Confusion matrix [[ 5 3 0 0] [ 1 7 3 0] [ 0 1 10 2] [ 0 1 3 0]] Mean squared error, Area under curve 1 and 2 0.36308781086036107 0.79464285...
MIT
training/notebooks/LBP features old.ipynb
MIPT-Oulu/3DHistoGrading
Calculate LBP features from .dat mean and std images
impath = r'Z:\3DHistoData\SurfaceImages\Deep' impath = r'V:\Tuomas\PTASurfaceImages' dtype = 'dat' dtype = 'mat' savepath = r'Z:\3DHistoData\Grading\LBP' save = r'Z:\3DHistoData\Grading' pipeline_lbp(impath, savepath, save, dtype)
_____no_output_____
MIT
training/notebooks/LBP features old.ipynb
MIPT-Oulu/3DHistoGrading
Desafio 5Neste desafio, vamos praticar sobre redução de dimensionalidade com PCA e seleção de variáveis com RFE. Utilizaremos o _data set_ [Fifa 2019](https://www.kaggle.com/karangadiya/fifa19), contendo originalmente 89 variáveis de mais de 18 mil jogadores do _game_ FIFA 2019.> Obs.: Por favor, não modifique o nome ...
from math import sqrt import pandas as pd import matplotlib.pyplot as plt import numpy as np import scipy.stats as sct import seaborn as sns import statsmodels.api as sm import statsmodels.stats as st from sklearn.decomposition import PCA from loguru import logger from sklearn.linear_model import LinearRegression fr...
_____no_output_____
MIT
Modulo 6/main.ipynb
ronaldogomes96/Acelera-Dev-DataScience
Inicia sua análise a partir daqui
# Sua análise começa aqui. fifa.dropna(inplace= True)
_____no_output_____
MIT
Modulo 6/main.ipynb
ronaldogomes96/Acelera-Dev-DataScience
Questão 1Qual fração da variância consegue ser explicada pelo primeiro componente principal de `fifa`? Responda como um único float (entre 0 e 1) arredondado para três casas decimais.
def q1(): # Retorne aqui o resultado da questão 1. pca = PCA(n_components = 1) project = pca.fit(fifa) varianciaExplicada = project.explained_variance_ratio_[0] return varianciaExplicada.round(3) pass
_____no_output_____
MIT
Modulo 6/main.ipynb
ronaldogomes96/Acelera-Dev-DataScience
Questão 2Quantos componentes principais precisamos para explicar 95% da variância total? Responda como un único escalar inteiro.
def q2(): # Retorne aqui o resultado da questão 2. pca095 = PCA(n_components= 0.95) project = pca095.fit_transform(fifa) numeroComponentesPrincipais = project.shape[1] return numeroComponentesPrincipais pass
_____no_output_____
MIT
Modulo 6/main.ipynb
ronaldogomes96/Acelera-Dev-DataScience
Questão 3Qual são as coordenadas (primeiro e segundo componentes principais) do ponto `x` abaixo? O vetor abaixo já está centralizado. Cuidado para __não__ centralizar o vetor novamente (por exemplo, invocando `PCA.transform()` nele). Responda como uma tupla de float arredondados para três casas decimais.
x = [0.87747123, -1.24990363, -1.3191255, -36.7341814, -35.55091139, -37.29814417, -28.68671182, -30.90902583, -42.37100061, -32.17082438, -28.86315326, -22.71193348, -38.36945867, -20.61407566, -22.72696734, -25.50360703, 2.16339005, -27.96657305, -33.46004736, -5.08943224, -30.21994603, ...
_____no_output_____
MIT
Modulo 6/main.ipynb
ronaldogomes96/Acelera-Dev-DataScience
Questão 4Realiza RFE com estimador de regressão linear para selecionar cinco variáveis, eliminando uma a uma. Quais são as variáveis selecionadas? Responda como uma lista de nomes de variáveis.
def q4(): # Retorne aqui o resultado da questão 4. x = fifa.drop(columns="Overall") y = fifa["Overall"] rfe = RFE(estimator= LinearRegression(), n_features_to_select= 5) rfe.fit(x,y) indexFeatureSelect = rfe.get_support(indices=True) featureSelect = list(x.columns[indexFeatureSelect]) ...
_____no_output_____
MIT
Modulo 6/main.ipynb
ronaldogomes96/Acelera-Dev-DataScience
Tile Sliding Domain
import random import heapq random.seed(13) StateDimension=3 # StateDimension=4 #InitialState = [1,2,3,4,5,6,0,7,8] InitialState = "123456078" #GoalState=[1,2,3,4,5,6,7,8,0] GoalState = "123456780" # GoalState = "123456789ABCDEF0" Actions = lambda s: ['u', 'd', 'l', 'r'] Opposite=dict([('u','d'),('d','u'),('l','r'),('r...
123 456 078 123 056 478 123 506 478
Apache-2.0
c164s22ch3.ipynb
everestso/Fall21Spring22
Random Walk
def RandomWalk(state, steps): actionSequence = [] actionLast = None for i in range(steps): action = None while action==None: action = random.choice(Actions(state)) action = action if (LegalMove(state, action) and action!= Opposite[actionLast]) else None actionLast = action s...
203 156 478 ['l', 'l', 'u', 'u', 'r'] ['l', 'd', 'd', 'r', 'r'] 123 456 780
Apache-2.0
c164s22ch3.ipynb
everestso/Fall21Spring22
Example 1
Problems = [RandomWalk(GoalState, 5) for _ in range(10)] for i, s in Problems: print ('"', i, '" , "', ''.join(map(str, ReverseMoves(s))), '",', ManhattanDistance(i, GoalState), sep='') NewState = ApplyMoves("dldrr", "103526478") print (NewState) PrintState("123456780") print() PrintState("103526478") print...
ManhattanDistance= 5 Out of Place= 5
Apache-2.0
c164s22ch3.ipynb
everestso/Fall21Spring22
Example 2
Problems = [RandomWalk(GoalState, 100) for _ in range(20)] for i, s in Problems: print ('"', i, '", ', ''.join(map(str, ReverseMoves(s))), '",', OutOfPlace(i, GoalState), " ", ManhattanDistance(i, GoalState), sep='') InitialState = "281607543" GoalState = "123456780" print ("ManhattanDistance=", ManhattanD...
100 123456780
Apache-2.0
c164s22ch3.ipynb
everestso/Fall21Spring22
Simple 15 Puzzle Test
GoalState = "123456789ABCDEF0" s15a = Result(GoalState, "l") s15b = Result(GoalState, "u") PrintState(GoalState) print() PrintState(s15a) print('') PrintState(s15b)
123 456 789 ABC DEF 0 ['1', '2', '3'] ['4', '5', '6'] ['7', '8', '9'] ['A', 'B', 'C'] ['D', 'E', 'F'] ['0'] 123 456 789 ABC 0EF D
Apache-2.0
c164s22ch3.ipynb
everestso/Fall21Spring22
Discussion
StateDimension=3 s1 = "821357064" sol1="ruurdllurrdlurddllurrdllurrd" r = ApplyMoves(sol1, s1) PrintState(r) StateDimension=4 s1 = "13275AE069C4DF8B" sol1="dluullddrrruuldrddlurdlluulurrrddd" r = ApplyMoves(sol1, s1) PrintState(r) StateDimension=4 s="FAC42B061D89E537" sol1="LLURDLDRDRURDLUULDDRUUULLDRDDRUULURDRDDLLLURU...
51 153 ------Solution 1------- 1234 5678 9ABC DEF0 ------Solution 2------- 1234 5678 9ABC DEF0
Apache-2.0
c164s22ch3.ipynb
everestso/Fall21Spring22
Assignment Challenge Problems
StateDimension=4 s="71A92CE03DB4658F " sol1="LLLDDRURURDLDRULLULURRRDDLUULDDRUULDLDDRURULLDRRRD".lower() print(len(sol1)) r = ApplyMoves(sol1, s) PrintState(r) StateDimension=4 s="02348697DF5A1EBC" sol1="RDDRDLULDRUURDLULDDRRURULLULDDRRRULDRD".lower() print(len(sol1)) r = ApplyMoves(sol1, s) PrintState(r) StateDimens...
58 1234 5678 9ABC DEF0
Apache-2.0
c164s22ch3.ipynb
everestso/Fall21Spring22
Goals 1. Visualize deep learning network 2. Understand how the final layer would change when number of classes in dataset changes What do you do with a deep learning model in transfer learning - These are the steps already done by contributors in pytorch, keras and mxnet - You take a deep learning architec...
! wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1jE-ckk0JbrdbJvIBaKMJWkTfbRDR2MaF' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1jE-c...
_____no_output_____
Apache-2.0
study_roadmaps/2_transfer_learning_roadmap/3_effect_of_number_of_classes_in_dataset/3) Understand transfer learning and the role of number of dataset classes in it - Keras.ipynb
take2rohit/monk_v1
Imports
#Using keras backend # When installed using pip from monk.keras_prototype import prototype # When installed manually (Uncomment the following) #import os #import sys #sys.path.append("monk_v1/"); #sys.path.append("monk_v1/monk/"); #from monk.keras_prototype import prototype
_____no_output_____
Apache-2.0
study_roadmaps/2_transfer_learning_roadmap/3_effect_of_number_of_classes_in_dataset/3) Understand transfer learning and the role of number of dataset classes in it - Keras.ipynb
take2rohit/monk_v1
Creating and managing experiments - Provide project name - Provide experiment name
gtf = prototype(verbose=1); gtf.Prototype("Project", "study-num-classes");
Keras Version: 2.2.5 Tensorflow Version: 1.12.0 Experiment Details Project: Project Experiment: study-num-classes Dir: /home/abhi/Desktop/Work/tess_tool/gui/v0.3/finetune_models/Organization/development/v5.0_blocks/study_roadmap/change_post_num_layers/5_transfer_learning_params/1_number_of_classes_in_datas...
Apache-2.0
study_roadmaps/2_transfer_learning_roadmap/3_effect_of_number_of_classes_in_dataset/3) Understand transfer learning and the role of number of dataset classes in it - Keras.ipynb
take2rohit/monk_v1
This creates files and directories as per the following structure workspace | |--------Project | |-----study-num-classes | |-----experiment-state.json ...
gtf.Default(dataset_path="study_classes/dogs_vs_cats", model_name="resnet50", num_epochs=5);
Dataset Details Train path: study_classes/dogs_vs_cats Val path: None CSV train path: None CSV val path: None Dataset Params Input Size: 224 Batch Size: 4 Data Shuffle: True Processors: 4 Train-val split: 0.7 Found 36 images belonging to 2 classes. Found 14 images ...
Apache-2.0
study_roadmaps/2_transfer_learning_roadmap/3_effect_of_number_of_classes_in_dataset/3) Understand transfer learning and the role of number of dataset classes in it - Keras.ipynb
take2rohit/monk_v1
From Data summary - Num classes: 2 Visualize network
gtf.Visualize_With_Netron(data_shape=(3, 224, 224), port=8081);
Using Netron To Visualize Not compatible on kaggle Compatible only for Jupyter Notebooks Serving 'final.h5' at http://localhost:8081
Apache-2.0
study_roadmaps/2_transfer_learning_roadmap/3_effect_of_number_of_classes_in_dataset/3) Understand transfer learning and the role of number of dataset classes in it - Keras.ipynb
take2rohit/monk_v1
The final layer
from IPython.display import Image Image(filename='imgs/2_classes_base_keras.png')
_____no_output_____
Apache-2.0
study_roadmaps/2_transfer_learning_roadmap/3_effect_of_number_of_classes_in_dataset/3) Understand transfer learning and the role of number of dataset classes in it - Keras.ipynb
take2rohit/monk_v1
Reset Default Params with new dataset - Logo classification
gtf = prototype(verbose=1); gtf.Prototype("Project", "study-num-classes"); gtf.Default(dataset_path="study_classes/logos", model_name="resnet50", num_epochs=5);
Dataset Details Train path: study_classes/logos Val path: None CSV train path: None CSV val path: None Dataset Params Input Size: 224 Batch Size: 4 Data Shuffle: True Processors: 4 Train-val split: 0.7 Found 82 images belonging to 16 classes. Found 28 images belong...
Apache-2.0
study_roadmaps/2_transfer_learning_roadmap/3_effect_of_number_of_classes_in_dataset/3) Understand transfer learning and the role of number of dataset classes in it - Keras.ipynb
take2rohit/monk_v1
From Data summary - Num classes: 16 Visualize network
gtf.Visualize_With_Netron(data_shape=(3, 224, 224), port=8082);
Using Netron To Visualize Not compatible on kaggle Compatible only for Jupyter Notebooks Serving 'final.h5' at http://localhost:8082
Apache-2.0
study_roadmaps/2_transfer_learning_roadmap/3_effect_of_number_of_classes_in_dataset/3) Understand transfer learning and the role of number of dataset classes in it - Keras.ipynb
take2rohit/monk_v1
The final layer
from IPython.display import Image Image(filename='imgs/16_classes_base_keras.png')
_____no_output_____
Apache-2.0
study_roadmaps/2_transfer_learning_roadmap/3_effect_of_number_of_classes_in_dataset/3) Understand transfer learning and the role of number of dataset classes in it - Keras.ipynb
take2rohit/monk_v1
Baseline:
# Define simulation: env = RingRoad( num_vehicles = 22, # The vechicles at index 0 is an A.V. ring_length = 230.0, # The road is a cicle. starting_noise = 4.0, # Uniformly add noise to starting positions. temporal_res = 0.3, # Set the size of simulation steps (seconds). av_activate = 30, # Set ...
_____no_output_____
MIT
notebooks/Animations.ipynb
chickert/autonomous_vehicles
Extension 1
# Define simulation: num_vehicles = 22 num_avs = 11 env = RingRoad( num_vehicles=num_vehicles, # The vechicles at index 0 is an A.V. ring_length=230.0, # The road is a cicle. starting_noise=4.0, # Uniformly add noise to starting positions. temporal_res=0.3, # Set the size of simulation steps (second...
_____no_output_____
MIT
notebooks/Animations.ipynb
chickert/autonomous_vehicles
Extension 2
# Define simulation: a_sigma = 0.04 b_sigma = 0.5 env = RingRoad( num_vehicles=22, # The vechicles at index 0 is an A.V. ring_length=230.0, # The road is a cicle. starting_noise=0., # Uniformly add noise to starting positions. temporal_res=0.3, # Set the size of simulation steps (seconds). av_ac...
_____no_output_____
MIT
notebooks/Animations.ipynb
chickert/autonomous_vehicles
Extension 3
# Define simulation: sigma_pct = 40 env = RingRoad( num_vehicles=22, # The vechicles at index 0 is an A.V. ring_length=230.0, # The road is a cicle. starting_noise=4.0, # Uniformly add noise to starting positions. temporal_res=0.3, # Set the size of simulation steps (seconds). av_activate=30, #...
_____no_output_____
MIT
notebooks/Animations.ipynb
chickert/autonomous_vehicles
**Neural Networks Summary**
from keras.models import Sequential from keras.layers import Dense, Dropout, Conv2D, MaxPool2D, Flatten from keras.utils import to_categorical
_____no_output_____
MIT
Intro/nn_summary.ipynb
temuller/kaggle_competitions
Regression
model = Sequential() n_cols = data.shape[1] model.add(Dense(5, activation='relu', input_shape=(n_cols, ))) # input shape has to be the same as number of columns model.add(Dense(5, activation='relu')) model.add(Dense(1)) # output layer model.compile(optimizer='adam', loss='mean_square_error') # adam is more effcici...
_____no_output_____
MIT
Intro/nn_summary.ipynb
temuller/kaggle_competitions
Classification
model = Sequential() n_cols = data.shape[1] target = to_categorical(target) model.add(Dense(5, activation='relu', input_shape=(n_cols, ))) model.add(Dropout(0.2)) # dropout is a regularization technique to prevent overfitting. Normally ~0.2-0.4 model.add(Dense(5, activation='relu')) model.add(Dropout(0.2)) model.ad...
_____no_output_____
MIT
Intro/nn_summary.ipynb
temuller/kaggle_competitions
Convolutional Neural Networks (CNN) - supervisedThis are mainly use for images as they reduce dimensionality. Check this [link](https://courses.edx.org/courses/course-v1:IBM+DL0101EN+3T2019/courseware/89227024130b43f684d95376901b65c8/052a444d45914712a597f0c58cbc4391/?child=first)
model = Sequential() input_shape = (N, N, 3) # 3 for RGB images and 1 for gray scale images model.add(Conv2D(16, kernel_size=(2, 2), # size of the filter to use strides=(1, 1), # steps the filter is moved activation='relu', input_shape=input_shape)) model.add(Ma...
_____no_output_____
MIT
Intro/nn_summary.ipynb
temuller/kaggle_competitions
String Data type
'Hello' "Hello" 'Hello' + ' world' print('Hello World!') a="kumaran" a[3] a[1:] a[0:] a[:] a[:-1] a[:-10] a[::-1] a[::-10] a[::2] a[::3] a="kumaran" a[::3] a[2::1] a.count a.endswith a.endswith('n') a.endswith('m') a.count('a') a = "kumran systems" a.title() a.find('q') a.find('a') a="kumaran" a.find('a') a.isnumeric()...
kiumran
MIT
Python Basic.ipynb
ramsvijay/basic_datatype_python
List Object
a.isascii() my_list = [1,2,"ram"] my_list[2] print(my_list) my_list.index(1) my_list.index('ram') my_list.pop() print(my_list) my_list.clear() print(my_list) my_list.insert(10,'ram') print(my_list) my_list *4 a = [[1,2,3],[4,5,6],[7,8,9]] [row[1] for row in a] my_dict = {'key':'ram','value':['a',1]} print(my_dict['valu...
_____no_output_____
MIT
Python Basic.ipynb
ramsvijay/basic_datatype_python
Tuple
t=(1,2,3,4,{'key':'value'}) t.index({'key':'value'})
_____no_output_____
MIT
Python Basic.ipynb
ramsvijay/basic_datatype_python
Set
n={1.2,12,} m={'rams'}
_____no_output_____
MIT
Python Basic.ipynb
ramsvijay/basic_datatype_python
m = n.copy
a=m a.isdisjoint(12) print(a)
{1.2, 12, 1}
MIT
Python Basic.ipynb
ramsvijay/basic_datatype_python
Boolean
True not False
_____no_output_____
MIT
Python Basic.ipynb
ramsvijay/basic_datatype_python
測試資料
# 表格資料title data = [ {"route_id": "0001", "route_desc": "路線1", "num_of_people": 100, "origin_amt": 1000, "act_amt": 600, "subsidy_amt": 400, "avg_subsidy_amt_by_people": 4}, {"route_id": "0002", "route_desc": "路線2", "num_of_people": 100, "origin_amt": 1000, "act_amt": 600, "subsidy_amt": 400, "avg_s...
_____no_output_____
MIT
11_openpyxl/report_01.ipynb
bryson0083/python_note
EXCEL輸出格式產生
wb = Workbook() ws = wb.active # 設定print area # https://openpyxl.readthedocs.io/en/stable/print_settings.html ws.print_options.horizontalCentered = True # ws.print_options.verticalCentered = True ws.print_area = 'A1:G10' # 設定輸出表格字體參數 table_title_ft = Font(name='標楷體', color='000000', size=14, bold=True) table_ft = Font(...
_____no_output_____
MIT
11_openpyxl/report_01.ipynb
bryson0083/python_note
Semantic Function Species (part 2)
from scripts.imports import * out = Exporter( paths['outdir'], 'semantics' ) from IPython.display import HTML, display df.columns
_____no_output_____
CC-BY-4.0
workflow/notebooks/analysis/sem_fspecies2.ipynb
CambridgeSemiticsLab/BH_time_collocations
Miscellaneous Functions
df[df.funct_type == 'secondary'].function.value_counts() funct2names = { 'purposive_ext':['purpext', 'Purposive Extent'], 'dist_posterior': ['distpost', 'Distance Posterior'], 'anterior_limitive': ['antlimit', 'Anterior Limitive'], 'dist_prospective': ['distprosp', 'Distance Prospective'], 'purposiv...
purposive_ext showing 10 of 10
CC-BY-4.0
workflow/notebooks/analysis/sem_fspecies2.ipynb
CambridgeSemiticsLab/BH_time_collocations
Pull Out Examples Purposive Extent
purpext_df = df[df.function == 'purposive_ext'] out.number( purpext_df.shape[0], 'purpext_N' ) antlim_df = df[df.function == 'anterior_limitive'] out.number( antlim_df.shape[0], 'antlim_N' )
_____no_output_____
CC-BY-4.0
workflow/notebooks/analysis/sem_fspecies2.ipynb
CambridgeSemiticsLab/BH_time_collocations
Difficult Cases Compound Time Adverbials
compound_ct = df[df.funct_type == 'compound'].function.value_counts() out.table( compound_ct, 'compound_funct_ct', caption='Sampled Compound Time Adverbial Frequencies', ) comp_clusters = { 'begin-to-end': [ 'begin_to_end', 'habitual + begin_to_end', 'begin_to_end_habitual', ...
_____no_output_____
CC-BY-4.0
workflow/notebooks/analysis/sem_fspecies2.ipynb
CambridgeSemiticsLab/BH_time_collocations
Auto Export Examples for Compounds
for cluster, labels in comp_clusters.items(): display(HTML(f'<h2>{cluster.title()}</h2>')) for label in labels: print(label) ex_df = df[df.function == label] display( ts.show( ex_df ) ) display(HTML('<hr>'))
_____no_output_____
CC-BY-4.0
workflow/notebooks/analysis/sem_fspecies2.ipynb
CambridgeSemiticsLab/BH_time_collocations
Manually Extract Specific Cases Begin-to-end
b2edf = df[df.function.isin(comp_clusters['begin-to-end'])] out.number( b2edf.shape[0], 'begintoend_N' )
_____no_output_____
CC-BY-4.0
workflow/notebooks/analysis/sem_fspecies2.ipynb
CambridgeSemiticsLab/BH_time_collocations
Calendricals
caldf = df[df.function == 'simultaneous_calendar'] out.number( caldf.shape[0], 'N_simul_calendar' ) caldf.times_utf8.value_counts()
_____no_output_____
CC-BY-4.0
workflow/notebooks/analysis/sem_fspecies2.ipynb
CambridgeSemiticsLab/BH_time_collocations
COMP4096 Business Intelligence Group Project COVID-19 Data Analysis and Prediction This part is written by Wong Tin Yau David (18207871). Datasets below are downloaded from https://raw.githubusercontent.com/owid/covid-19-data/master/public/data/owid-covid-data.csv, which is provided by https://ourworldindata.org/. (An...
import pandas as pd import numpy as np pd.options.mode.chained_assignment = None # default='warn' df = pd.read_csv('owid-covid-data_2021.csv') df.head() df.shape
_____no_output_____
MIT
COMP4096 GP Project.ipynb
dtywong/covid19-data-analysis
2. Select the data only from G20 Countries only
g20df = df[(df["location"]=='Australia')|(df["location"]=='Canada')|(df["location"]=='Saudi Arabia')|(df["location"]=='United States')|(df["location"]=='India')|(df["location"]=='Russia')|(df["location"]=='South Africa')|(df["location"]=='Turkey')|(df["location"]=='Argentina')|(df["location"]=='Brazil')|(df["location"]...
_____no_output_____
MIT
COMP4096 GP Project.ipynb
dtywong/covid19-data-analysis
3. Seach columns with mostly-missing values and drop columns with over 99% values
(g20df.isnull().sum()/g20df.shape[0]).sort_values(ascending=False) droppable_features.append('weekly_icu_admissions_per_million') droppable_features.append('weekly_icu_admissions') droppable_features.append('weekly_hosp_admissions') droppable_features.append('weekly_hosp_admissions_per_million')
_____no_output_____
MIT
COMP4096 GP Project.ipynb
dtywong/covid19-data-analysis
4. Find Too Skewed Columns and Remove
pd.options.display.float_format = '{:,.4f}'.format sk_df = pd.DataFrame([{'column': c, 'uniq': g20df[c].nunique(), 'skewness': g20df[c].value_counts(normalize=True).values[0] * 100} for c in g20df.columns]) sk_df = sk_df.sort_values('skewness', ascending=False) sk_df
_____no_output_____
MIT
COMP4096 GP Project.ipynb
dtywong/covid19-data-analysis
5. Find columns that have more than 10% of missing values and filled with means
null_counts = g20df.isnull().sum() null_counts = null_counts / g20df.shape[0] null_counts[null_counts > 0.1] g20df.drop(droppable_features, axis=1, inplace=True) g20df.shape g20df['icu_patients'].fillna((g20df['icu_patients'].mean()), inplace=True) g20df['icu_patients_per_million'].fillna((g20df['icu_patients_per_mill...
_____no_output_____
MIT
COMP4096 GP Project.ipynb
dtywong/covid19-data-analysis
6. Find correlations between each attributes
cols = g20df.columns.tolist() import seaborn as sns import matplotlib.pyplot as plt plt.figure(figsize=(10,10)) co_cols = cols[:10] co_cols.append('new_vaccinations') sns.heatmap(g20df[co_cols].corr(), cmap='RdBu_r', annot=True, center=0.0) plt.title('Correlation between 1 ~ 10th columns') plt.show() corr_remove = [] ...
_____no_output_____
MIT
COMP4096 GP Project.ipynb
dtywong/covid19-data-analysis
Analysis of evoked response using ICA and PCA reduction techniquesThis example computes PCA and ICA of evoked or epochs data. Then thePCA / ICA components, a.k.a. spatial filters, are used to transformthe channel data to new sources / virtual channels. The output isvisualized on the average of all the epochs.
# Authors: Jean-Remi King <jeanremi.king@gmail.com> # Asish Panda <asishrocks95@gmail.com> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import sample from mne.decoding import UnsupervisedSpatialFilter from sklearn.decomposition import PCA, FastI...
_____no_output_____
BSD-3-Clause
0.16/_downloads/plot_decoding_unsupervised_spatial_filter.ipynb
drammock/mne-tools.github.io
Transform data with PCA computed on the average ie evoked response
pca = UnsupervisedSpatialFilter(PCA(30), average=False) pca_data = pca.fit_transform(X) ev = mne.EvokedArray(np.mean(pca_data, axis=0), mne.create_info(30, epochs.info['sfreq'], ch_types='eeg'), tmin=tmin) ev.plot(show=False, window_title="PCA", time_unit='s')
_____no_output_____
BSD-3-Clause
0.16/_downloads/plot_decoding_unsupervised_spatial_filter.ipynb
drammock/mne-tools.github.io
Transform data with ICA computed on the raw epochs (no averaging)
ica = UnsupervisedSpatialFilter(FastICA(30), average=False) ica_data = ica.fit_transform(X) ev1 = mne.EvokedArray(np.mean(ica_data, axis=0), mne.create_info(30, epochs.info['sfreq'], ch_types='eeg'), tmin=tmin) ev1.plot(show=False, window_title='ICA', time_uni...
_____no_output_____
BSD-3-Clause
0.16/_downloads/plot_decoding_unsupervised_spatial_filter.ipynb
drammock/mne-tools.github.io
Pandas Group By **In this tutorial we are going to look at weather data from various cities and see how group by can be used to run some analytics.**
import pandas as pd df = pd.read_csv("weather_by_cities.csv") df
_____no_output_____
CNRI-Python
8_Grouping and Aggregating/1_Groupby/1_Code_Basics/pandas_group_by.ipynb
sureshmecad/Pandas
For this dataset, get following answers, 1. What was the maximum temperature in each of these 3 cities? 2. What was the average windspeed in each of these 3 cities?
g = df.groupby("city") g
_____no_output_____
CNRI-Python
8_Grouping and Aggregating/1_Groupby/1_Code_Basics/pandas_group_by.ipynb
sureshmecad/Pandas
**DataFrameGroupBy object looks something like below,** ![1_Code_Basics](image/group_by_cities.png)
for city, data in g: print("city:",city) print("\n") print("data:",data)
city: mumbai data: day city temperature windspeed event 4 1/1/2017 mumbai 90 5 Sunny 5 1/2/2017 mumbai 85 12 Fog 6 1/3/2017 mumbai 87 15 Fog 7 1/4/2017 mumbai 92 5 Rain city: new york data: day city...
CNRI-Python
8_Grouping and Aggregating/1_Groupby/1_Code_Basics/pandas_group_by.ipynb
sureshmecad/Pandas
**This is similar to SQL,****SELECT * from weather_data GROUP BY city**
g.get_group('mumbai') g.max() g.mean()
_____no_output_____
CNRI-Python
8_Grouping and Aggregating/1_Groupby/1_Code_Basics/pandas_group_by.ipynb
sureshmecad/Pandas
**This method of splitting your dataset in smaller groups and then applying an operation (such as min or max) to get aggregate result is called Split-Apply-Combine. It is illustrated in a diagram below** ![1_Code_Basics](image/split_apply_combine.png)
g.min() g.describe() g.size() g.count() %matplotlib inline g.plot()
_____no_output_____
CNRI-Python
8_Grouping and Aggregating/1_Groupby/1_Code_Basics/pandas_group_by.ipynb
sureshmecad/Pandas
Group data using custom function: Let's say you want to group your data using custom function. Here the requirement is to create three groups Days when temperature was between 80 and 90 Days when it was between 50 and 60 Days when it was anything else For this you need to write custom grouping function and pas...
def grouper(df, idx, col): if 80 <= df[col].loc[idx] <= 90: return '80-90' elif 50 <= df[col].loc[idx] <= 60: return '50-60' else: return 'others' g = df.groupby(lambda x: grouper(df, x, 'temperature')) g for key, d in g: print("Group by Key: {}\n".format(key)) print(d)
Group by Key: 50-60 day city temperature windspeed event 9 1/2/2017 paris 50 13 Cloudy 10 1/3/2017 paris 54 8 Cloudy Group by Key: 80-90 day city temperature windspeed event 4 1/1/2017 mumbai 90 5 Sunny 5 1/2/2017 mumbai ...
CNRI-Python
8_Grouping and Aggregating/1_Groupby/1_Code_Basics/pandas_group_by.ipynb
sureshmecad/Pandas
TSG108 - View the controller upgrade config map===============================================Description-----------When running a Big Data Cluster upgrade using `azdata bdc upgrade`:`azdata bdc upgrade --name --tag `It may fail with:> Upgrading cluster to version 15.0.4003.10029\_2>> NOTE: Cluster upgrade can take a ...
# Define `run` function for transient fault handling, suggestions on error, and scrolling updates on Windows import sys import os import re import platform import shlex import shutil import datetime from subprocess import Popen, PIPE from IPython.display import Markdown retry_hints = {} # Output in stderr known to be...
_____no_output_____
MIT
Big-Data-Clusters/CU14/public/content/diagnose/tsg108-controller-failed-to-upgrade.ipynb
glienard/tigertoolbox
Get the Kubernetes namespace for the big data clusterGet the namespace of the Big Data Cluster use the kubectl command lineinterface .**NOTE:**If there is more than one Big Data Cluster in the target Kubernetescluster, then either:- set \[0\] to the correct value for the big data cluster.- set the environment vari...
# Place Kubernetes namespace name for BDC into 'namespace' variable if "AZDATA_NAMESPACE" in os.environ: namespace = os.environ["AZDATA_NAMESPACE"] else: try: namespace = run(f'kubectl get namespace --selector=MSSQL_CLUSTER -o jsonpath={{.items[0].metadata.name}}', return_output=True) except: ...
_____no_output_____
MIT
Big-Data-Clusters/CU14/public/content/diagnose/tsg108-controller-failed-to-upgrade.ipynb
glienard/tigertoolbox
View the upgrade configmap
run(f'kubectl get configmap -n {namespace} controller-upgrade-configmap -o yaml') print("Notebook execution is complete.")
_____no_output_____
MIT
Big-Data-Clusters/CU14/public/content/diagnose/tsg108-controller-failed-to-upgrade.ipynb
glienard/tigertoolbox
1. Считаем данные
data_train = pd.read_csv("./Data/x_train.csv", delimiter=';', header=None) target_train = pd.read_csv("./Data/y_train.csv", delimiter=';', header=None) data_train.head() np.unique(target_train, return_counts=True) y = np.array(target_train)
_____no_output_____
MIT
Seminars/Seminar_3/Seminar.ipynb
JacksonGibsonESP/Sberbank-ML
2. Посмотрим на RF на сырых данных
from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import cross_val_score def get_accuracies(X, Y): rf_clf = RandomForestClassifier(n_estimators=100) print("Accuracy: {0}".format(cross_val_score(rf_clf, X, Y, scoring='accuracy', cv=5, n_jobs=-1))) get_accuracies(data_train, y)
/anaconda3/lib/python3.6/site-packages/sklearn/model_selection/_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel(). estimator.fit(X_train, y_train, **fit_params) /anaconda3/lib/python3.6/site-pack...
MIT
Seminars/Seminar_3/Seminar.ipynb
JacksonGibsonESP/Sberbank-ML
3. Feature processing
from sklearn.feature_selection import SelectKBest from sklearn.feature_selection import chi2 X = data_train.copy() def plot_importance(clf, X): importances = clf.feature_importances_ std = np.std([tree.feature_importances_ for tree in clf.estimators_], axis=0) indices = np.argsort(importances)[::-1] pl...
/anaconda3/lib/python3.6/site-packages/sklearn/model_selection/_validation.py:458: DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples,), for example using ravel(). estimator.fit(X_train, y_train, **fit_params) /anaconda3/lib/python3.6/site-pack...
MIT
Seminars/Seminar_3/Seminar.ipynb
JacksonGibsonESP/Sberbank-ML
15天入门Python3CopyRight by 黑板客 转载请联系heibanke_at_aliyun.com **上节作业**八皇后
%load day08/eight_queen.py a = gen_n_queen(5) printsolution(next(a))
_____no_output_____
MIT
Code/day09.ipynb
heibanke/learn_python_in_15days
day09:谈对象—高富帅和白富美1. 面向对象编程2. **封装**, 属性和方法3. **继承**4. **多态** 与 重载5. 作业 面向对象编程面向对象和面向过程的区别:1. 面向过程编程 (OPP) 定义各种数据,定义各种函数,然后操作数据和函数输出结果,解决一类问题。面向过程适合解决特定的简单问题。2. 面向对象编程 (OOP) 最重要的是把用到的数据和方法抽象成为类。使用不同的类进行建模。达到代码模块化。适合解决多变,复杂,不断更新的问题。三大特性:封装,继承,多态。
class A(object): nums_A = 0 def __init__(self, data): # 初始化 self.data = data A.nums_A += 1 def methods(self): self.data -= 1 a = A(3) print(a.data, A.nums_A) b = A(5) print(b.data, A.nums_A) a.methods() c = A(6) print(a.data, A.nums_A) %%html <style> .rende...
_____no_output_____
MIT
Code/day09.ipynb
heibanke/learn_python_in_15days
| A | | :- ||- data| |+ methods()| 举个王者荣耀简化版的例子说明一下:你要开发一个游戏,游戏中每个玩家都是一个英雄。英雄有两种,比如亚瑟是近战英雄,后羿是远程英雄。每种英雄都有不同的属性。1. name2. defence3. attack4. life请模拟游戏里两个英雄互相PK的过程。看谁先game over。
# %load day09/pk_opp_01.py # 面向过程 def cal_damage(A, B): """ 计算A对B造成的伤害 """ return A['attack'] * (1-B['defence']/(B['defence']+400)) tank = {'name':'亚瑟1', 'defence':200, 'attack':80, 'life':600} archer = {'name':'后羿1', 'defence':100, 'attack':200, 'life':300} def game_test(A, B): while A['life']>...
_____no_output_____
MIT
Code/day09.ipynb
heibanke/learn_python_in_15days
封装,属性和方法 |Hero| | :- ||- name - defence - attack - life||+ \__init\__ (name, defence, attack, life) + damage (enemy) + alive ()| |Game| | :- ||- A - B||+ \__init\__ (A, B) + start () + end ()|
# %load day09/pk_oop_01.py class Hero(object): def __init__(self, name, defence, attack, life): self.name = name self.defence = defence self.attack = attack self.life = life def damage(self, enemy): d = self.attack * (1-enemy.defence/(enemy.defence+400)) ...
_____no_output_____
MIT
Code/day09.ipynb
heibanke/learn_python_in_15days
封装:对象的属性建议只能通过调用对象的方法来修改。只对对象的方法可见。 问题:当玩家很多时,生成亚瑟和后羿的属性只需要改变name,而其他属性是统一的。怎么更简化? 继承子类继承父类的属性和方法。
# %load day09/pk_oop_02.py from day09.pk_oop_01 import Game class Hero(object): nums = 0 def __init__(self, name, defence, attack, life): self.name = name self.defence = defence self.attack = attack self.life = life Hero.nums += 1 def damage(self, enemy): ...
_____no_output_____
MIT
Code/day09.ipynb
heibanke/learn_python_in_15days
多态和重载 多态,方法和子类动态绑定重载,多个同名的方法,参数不同。 让亚瑟的攻击带有吸血功能,每次将伤害的10%转化成自己的生命,看能否打败后羿。
class YaSe(Hero): def __init__(self, name): Hero.__init__(self, name, 200, 80, 2000) def damage(self, enemy, xixie = 0.1): d = self.attack * (1-enemy.defence/(enemy.defence+400)) enemy.life -= d self.life += d * xixie print('%s 对 %s 造成 %.2f 伤害,%s 还剩 %.2f 生命。'%(self.name,...
_____no_output_____
MIT
Code/day09.ipynb
heibanke/learn_python_in_15days
Starting with Chollet's advice -- program simple programs that can solve the first 10 tasks
import numpy as np import json from PIL import Image, ImageDraw from IPython.display import Image as Im import matplotlib.pyplot as plt import collections colorMap = {0:"black",1:"blue",2:"red", 3:"green",4:"yellow",5:"grey",6:"magenta",7:"orange",8:"cyan",9:"brown"} # accuracy of predicted output to actual output (si...
_____no_output_____
Apache-2.0
notebooks/.ipynb_checkpoints/programs-checkpoint.ipynb
aysjajohnson/ARC
Functions for displaying grids
# displaying a single grid def DisplayGrid(grid): grid = np.asarray(grid) nrows = len(grid[:,0]) ncols = len(grid[0,:]) height, width = nrows*50, ncols*50 image = Image.new(size=(width,height),mode='RGB',color=(255,255,255)) draw = ImageDraw.Draw(image) r = 0 for row in grid: c ...
_____no_output_____
Apache-2.0
notebooks/.ipynb_checkpoints/programs-checkpoint.ipynb
aysjajohnson/ARC
Solving grid 1
filename = "/Users/aysjajohnson/Desktop/ARC-master/data/training/007bbfb7.json" with open(filename, 'r') as f: grid = json.load(f) inGrid = grid["train"][0]["input"] outGrid = grid["train"][0]["output"] def returnArrays(inputGrid, outputGrid): return(np.asarray(inputGrid),np.asarray(outputGrid)) def inDim2o...
_____no_output_____
Apache-2.0
notebooks/.ipynb_checkpoints/programs-checkpoint.ipynb
aysjajohnson/ARC
Solving Grid 2
filename = "/Users/aysjajohnson/Desktop/ARC-master/data/training/00d62c1b.json" with open(filename, 'r') as f: grid = json.load(f) inGrid = grid["train"][3]["input"] outGrid = grid["train"][0]["output"] DisplayGrids(inGrid,outGrid) def bfs(grid, start, width, height, wall=3): goal = 10 queue = collectio...
_____no_output_____
Apache-2.0
notebooks/.ipynb_checkpoints/programs-checkpoint.ipynb
aysjajohnson/ARC
Solving Grid 3
filename = "/Users/aysjajohnson/Desktop/ARC-master/data/training/017c7c7b.json" with open(filename, 'r') as f: grid = json.load(f) inGrid = grid["train"][0]["input"] outGrid = grid["train"][0]["output"] DisplayGrids(inGrid,outGrid) # making copy and paste more general def patternCompletion(inputGrid, outputGrid...
_____no_output_____
Apache-2.0
notebooks/.ipynb_checkpoints/programs-checkpoint.ipynb
aysjajohnson/ARC
Solving Grid 4
filename = "/Users/aysjajohnson/Desktop/ARC-master/data/training/025d127b.json" with open(filename, 'r') as f: grid = json.load(f) inGrid = grid["train"][0]["input"] outGrid = grid["train"][0]["output"] DisplayGrids(inGrid,outGrid) def moveRight(grid): grid = np.asarray(grid) height = grid.shape[0] ...
_____no_output_____
Apache-2.0
notebooks/.ipynb_checkpoints/programs-checkpoint.ipynb
aysjajohnson/ARC
Introdução ao Pandas - Viagens do Governo | Tratamento de dados *Esse notebook usa o arquivo sobre [viagens de funcionários do governo](http://www.portaltransparencia.gov.br/viagens) disponibilizado no portal da transparência.*
import pandas as pd df_viagem = pd.read_csv('viagens_2019.csv', encoding='latin-1', sep=';')
_____no_output_____
MIT
Tratamento de dados.ipynb
anicelysantos/jornalismo-de-dados-udemy
**Saber informações sobre uma coluna específica**
df_viagem['Valor passagens']
_____no_output_____
MIT
Tratamento de dados.ipynb
anicelysantos/jornalismo-de-dados-udemy
**Mudar as virgulas dos valores por pontos**
# o str é pra sinalizar que a troca do replace é uma string df_viagem['Valor passagens'] = df_viagem['Valor passagens'].str.replace(',','.')
_____no_output_____
MIT
Tratamento de dados.ipynb
anicelysantos/jornalismo-de-dados-udemy
**Mudar o tipo de dado da coluna**
df_viagem['Valor passagens'] = df_viagem['Valor passagens'].astype(float)
_____no_output_____
MIT
Tratamento de dados.ipynb
anicelysantos/jornalismo-de-dados-udemy
**Contar quantas vezes aparece uma determinada coisa**
df_viagem['Destinos'].value_counts()
_____no_output_____
MIT
Tratamento de dados.ipynb
anicelysantos/jornalismo-de-dados-udemy
**Separar as cidades dos Estados ou Países**O `split()` guarda o resultado em uma **lista**
# O parametro 'expand = True' indica que os elementos devem ser separados em diferentes colunas col = df_viagem['Destinos'].str.split('/',1,expand = True)
_____no_output_____
MIT
Tratamento de dados.ipynb
anicelysantos/jornalismo-de-dados-udemy