This file contains hidden or 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
#Loop over df and accumulate results | |
parsed_df <- data.frame() | |
for(i in 1:nrow(df)){ | |
temp <- cbind(df[i,],breakdown_list[[i]]) | |
parsed_df <- rbind(parsed_df, temp) | |
} | |
There were 12 warnings (use warnings() to see them) | |
>warnings() | |
Warning messages: |
This file contains hidden or 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
#Loop over df and accumulate results | |
#Adding row.names = NULL fixes error message | |
parsed_df <- data.frame() | |
for(i in 1:nrow(df)){ | |
temp <- cbind(df[i,],breakdown_list[[i]], row.names = NULL) | |
parsed_df <- rbind(parsed_df, temp) | |
} | |
names(parsed_df) |
This file contains hidden or 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
#Separate breakdown list and original data frame into different objects | |
df <- ex_df$report$data | |
breakdown_list <- df$breakdown | |
df$breakdown <- NULL | |
#Loop over df and accumulate results | |
parsed_df <- data.frame() | |
for(i in 1:nrow(df)){ | |
right_df <- breakdown_list[[i]] | |
right_df <- rename(right_df, replace=c("name" = report_raw$report$elements$id[2])) |
This file contains hidden or 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
_ | |
_ _ _(_)_ | A fresh approach to technical computing | |
(_) | (_) (_) | Documentation: http://docs.julialang.org | |
_ _ _| |_ __ _ | Type "help()" to list help topics | |
| | | | | | |/ _` | | | |
| | |_| | | | (_| | | Version 0.3.0-prerelease+4028 (2014-07-02 23:42 UTC) | |
_/ |\__'_|_|_|\__'_| | Commit 2185bd1 (11 days old master) | |
|__/ | x86_64-w64-mingw32 | |
julia> using ODBC |
This file contains hidden or 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
#Starting portion of query, the groupby columns | |
julia> groupbycols ="select | |
interact.interactionid, | |
interact.agentname, | |
interact.agentid, | |
interact.agentgroup, | |
interact.agentsupervisor, | |
interact.sitename, | |
interact.dnis, | |
interact.agentextension, |
This file contains hidden or 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(ggplot2) | |
#Load Data | |
#Make sure months stay ordered - first time I ever wanted a factor! | |
#Label x-axis with every fifth label | |
visits_visitors <- read.csv("visits_visitors.csv") | |
visits_visitors$Month <- factor(visits_visitors$Month, levels = visits_visitors$Month, ordered = TRUE) | |
visits_visitors$Month_ <- ifelse(as.numeric(row.names(visits_visitors)) %% 5 == 0, as.character(visits_visitors$Month), "") | |
#Build plot as a series of elements |
This file contains hidden or 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 | |
import matplotlib.pyplot as plt | |
%matplotlib inline | |
#Read data into Python | |
dataset= pd.read_csv("visits_visitors.csv") | |
#Create every fifth month label | |
dataset["Month_"]= [value if (position+1) % 5 == 0 else "" for position, value in enumerate(dataset.Month)] |
This file contains hidden or 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 seaborn as sns | |
import matplotlib.pyplot as plt | |
#Set theme and size, remove axis titles | |
sns.set_style("whitegrid") | |
sns.set_context({"figure.figsize": (17, 6)}) #Passing in matplotlib commands directly | |
#Plot data | |
#Use dataset.index as my x_order, to ensure proper ordering by using numeric series | |
sns_views = sns.barplot(dataset.Month, "Views", data = dataset, color = "#278DBC", dropna = False, ci=None, x_order=dataset.Month) |
This file contains hidden or 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
using Gadfly, DataFrames | |
set_default_plot_size(24cm, 8.5cm) | |
#Read in data using DataFrames package | |
df = readtable("visits_visitors.csv") | |
#Fill :Visitors with 0 to replace NA | |
df[:Visitors] = array(df[:Visitors], 0) | |
plot(df, |
This file contains hidden or 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
using Plotly, DataFrames | |
Plotly.signin("username", "api-key") | |
#Read in data | |
df = readtable("visits_visitors.csv") | |
#Create page views plot | |
views = [ | |
["x" => df[:Month], "y" => df[:Views], "type" => "bar", "name" => "Views", "marker" => ["color" => "rgb(39, 141, 188)"]] | |
] |