Created
December 22, 2024 11:40
-
-
Save FrankRuns/05c3b6734617516f1cea43ac155c5fc1 to your computer and use it in GitHub Desktop.
what_data_prompt.txt
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. | |
Requirements: | |
Data Handling: | |
Existing Data: | |
If a data file (e.g., data.csv) is provided, load it and describe its structure (columns, types). | |
Synthetic Data Generation: | |
If no data file is provided, generate synthetic data with appropriate fields. | |
For Supply Chain Example: | |
DCs: name, longitude, latitude, type. | |
Customers: name, longitude, latitude, type. | |
Ensure the synthetic data is realistic and sufficient for meaningful visualization. | |
Data Processing: | |
Separate the data into relevant categories (e.g., DCs and Customers). | |
Perform necessary computations or assignments (e.g., assigning each Customer to the nearest DC based on geographical distance). | |
Calculate relevant metrics (e.g., distance in kilometers between Customers and DCs). | |
Visualization Creation: | |
Function create_visualization: | |
Parameters: | |
visualization_title: Title of the visualization. | |
connections: List of connections containing from_coords, to_coords, color, weight, and caption. | |
display_in_notebook: Boolean indicating whether to display the visualization inline. | |
Steps: | |
Initialize the visualization tool (e.g., Folium map) centered on a relevant geographical area. | |
Add data points or markers (e.g., DCs and Customers) with appropriate styling and popups. | |
Draw connections or relationships (e.g., PolyLines for shipping routes) with specified colors and weights. | |
Add captions directly on the connections to convey key metrics (e.g., cost, delivery time). | |
Add a title overlay to the visualization. | |
Display the visualization inline within the Jupyter Notebook if display_in_notebook is True; otherwise, save it as an HTML file. | |
Scenarios for Comparison: | |
Define contrasting scenarios or strategies to visualize and compare. | |
For Supply Chain Example: | |
Scenario 1a: All customers ship from a single DC (higher cost). | |
Scenario 1b: Each customer ships from their nearest DC (lower cost). | |
Each Scenario Should Include: | |
Description of the scenario. | |
Visual representation details (e.g., connection colors, weights, captions). | |
Visualization Combination: | |
Combine the generated visualizations into a single display within the Jupyter Notebook for side-by-side comparison. | |
Utilize tools like IPython.display to embed multiple visualizations neatly. | |
Exclusions and Customizations: | |
Specify elements to exclude (e.g., annotations outside connections). | |
Define styling preferences (e.g., color schemes, marker sizes). | |
Instructions: | |
Write a complete Python script that fulfills the above requirements. Ensure the script is well-documented with comments explaining each step for clarity. The script should be executable within a Jupyter Notebook environment and generate the desired visualizations based on the provided or synthetic data. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment