Skip to content

Instantly share code, notes, and snippets.

View erdogant's full-sized avatar
🏠
Building from home

Erdogan erdogant

🏠
Building from home
View GitHub Profile
# Load the dataframe as shown in code section 1
# datetime sample_id state
# 0 2000-01-01 00:00:00 1 home
# 1 2000-01-01 00:00:05 1 school
# 2 2000-01-01 00:00:10 1 work
# 3 2000-01-01 00:00:15 1 eating
# 4 2000-01-01 00:00:20 1 coffee
# 5 2000-01-01 00:00:25 1 sleeping
# 0 2000-01-01 00:00:00 2 home
@erdogant
erdogant / movingbubbles_example3.py
Last active October 23, 2022 20:09
movingbubble
# Import library
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# Import example
df = d3.import_example(data='random_time', n=10000, c=500, date_start="01-01-2000 00:10:05", date_stop="01-02-2000 23:59:59")
print(df)
@erdogant
erdogant / movingbubbles_example2.py
Last active October 23, 2022 20:05
movingbubbles
# Import
from d3blocks import D3Blocks
# Initialize with specific colormap.
d3 = D3Blocks()
# Create the chart.
d3.movingbubbles(df,
speed={"slow": 1000, "medium": 200, "fast": 10},
time_notes=time_notes,
@erdogant
erdogant / movingbubbles_example1.py
Last active January 19, 2023 19:16
movingbubbles
import pandas as pd
from d3blocks import D3Blocks
d3 = D3Blocks()
df1 = pd.DataFrame(columns=['datetime', 'sample_id', 'state'])
df1['datetime'] = ['01-01-2000 00:00:00',
'01-01-2000 00:05:00',
'01-01-2000 00:10:00',
'01-01-2000 00:15:00',
'01-01-2000 00:20:00',
# Import library.
from d3blocks import D3Blocks
# Initialize.
d3 = D3Blocks()
# Input parameters.
d3.movingbubbles(df,
datetime='datetime',
sample_id='sample_id',
@erdogant
erdogant / d3blocks_ImageSlider.py
Last active February 4, 2023 23:02
d3blocks
# Import
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# Import example
img_before, img_after = d3.import_example('unsplash')
print(img_before)
@erdogant
erdogant / d3blocks_scatter.py
Last active February 4, 2023 23:05
d3blocks
# Import library
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# import example
df = d3.import_example('cancer')
# x y age ... labels
# Import library
from d3blocks import D3Blocks
# Set color scheme
d3 = D3Blocks()
# Generate random data with various states
df = d3.import_example('random_time', n=10000, c=500, date_start="1-1-2000 00:10:05", date_stop="1-1-2001 23:59:59")
# datetime sample_id state
@erdogant
erdogant / d3blocks_timeseries.py
Last active February 4, 2023 22:58
d3blocks
# Import library.
from d3blocks import D3Blocks
# Initialize and set the datetime format
d3 = D3Blocks()
# Import climate dataset
df = d3.import_example('climate')
# Print
@erdogant
erdogant / d3blocks_heatmap.py
Last active February 4, 2023 22:56
d3blocks
from d3blocks import D3Blocks
# Initialize
d3 = D3Blocks()
# Import example
df = d3.import_example('energy')
# Create the heatmap
d3.heatmap(df, showfig=True, stroke='red', vmax=10, figsize=(700,700))