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('https://s3.amazonaws.com/sergio-prates-blog/imdb-reviews-pt-br.csv').sample(1000, random_state=42) | |
df.sentiment.value_counts() | |
df.head() |
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
primeiro.termo <- 1 | |
razao <- 2 | |
#Isso aqui é uma função | |
obter.termo.pa <- function(primeiro.termo, numero.termo, razao) { | |
return(primeiro.termo + (numero.termo - 1) * razao) | |
} | |
#chamando a função | |
obter.termo.pa(primeiro.termo, 50, razao) |
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
itens <- c(10,20,30) | |
for (variable in itens) { | |
print(variable) | |
} |
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
culpado <- TRUE | |
if (culpado) { | |
print("Eu Sei") | |
} else { | |
print("Vish") | |
} | |
culpado <- F | |
ifelse(culpado, "verdade", "falso") |
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
#Gerando números de 1 a 10 | |
1:10 | |
#Gerando números de 10 a 1 | |
10:1 | |
#Gerando números de 100 a 120 | |
seq(100, 120) | |
#Gerando 10 números a partir de 100 |
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
segundos = dseconds(260) | |
minutos = dminutes(260) | |
anos = dyears(260) | |
duration(10, units = "seconds") | |
segundos | |
minutos | |
anos |
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
install.packages("lubridate") | |
library(lubridate) |
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
Sys.Date() | |
# "2019-01-30" |
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
unclass(data.time1) #Time1 | |
unclass(data.time2) #Time2 | |
#SAÍDA | |
[1] 1566598200 | |
attr(,"tzone") | |
[1] "America/Sao_Paulo" | |
$`sec` |
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
data.texto = "23/08/2019 T 19:10:00" | |
data.date = as.Date(data.texto,format="%d/%m/%Y T %H:%M:%S",tz="America/Sao_Paulo") | |
data.time1 = as.POSIXct(data.texto,format="%d/%m/%Y T %H:%M:%S",tz="America/Sao_Paulo") | |
data.time2 = as.POSIXlt(data.texto,format="%d/%m/%Y T %H:%M:%S",tz="America/Sao_Paulo") | |
data.time1 | |
data.time2 | |
data.date | |
# "2019-08-23 19:10:00 -03" | |
# "2019-08-23 19:10:00 -03" |