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
#Une librairie pour la data manipulation (Jointures,Subsetting) | |
library(data.table) | |
#Créer une liste de tous les fichiers .txt avec les noms | |
filelist = list.files(pattern = ".*.txt") | |
#Dans la liste des fichiers, on va charger comme data frame tous les fichiers .txt | |
data_list = lapply(filelist, read.table, sep = ",") | |
#Creation du dataframe, en assumant que les headers sont les mêmes |
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(readxl) | |
library(digest) | |
library(data.table) | |
library(rJava) | |
#Data path | |
dataPath <-"/Users/romain/Desktop/your_file.xlsx" | |
#Load data with read |
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(sqldf) | |
# Chargement de nos deux datasets | |
df_1 <- read.csv2('/Users/romain/Downloads/df_1.csv',sep=',') | |
df_2 <- read.csv2('/Users/romain/Desktop/df_2.csv',sep=',') | |
# On isole la colonne qu'on souhaite comparer | |
df_1 <- as.data.frame(df_1$col_name) | |
df_2 <- as.data.frame(df_2$col_name) |
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
clean_text <- function(text){ | |
#Retrait du saut de ligne \n | |
text <- gsub("\n"," ",text) | |
#Retrait des URLs | |
text <- gsub('http\\S+\\s*',"",text) | |
#Retrait des espaces en trop | |
text <- gsub("\\s+"," ",text) |
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 os | |
import pandas as pd | |
import pandas_gbq as pd_gbq | |
import modin.pandas as pd_mod | |
from sqlalchemy import create_engine | |
from google.oauth2 import service_account | |
# Service account file for GCP connection | |
credentials = service_account.Credentials.from_service_account_file('key.json') |
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
WITH | |
revenue_over_month AS ( | |
SELECT | |
DATE_TRUNC(PARSE_DATE('%Y%m%d', | |
date),MONTH) AS months, | |
ROUND(SUM(totals.totalTransactionRevenue)/10e+6,2) AS revenue, | |
FROM | |
`bigquery-public-data.google_analytics_sample.ga_sessions_20*` | |
GROUP BY | |
1) |
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
SELECT | |
DATE_TRUNC(PARSE_DATE('%Y%m%d', | |
date),MONTH) AS months, | |
ROUND(SUM(totals.totalTransactionRevenue)/10e+6,2) AS revenue, | |
FROM | |
`bigquery-public-data.google_analytics_sample.ga_sessions_20*` | |
GROUP BY | |
1 | |
ORDER BY | |
1 |
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
WITH | |
revenue_over_month AS ( | |
SELECT | |
DATE_TRUNC(PARSE_DATE('%Y%m%d', | |
date),MONTH) AS months, | |
ROUND(SUM(totals.totalTransactionRevenue)/10e+6,2) AS revenue, | |
FROM | |
`bigquery-public-data.google_analytics_sample.ga_sessions_20*` | |
GROUP BY | |
1) |
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
WITH | |
revenue_over_month AS ( | |
SELECT | |
DATE_TRUNC(PARSE_DATE('%Y%m%d', | |
date),MONTH) AS months, | |
ROUND(SUM(totals.totalTransactionRevenue)/10e+6,2) AS revenue, | |
FROM | |
`bigquery-public-data.google_analytics_sample.ga_sessions_20*` | |
GROUP BY | |
1) |
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
SELECT | |
fullVisitorId, | |
totals.transactions | |
FROM | |
`bigquery-public-data.google_analytics_sample.ga_sessions_20170801` | |
WHERE totals.transactions IS NOT NULL |
OlderNewer