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
# Convirtiendo la variable dia a factor para asi manipular el orden en que se debe visualizada la variable dia | |
d_historico$dia <- factor( x = d_historico$dia | |
, levels = c('Lunes','Martes','Miercoles','Jueves','Viernes', 'Sabado','Domingo') | |
) | |
# Opcional: Revisando la estructura del factor | |
str( object = d_historico$dia ) |
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
library( package = 'dplyr' ) | |
library( package = 'data.table' ) | |
# Create vectors that will store column classes for the game and event files | |
l_e_cols <- c( 'character' # GAME_ID | |
, rep( x = 'NULL', times = 13 ) | |
, 'character' # PIT_ID | |
, rep( x = 'NULL', times = 25 ) | |
, 'numeric' # EVENT_OUTS_CT | |
, rep( x = 'NULL', times = 58 ) |
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
library( package = 'dplyr' ) | |
library( package = 'data.table' ) | |
library( package = 'reshape2' ) | |
# Column names | |
l_e_names <- c( 'GAME_ID','CATCHER','FIRST_BASEMAN','SECOND_BASEMAN' | |
, 'THIRD_BASEMAN','SHORTSTOP','LEFT_FIELDER','CENTER_FIELDER' | |
, 'RIGHT_FIELDER', 'EVENT_OUTS_CT' ,'TEAM_ID' | |
) | |
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
library( package = 'dplyr' ) | |
library( package = 'ggplot2' ) | |
library( package = 'data.table' ) | |
# Column types | |
l_g_cols <- c( 'NULL' | |
, 'character' # GAME_DT | |
, rep( x = 'NULL', times = 5 ) | |
, 'character' # AWAY_TEAM_ID | |
, 'character' # HOME_TEAM_ID |
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 reverse2( self, current, previous ): | |
if current: | |
self.reverse2( previous = current | |
, current = current.getNext() | |
) | |
else: | |
return | |
print str(current.getData())+str('-->'), |
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 Nodo: | |
def __init__( self, dato ): | |
self.dato = dato | |
self.sig = None | |
#def asignarDato( self, dato ): | |
# self.dato = dato | |
def asignarSig( self, sig ): |
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 Nodo: | |
def __init__( self, dato ): | |
self.dato = dato | |
self.sig = None | |
#def asignarDato( self, dato ): | |
# self.dato = dato | |
def asignarSig( self, sig ): |
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 __init__( self ): | |
self.cabeza = None | |
self.cola = None | |
self.tamanio = 0 |
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 encolar( self, dato ): | |
nuevoNodo = Nodo( dato ) | |
if not self.cabeza: | |
nuevoNodo.asignarSig( None ) | |
self.cabeza = nuevoNodo | |
else: | |
self.cola.asignarSig( nuevoNodo ) | |
self.cola = nuevoNodo |
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
from lxml import etree | |
import glob | |
import csv | |
# Input Files. | |
hipFiles = glob.glob('*hip.xml') | |
gameFiles = glob.glob('*data.xml') | |
# Output File. | |
csvFile = open('hitsPerGame.csv', 'wb') |
NewerOlder