Skip to content

Instantly share code, notes, and snippets.

View alokreddy's full-sized avatar
🎯
Focusing

Alok Reddy K alokreddy

🎯
Focusing
View GitHub Profile
@alokreddy
alokreddy / index.html
Created December 19, 2018 15:24 — forked from darrenjaworski/index.html
Budget III
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Oklahoma state budget 2013</title>
<style type="text/css">
path {
stroke: #fff;
fill-rule: evenodd;
}
@alokreddy
alokreddy / index.html
Last active December 19, 2018 11:13 — forked from caravinden/index.html
D3.v4 Sunburst chart with line focus on hover
<!DOCTYPE html>
<meta charset="utf-8">
<style>
path { stroke: #fff;}
</style>
<body>
<h2 style='margin-left: 20%'>D3.v4 Sunburst chart with line focus on over</h2>
<div id='sunburst-chart-div'></div>
</body>
<script src="//d3js.org/d3.v4.min.js"></script>
@alokreddy
alokreddy / index.html
Created December 19, 2018 11:07 — forked from caravinden/index.html
OOP approach in d3.v4
<!DOCTYPE html>
<meta charset="utf-8">
<style>
.bar {
fill: #74BBFB;
}
</style>
<body>
<div id="barChart"></div>
</body>
@alokreddy
alokreddy / index.html
Created November 20, 2018 14:23
Sunburst w/ Zooming and Breadcrumbs
<div class="crumbs">
<!-- Crumbs dynamically appended -->
</div>
<div class="container">
<div class="chart"></div>
</div>
@alokreddy
alokreddy / README.md
Created November 15, 2018 10:37 — forked from robert-moore/README.md
A New Pattern for Updatable D3.js Charts

Using a new updatable chart format. Update functions are made accessible to the caller, handing over chart controls with full functionality to the caller in a modular manner. Data binding is done with method chaining, like any other configuration variable, and can be changed after initialization. This allows for changes to be rendered in the context of chart history, leveraging D3's transitions and update logic.

<!DOCTYPE html>
<html>
<head>
<title>HR Dashboard</title>
<meta charset="UTF-8">
<meta content='width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0' name='viewport'>
<link type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/dc/2.1.4/dc.min.css" rel="stylesheet"/>
<link type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet">
<link type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.13/css/jquery.dataTables.min.css" rel="stylesheet">
<link type="text/css" src="https://cdn.datatables.net/buttons/1.2.4/css/buttons.dataTables.min.css" rel="stylesheet">
@alokreddy
alokreddy / beautiful_idiomatic_python.md
Created March 12, 2016 06:53 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
@alokreddy
alokreddy / rename.py
Created January 13, 2016 09:01 — forked from igniteflow/rename.py
Python script to rename files in directory, transforming spaces to hyphens and the chars to lowercase
import os
"""
Renames the filenames within the same directory to be Unix friendly
(1) Changes spaces to hyphens
(2) Makes lowercase (not a Unix requirement, just looks better ;)
Usage:
python rename.py
"""
@alokreddy
alokreddy / useful_pandas_snippets.py
Created November 18, 2015 06:17 — forked from bsweger/useful_pandas_snippets.md
Useful Pandas Snippets
#List unique values in a DataFrame column
pd.unique(df.column_name.ravel())
#Convert Series datatype to numeric, getting rid of any non-numeric values
df['col'] = df['col'].astype(str).convert_objects(convert_numeric=True)
#Grab DataFrame rows where column has certain values
valuelist = ['value1', 'value2', 'value3']
df = df[df.column.isin(value_list)]