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
| You have a CSV file called `locations.csv` with columns: name, longitude, latitude, type (including 'Customer' rows), DCs, and plants. | |
| I want you to: | |
| 1. Filter the data to only include rows where `type == 'Customer'`. | |
| 2. Generate synthetic one-period demand for these customers: | |
| - Normal scenario: Draw from a normal distribution (mean=100, std=20), clip negatives at 0. |
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
| Generate a Python Script for [Project Objective] Visualization with [Visualization Tools] in a Jupyter Notebook | |
| Body: | |
| Objective: | |
| Clearly describe the purpose of the project, the type of data involved, and the key insights or lessons you aim to convey through visualization. Mention whether you have an existing dataset or need to generate synthetic data. | |
| Example: | |
| Create a Python script to visualize supply chain network scenarios using Folium maps. The visualization should compare an optimal distribution strategy (multiple Distribution Centers) versus a suboptimal one (single Distribution Center) to highlight the impact on costs and delivery times. If no data file is provided, generate synthetic data for Distribution Centers (DCs) and Customers. |
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
| Write a Python script to generate synthetic supply chain data with the following rules: | |
| Here is the detailed description based on the supply chain network: | |
| Distribution Centers (DCs) | |
| Washington, DC: | |
| Located in the northeastern United States near major population centers. | |
| Likely serves as a key hub for East Coast distribution. | |
| Dallas, TX: | |
| Positioned centrally in the southern United States. |
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 numpy as np | |
| import pandas as pd | |
| import matplotlib.pyplot as plt | |
| from ortools.constraint_solver import pywrapcp | |
| from ortools.constraint_solver import routing_enums_pb2 | |
| from scipy.spatial.distance import cdist | |
| import matplotlib.cm as cm | |
| # Set random seed for reproducibility | |
| np.random.seed(42) |
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 numpy as np | |
| import matplotlib.pyplot as plt | |
| import dowhy | |
| from dowhy import CausalModel | |
| import networkx as nx | |
| import math | |
| import sklearn | |
| from sklearn import preprocessing | |
| from sklearn.model_selection import train_test_split |
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
| # Replicate Bob's results from this LinkedIn post: | |
| # https://www.linkedin.com/posts/bob-wilson-77a22ab_people-sometimes-say-ab-testing-requires-activity-7152792859878871040-X1Sr?utm_source=share&utm_medium=member_desktop | |
| ### Implement Fisher's Exact Test | |
| # Create the contingency table | |
| contingency_table <- matrix(c(0, 4, 7, 3), nrow = 2) | |
| dimnames(contingency_table) <- list(c("Control", "Treatment"), |
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
| # Load Required Libraries | |
| if (!require("MASS")) install.packages("MASS") | |
| library(MASS) | |
| # Define TV Shows | |
| # A vector of TV show titles | |
| tv_shows <- c( | |
| "Breaking Bad", "Game of Thrones", "The Wire", | |
| "Stranger Things", "The Crown", "Mad Men", | |
| "The Sopranos", "Friends", "The Office", |
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
| # load packages | |
| library(tidyverse) | |
| library(tidytuesdayR) # Used for loading datasets from the TidyTuesday project | |
| # load datasets | |
| tuesdata <- tidytuesdayR::tt_load('2023-11-28') | |
| drwho_episodes <- tuesdata$drwho_episodes | |
| drwho_directors <- tuesdata$drwho_directors | |
| drwho_writers <- tuesdata$drwho_writers |
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
| # purpose: visualize linear trend for all data and subset of data | |
| # libraries | |
| library(dplyr) | |
| library(ggplot2) | |
| # read data | |
| d <- read.csv("mycsvfile.csv") | |
| # quickl look |
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
| # purpose: helper script to determine my max heart rate | |
| # load libraries | |
| library(dplyr) | |
| library(rethinking) | |
| #### Read and Filter Data ---- | |
| # grab data |