Live data from Hacker News

Teaching Pandas and Jupyter to Northwestern journalism students

californiacivicdata.org

1–10 of 47 posts

Re: Teaching Pandas and Jupyter to Northwestern journalism students

#2
I spend about 8 months of the year teaching pandas to journalism students, and it's a wild ride! Despite some of the iffy syntax and pandas' seeming inability to standardize parameter names, the students seem to grok the workflow much more quickly than wrangling lists and dictionaries in the "normal" world of Python.

I know everyone loves the reproducibility Notebooks supposedly bring to the table, but without a doubt my favorite part is the ability to export super-unattractive matplotlib charts as PDF, clean them up in Illustrator, and suddenly find yourself with publication-quality graphics. Knowing you're producing something more than just some numbers to toss in a story can be a strong sell to a lot of folks.

Re: Teaching Pandas and Jupyter to Northwestern journalism students

#4
I've found that most of the queries that journalists are trying to run are pretty basic, mostly filtering and histograms. Setting up a virtualenv, dependencies, etc can be tough. And RTFM isn't sufficient for someone getting started. I was surprised that nothing existed for this, so I built it.

It has the basics of a Jupyter notebook - filter, sum, average, plot. So far it's attracted a pretty interesting audience including journalists, but also lawyers and consultants.

www.CSVExplorer.com

Re: Teaching Pandas and Jupyter to Northwestern journalism students

#5

  But pandas’ magical simplicity makes things like computed columns immediately intuitive:
  > data['% of total'] = data.amount / data.amount.sum()
Is that immediately intuitive? I'm staring at this trying to understand what it's doing. Is the / operator overloaded? data.amount is one particular amount, and data.amount.sum() is the sum of all amounts? Why does the "computed column" property goes on the same data object as the actual data? Maybe it's immediately intuitive if you've used pandas.

Re: Teaching Pandas and Jupyter to Northwestern journalism students

#7

But pandas’ magical simplicity makes things like computed columns immediately intuitive: > data['% of total'] = data.amount / data.amount.sum() Is that immediately intuitive? I'm staring at this trying to understand what it's doing. Is the / operator overloaded? data.amount is one particular amount, and data.amount.sum() is the sum of all amounts? Why does the "computed column" property goes on the same data object a…

OTOH I think it's immediately intuitive if you are not a programmer. :)

When you see amount / sum, you think of how a list can be divided by what appears to a scalar.

When they see it, they parse it out for what they naturally understand a percentage to mean. And all is well.

Re: Teaching Pandas and Jupyter to Northwestern journalism students

#8
post #3

I really like Jupyter, but somehow I'm not in love with it. Like, every time I fire it up to use it for quick data analysis, I seem to inevitably end up back in sublime + bash, sending plots to disk. Am I the odd one out?

If you know what kind of short analysis you want to do, the benefits of Jupyter are not obvious. If you have to do a lot of exploration, and do longer analyses then it becomes indispensable.

Re: Teaching Pandas and Jupyter to Northwestern journalism students

#9
post #8
post #3

I really like Jupyter, but somehow I'm not in love with it. Like, every time I fire it up to use it for quick data analysis, I seem to inevitably end up back in sublime + bash, sending plots to disk. Am I the odd one out?

If you know what kind of short analysis you want to do, the benefits of Jupyter are not obvious. If you have to do a lot of exploration, and do longer analyses then it becomes indispensable.

I guess I could see that. Maybe I need to learn more of the keyboard shortcuts and magic methods.

Re: Teaching Pandas and Jupyter to Northwestern journalism students

#10

But pandas’ magical simplicity makes things like computed columns immediately intuitive: > data['% of total'] = data.amount / data.amount.sum() Is that immediately intuitive? I'm staring at this trying to understand what it's doing. Is the / operator overloaded? data.amount is one particular amount, and data.amount.sum() is the sum of all amounts? Why does the "computed column" property goes on the same data object a…

OTOH I think it's immediately intuitive if you are not a programmer. :) When you see amount / sum, you think of how a list can be divided by what appears to a scalar. When they see it, they parse it out for what they naturally understand a percentage to mean. And all is well.

Exactly this. I'm the author of the post and was a programmer by trade for a long time before I became a journalist. I _don't_ actually find this more intuitive than more explicit and fundamental programming techniques. But my students grokked it immediately, whereas even simple structures like loops seem to be harder to get for them to get their heads around.

Given I had ten weeks to cram a lot of material in but did want to show them some amount of programming, this worked pretty nicely.

Post reply on HN