Skip to content

Instantly share code, notes, and snippets.

View JonathanLoscalzo's full-sized avatar

Jonathan Loscalzo JonathanLoscalzo

View GitHub Profile
fecha dificultad comentarios
31/03/2015 12:46:22 Muy fácil No tuve dificultades
31/03/2015 13:33:07 Muy fácil La carga de datos, Concreción de la inscripción prueba
31/03/2015 13:54:04 Muy fácil El registro y la creación de usaurio, El uso de la contraseña prueba
09/04/2015 11:37:59 Fácil La inscripción a Becas Esta genialllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllll
15/04/2015 18:44:06 Fácil La búsqueda de la Escuela/Colegio Secundario Las posibilidades de modalidad para el secundario son las actuales y no está la opción del momento que lo hice yo. Puse otros en lugar de Bachiller
21/04/2015 11:08:05 Fácil La carga de datos
24/04/2015 13:20:13 Muy fácil No tuve dificultades
24/04/2015 13:25:45 Fácil No tuve dificultades
12/05/2015 9:35:56 Fácil No tuve dificultades
from sklearn.datasets import *
from sklearn import tree
import graphviz
wine = load_wine()
clf = tree.DecisionTreeClassifier() # init the tree
clf = clf.fit(wine.data, wine.target) # train the tree
# export the learned decision tree
dot_data = tree.export_graphviz(clf, out_file=None,
feature_names=wine.feature_names,
from sklearn.datasets import *
from sklearn import tree
from sklearn.metrics import roc_curve, auc
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import label_binarize
n_classes = 3
wine = load_wine()
clf = tree.DecisionTreeClassifier()
@JonathanLoscalzo
JonathanLoscalzo / 00 - pandas between, groupby, isin, nunique example cold_war.md
Last active April 24, 2019 13:54
pandas between, groupby, isin, nunique example cold_war

Counting USA vs. USSR Cold War Olympic Sports The Olympic competitions between 1952 and 1988 took place during the height of the Cold War between the United States of America (USA) & the Union of Soviet Socialist Republics (USSR). Your goal in this exercise is to aggregate the number of distinct sports in which the USA and the USSR won medals during the Cold War years.

The construction is mostly the same as in the preceding exercise. There is an additional filtering stage beforehand in which you reduce the original DataFrame medals by extracting data from the Cold War period that applies only to the US or to the USSR. The relevant country codes in the DataFrame, which has been pre-loaded as medals, are 'USA' & 'URS'.

@JonathanLoscalzo
JonathanLoscalzo / 01-pandas: pivot_table, idxmax with axis = 1 (interesting).md
Last active April 24, 2019 13:55
pandas: pivot_table, idxmax with axis = 1 (interesting)

Counting USA vs. USSR Cold War Olympic Medals For this exercise, you want to see which country, the USA or the USSR, won the most medals consistently over the Cold War period.

There are several steps involved in carrying out this computation.

You'll need a pivot table with years ('Edition') on the index and countries ('NOC') on the columns. The entries will be the total number of medals each country won that year. If the country won no medals in a given edition, expect a NaN in that entry of the pivot table. You'll need to slice the Cold War period and subset the 'USA' and 'URS' columns. You'll need to make a Series from this slice of the pivot table that tells which country won the most medals in that edition using .idxmax(axis='columns'). If .max() returns the maximum value of Series or 1D array, .idxmax() returns the index of the maximizing element. The argument axis=columns or axis=1 is required because, by default, this aggregation would be done along columns for a DataFrame. The final Series contains

Cleaning Data with python

Merging DataFrames with pandas.md

@JonathanLoscalzo
JonathanLoscalzo / 00-readme.md
Last active April 25, 2019 14:47
Olimpic Medals DataSets

Olimpic Medals DataSets

@JonathanLoscalzo
JonathanLoscalzo / sqlalchemy_advanced_queries.py
Created April 26, 2019 17:16
selecting, filtering, grouping data with sqlalchemy
# Import create_engine function
from sqlalchemy import create_engine
driver = 'mysql+pymysql://'
cred = 'student:datacamp'
url = '@courses.csrrinzqubik.us-east-1.rds.amazonaws.com:3306/'
port = 'census'
# Create an engine to the census database
engine = create_engine(driver + cred + url + port)
@JonathanLoscalzo
JonathanLoscalzo / run_spark_nlp.ipynb
Created September 6, 2019 17:55
run spark NLP in colab
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.