So, I haven’t actually wanted to be a web developer, but
I’m kind of the data chef, cook, and bottle-washer at work at the
moment, so spinning up some web code it is, then.
The existing code base is written in Bokeh which I hadn’t used
in over a year,
but pyLadies Amsterdam
did a web-training
that I attended to get going again.
This is a mockup of a plot I need for my work website, where
we want to be able to select lines from a plot.
You can use the box select tool in the upper left to select lines, then
click the button on the bottom to change the line color to cyan.
The two sides of the plot are linked (which is the feature I wanted
to play with), so if you box-select
the yellow line on the left, the yellow line on the right
also selects.
The reset tool in the upper left will put the colors back.
In order to use the selection styling functionality built into Bokeh,
I’ve bunched all my lines in each plot into a single MultiLine glyph.
Getting the data into the right format takes up a most of the code
below.
Now that I have my data, let’s plot.
Since I want my plots to be linked, I use the same ColumnDataSource for both the
left and right sides. The two plots also have the same x-axis.
The box select callback finds the data points in the box
boundaries and marks those lines associated with those points as selected.
These last two callbacks
Reset the plot to it’s original state
Change the color of the selected plots when you press the button below the plots
The last trick was to get the plot on my blog so I could show it off.
Bokeh’s autoload_static method creates two outputs: the body of a script to
display your plot, and a <script> tag that loads the script. In order
for the script to load properly, you have to give autoload_static the
location where you are going to store your script so that the html tag
part knows what to put for src=.
When I incorporated the script tag into the blog, I wrapped the html part
in a div to set the size (and included a resize corner in case you need it - the plot is
a bit wider than the default display width of the blog). This
blog is in jekyll, so I put the html tag in the _includes/
directory (where jekyll looks when I use the include directive) and the code body in
scripts/ where I told bokeh it would be when I created the html.
(Since the include is only one line, I could’ve just pasted it into the post as well.)
It’s been a while since I started this blog as part of my data
science bootcamp. Looking back at my little blog, it seemed
like I should either take it down or start using it again.
Since it’s NANOWRIMO month, let’s see if I can maybe get it going again?
Since this blog was born in a bootcamp, I thought a good ‘welcome back’
post might be how I look back on my bootcamp experience.
Things you should know before doing a data science bootcamp
Think of a bootcamp as “the icing on the cake.”
At the end of the course, you will be “whoever you were” (your cake)
plus “shiny new data skills” (your icing). Figuring out how to sell
that in the job market depends on your previous experience, what you do
during the training, and
how well you do the work of imagining your next life.
My fellow students with the clearest career goals got jobs faster (one
was even hired before she graduated!). I was probably fair-to-average
in that respect, but I knew that I didn’t know.
The main reason I chose the bootcamp I did was because I had a good
feeling about the career advisor. (Thanks for everything, Marybeth!)
Covid seems to have moved all of the in-person bootcamps
to online. I personally am glad that I did an in-person class.
The ability to practice giving presentations in front of a live
group was great pracice for both interviewing and for going back to work.
The casual face-to-face conversations in the break room with my
cohort and the staff were also important parts of the experience
for me. When you’re all working in a computer lab together, it’s easy to
ask the person next to you for help, while online you might not really a
sense of whether other folks in the room are having the same issue, or
if they are ok with being interrupted.
You will not learn all of data science in 12 weeks, but you will learn
a lot, and you will learn how to figure out “just in time” learning, which is
the only way to keep up with a constantly changing field.
Expect to have to continue to study afterwards to prepare for interviews and
to continue to grow on the job. But, also, once you’re away
from the experience a bit, you might appreciate it more than you do a week
after you graduate. At the end of the whirlwind of curriculum and
projects, it’s maybe easier to have a feel for how much you still
have to learn than to appreciate your accomplishments.