These are chat archives for FreeCodeCamp/DataScience

28th
Nov 2017
Alice Jiang
@becausealice2
Nov 28 2017 00:40
D3 maps geojson, so you need to use the topojson API to convert the topojson file for you. It's already included and taken care of in the block you linked to.
Matthew Barlowe
@mcbarlowe
Nov 28 2017 00:42
Which part of that block converts the geojson? The topojson.mesh?
Alice Jiang
@becausealice2
Nov 28 2017 00:44
No, that part gets rid of overlapping paths (only one line between each state, instead of one border from each state)
Topojson.feature converts topojson objects into geojson features
Matthew Barlowe
@mcbarlowe
Nov 28 2017 00:46
Ok I think it’s all starting t make sense now thanks again for your help
Alice Jiang
@becausealice2
Nov 28 2017 00:47
No problem! :)
Alice Jiang
@becausealice2
Nov 28 2017 00:57
Idk what they're streaming, But I saw "AWS credit" and thought I'd share https://twitter.com/UUtah_esports/status/935296518025818115
Timothy Javins
@timjavins
Nov 28 2017 02:51
Very useful for launching remote desktops to run bots.
Or, you know, running data sciencey things.
Timothy Javins
@timjavins
Nov 28 2017 03:02
I had a bot in a .exe file that I needed to run remotely, so that the thing would run all night without supervision. I thought Azure was the obvious choice for running a remote Windows desktop. It didn't work. I launched many different instances with different versions of Windows and none would run the program. I finally launched an AWS instance with Windows Server 2012 R2 and it worked immediately.
Matthew Barlowe
@mcbarlowe
Nov 28 2017 03:12
@becausealice2 ok i got one more question what is ```
var g = svg.append('g')
       .attr('class', 'key')
doing?
Alice Jiang
@becausealice2
Nov 28 2017 03:23
@mcbarlowe At the very top of the code, he declares and assigns the svg variable with var svg = d3.select("svg") That code traverses the DOM and returns the first found svg element. The code you posted takes that selection, and appends a g element (g means "group", it's the div of SVG) inside of the selected element (the svg) with the class key
so you would have started with something like
<body>
    <svg></svg>
</body>
and ended with something like
<body>
    <svg>
        <g class="key"></g>
    </svg>
</body>
Matthew Barlowe
@mcbarlowe
Nov 28 2017 03:31
I see thanks again you've been a great help because I've scoured so many documents and code and nobody seems to comment their code on blocks which is really annoying
or at least the guy who invented d3 doesn't lol
Alice Jiang
@becausealice2
Nov 28 2017 03:35
He doesn't, but I give him a pass because D3 documentation is amazing.
Best I've ever had to use, to be honest.
And also because, y'know, it's his library.
Alice Jiang
@becausealice2
Nov 28 2017 04:18
I don't post blocks, but maybe I should. I have a habit of being overly-thorough with my comments
Or maybe I should just make it through tomorrow's big deadline then do my writeup I've been promising for almost a month....
Matthew Barlowe
@mcbarlowe
Nov 28 2017 04:20
yeah those are valid points I'm just doing d3 cause i have to for this project maybe at some point I'll come back to it but it just feels so foreign from my usual languages of R and python
maybe if i learn more javascript it will be better
And i might be in the minority but I feel the more comments the better
Alice Jiang
@becausealice2
Nov 28 2017 04:31
Yep. There's actually a post on D3 on Medium I just read earlier today by Elijah Meeks (he wrote D3.js in action) about what he's learned from his time using D3, and he has one line that I want to tattoo on everyone who asks me to teach them D3
...the entire library is framed as an engineering solution to an engineering problem, and data visualization is not an engineering problem. Data visualization is a communication problem
To do D3 well you have to know JavaScript
Alice Jiang
@becausealice2
Nov 28 2017 07:22
So, if I have a number of franchise locations and I want to figure out the number in any given city per capita, I just take the number of franchises in that city and divide it by the city population, yes?
evaristoc
@evaristoc
Nov 28 2017 08:24
@becausealice2 @mcbarlowe @timjavins thanks for sharing!! Nice information!
CamperBot
@camperbot
Nov 28 2017 08:24
evaristoc sends brownie points to @becausealice2 and @mcbarlowe and @timjavins :sparkles: :thumbsup: :sparkles:
api offline
:cookie: 137 | @mcbarlowe |http://www.freecodecamp.org/mcbarlowe
:cookie: 139 | @timjavins |http://www.freecodecamp.org/timjavins
Adam Drake
@adamdrake
Nov 28 2017 19:06
@becausealice2 Sounds correct to me.
Alice Jiang
@becausealice2
Nov 28 2017 19:08
Yeah, I figured out that the population data I gathered was different from the population data used for the rankings I was trying to replicate. All is well. I guess
Adam Drake
@adamdrake
Nov 28 2017 19:08
@becausealice2 Might have to be careful that the same city boundaries are used for both cases. There will probably be different values depending on whether city/urban/metro population numbers are used, and the same goes for the franchise locations.
If population is city, but franchise count is metro, then the per capita value will be off.
For example
Alice Jiang
@becausealice2
Nov 28 2017 19:18
I'm not especially emotionally invested in this, so I'm just going with the same data they used since it's what most of the article (data journalism wooooo) is based on
And it has to be done today because my contract ends and I won't be paid for any work after today...
Adam Drake
@adamdrake
Nov 28 2017 19:20
Got it. Could be helpful to note in your analysis that you are assuming the statistics are for the same geographical boundaries, just in case it comes up in the future.
Or you could raise the question to somebody if you aren't sure about the integrity or completeness of the data.
I try to be extra careful when I do analyses like that
Dallas has ~1 million people for example, but the metroplex has ~7 million, so analytics not using the correct boundaries can be quite off.