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
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<style> | |
div { | |
margin-bottom: 15px; | |
padding: 4px 12px; | |
} | |
.info { |
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 library | |
library(RSQLite) | |
## Connect to an existing database | |
Customers <- dbConnect(SQLite(), dbname = 'Customers.sqlite') | |
## Create and connect to a "virtual" in-memory database | |
Food <- dbConnect(SQLite()) |
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
# In `settings.py`: | |
```python | |
INSTALLED_APPS = [ | |
... | |
'django_plotly_dash.apps.DjangoPlotlyDashConfig', | |
... | |
] | |
``` |
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
{% load plotly_dash %} | |
{% plotly_app name="SimpleExample" %} |
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
```python | |
INSTALLED_APPS = [ | |
'django.contrib.admin', | |
'django.contrib.auth', | |
'django.contrib.contenttypes', | |
'django.contrib.sessions', | |
'django.contrib.messages', | |
'django.contrib.staticfiles', | |
'grocery.apps.GroceryConfig', | |
'django_plotly_dash.apps.DjangoPlotlyDashConfig', |
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 dash | |
import dash_core_components as dcc | |
import dash_html_components as html | |
from dash.dependencies import Input, Output | |
import pandas as pd | |
import plotly.graph_objs as go | |
df = pd.read_csv( | |
'https://raw.githubusercontent.com/plotly/' |
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
from django.shortcuts import render | |
import dash | |
import dash_core_components as dcc | |
import dash_html_components as html | |
from dash.dependencies import Input, Output | |
import pandas as pd | |
import plotly.graph_objs as go |
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
def add_datepart(df, fldname, drop=True, time=False): | |
"Helper function that adds columns relevant to a date." | |
fld = df[fldname] | |
fld_dtype = fld.dtype | |
if isinstance(fld_dtype, pd.core.dtypes.dtypes.DatetimeTZDtype): | |
fld_dtype = np.datetime64 | |
if not np.issubdtype(fld_dtype, np.datetime64): | |
df[fldname] = fld = pd.to_datetime(fld, infer_datetime_format=True) | |
targ_pre = re.sub('[Dd]ate$', '', fldname) |
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
df.to_feather('filename') | |
df = pd.read_feather('path/to/feather_file') |
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 library | |
library(RSQLite) | |
##Connect to an existing database | |
Customers <- dbConnect(SQLite(), dbname = 'Customers.sqlite') | |
##Create and connect to a "virtual" in-memory database | |
Food <- dbConnect(SQLite()) | |
## List all the tables currently in the database |
OlderNewer