David Delene: Okay, I guess we'll get started
David Delene: such as we can do.
David Delene: Second day of the workshop.
David Delene: And I started recording. And I will share
David Delene: the screen on Zoom
David Delene: or people online
David Delene: and share screen.
David Delene: And oh, I'll make sure.
David Delene: I think that's okay. I think I can probably hear you.
David Delene: Someone say, hello on the speakers.
Christopher Scott: Hello!
David Delene: Okay, I can just hear you, Christopher.
David Delene: that should be good.
David Delene: we're having trouble getting a server
David Delene: work in.
David Delene: So I emailed the host
David Delene: province in Colorado. So
David Delene: I'm hoping they get there 8 o'clock and
David Delene: can reset the
David Delene: server here.
David Delene: so
David Delene: I guess we'll have a backup
David Delene: plan.
David Delene: and I'll try to reverse what I was gonna do this afternoon
David Delene: and show you some other stuff. And see if they can fix this.
David Delene: Somebody can keep trying to see if you can connect. I'm pretty sure it's on their end.
David Delene: someone could try to connect with their phone or something is to see if it's on network. But
David Delene: internal server error means that we're talking to them, and I could
David Delene: give them my credential, and
David Delene: then they just don't know what I sent to the server so
David Delene: seem that it crashed so.
David Delene: We'll see if they reply to my
David Delene: email
David Delene: and stuff.
David Delene: So they gave me a list of
David Delene: a couple people that
David Delene: manage it so.
David Delene: But
David Delene: we can still have access to
David Delene: our account.
David Delene: And I can show you a couple of things. I was gonna do this afternoon.
David Delene: Does anybody have any questions? Comments?
David Delene: Any general things? Markers?
David Delene: Yes, it's a
David Delene: Jupiter notebooks. Jupiterhub, Jupiter labs are all open source packages.
David Delene: So.
David Delene: You just need a place to host them
David Delene: for this, but you can download and install on your own computer. I'm not sure if I have. Well, I don't have ability installed here. But
David Delene: So we have. Jupiter.
Christian Nairy: I'm trying.
David Delene: See what's installed on here. We got Jupiter notebooks here.
Christian Nairy: And.
David Delene: Start on this computer
David Delene: and
David Delene: So
David Delene: maybe since you asked a question.
David Delene: I can try to render
David Delene: notebook locally here.
David Delene: see what happens but not found.
David Delene: file local
David Delene: copy and paste. One of these Urls
David Delene: be here
David Delene: off the
David Delene: right.
David Delene: Okay. Now, I'm gonna.
Christian Nairy: Desk
Christian Nairy: kind of service.
David Delene: Server, localholes.
Christian Nairy: Of the month.
David Delene: Yeah.
David Delene: I'm thinking, this is
David Delene: a network.
Christian Nairy: Some.
Jim Cooley: I had.
David Delene: Servers is right in.
David Delene: You've known more. Just ran in.
Christian Nairy: At that. It does.
Christian Nairy: and that will.
David Delene: Okay. Renagrow browser.
David Delene: well, it's supposed to be that.
Christian Nairy: Easy, to.
David Delene: Just start the Jupiter notebooks, but it seems to be a.
Christian Nairy: We do
Christian Nairy: boots! He!
David Delene: A network issue or something. I would have to work out with the
David Delene: the the people. So something like that. But it's it's
David Delene: That was the way we used to do. It is, everybody would install their own Jupiter.
Christian Nairy: Notebook.
David Delene: And but you have to run it through a browser, so.
Christian Nairy: But then.
David Delene: And what I'm trying to do.
Christian Nairy: It's.
David Delene: You know you could set it up at like one of the servers on the university.
David Delene: and I've been trying to do that for a while.
David Delene: and we just haven't had time
David Delene: to do that. So
David Delene: next time I'll try, maybe harder to have a backup
David Delene: server
David Delene: for this
David Delene: and oh.
David Delene: I know what's wrong.
David Delene: We click this.
David Delene: I'm running on the wrong
David Delene: long computer.
David Delene: Jupiter.
David Delene: a Jupiter lab.
David Delene: Oh, okay.
David Delene: here we go.
David Delene: So I have the Jupiter lab read in on my local computer now.
David Delene: So
David Delene: when
David Delene: X times.
Christian Nairy: So.
David Delene: Without defined.
David Delene: So this is running locally. You see, the I IP address here
David Delene: is this.
David Delene: so I have a local version of it ran in
David Delene: on this computer.
David Delene: So I guess if we don't
David Delene: get that and
David Delene: you could try if someone wants, maybe
David Delene: one of my helpers.
David Delene: Try if you want to connect to
David Delene: to this address you.
David Delene: So every computer has a IP address.
David Delene: and
David Delene: this is
David Delene: it should be.
David Delene: Why doesn't it give me that?
David Delene: Well, you should be able to go to
David Delene: Or is that arrow
David Delene: can't find at most
David Delene: this is a name of this computer
David Delene: can't find server.
David Delene: Oh, dash 24.
David Delene: The central animal
David Delene: yeah. So
David Delene: should be able to be put this as your web browser.
Christian Nairy: So it's.
David Delene: Me see if I can do that.
David Delene: Unable to connect.
David Delene: I'm just wondering if the port is open.
David Delene: Huh? They say it's 1, 72.
Christian Nairy: Awesome.
David Delene: Yeah.
David Delene: it's.
David Delene: The network connection. I think you would have to run it locally.
David Delene: I can access it locally here. I'm thinking that the network ports are brought.
David Delene: or something that it's not wrong on the network to access this computer. But basically, I'm running it locally.
David Delene: And everybody could install.
David Delene: People know folks locally
David Delene: on your own computer.
David Delene: or the people that are here can run it for free. So
David Delene: And I guess if we
David Delene: don't get our server back. Maybe that's what we can try to do.
David Delene: Let's see.
David Delene: is
David Delene: or the other thing is, you can rent
David Delene: the way I usually do.
David Delene: Python is just running at the command line.
David Delene: So
David Delene: here you have the you know Manline version
David Delene: of Python. So it's an interpreter point 3
David Delene: x equals 3.
David Delene: So that's the way I usually do it.
David Delene: And if you want to write a program, so I'm going to do this backwards.
David Delene: If you were actually writing
David Delene: some code
David Delene: the way you would do it
David Delene: is
David Delene: well, the best thing is like, I said. Start with a example program.
David Delene: which I don't have one
David Delene: but
David Delene: I'll grab an example program.
David Delene: I'm not sure what is a good example.
David Delene: hello, world is usually example programs.
David Delene: And I like that because I can copy a bunch of stuff at the beginning.
David Delene: So pythons is a text file.
David Delene: right? So
David Delene: you can do this. And
David Delene: you could have a text file
David Delene: for this.
David Delene: And
David Delene: so if I start a program.
David Delene: import a bunch of stuff like
David Delene: and then I have a bunch of header information here.
David Delene: So whenever I do something, you have
David Delene: you have header information and triple quotes is for your header
David Delene: information.
David Delene: example, how you rent a program.
David Delene: What's today's date 24, 0, 8,
David Delene: 20.
David Delene: So it's easier for me to modify a code. That's why I say you never write the code yourself.
David Delene: Grant.
David Delene: And so this is the way I would write code in when you actually do the
David Delene: well, you know real world word
David Delene: code in. I would have my python code
David Delene: here.
David Delene: I would edit it.
David Delene: and
David Delene: one file.
David Delene: Yes, you got it. That working.
Christian Nairy: Service, by development.
David Delene: Service backup.
David Delene: You hope? Okay, everybody log into the server.
David Delene: cause you're gonna get tired of listening to me.
David Delene: So basically, what I would do
David Delene: is have my code open here with a text file
David Delene: or in a development environment.
David Delene: And then
David Delene: down in the other window, I would render code
David Delene: and do something like that.
David Delene: And then, when I said you would modify the code one line at a time.
David Delene: I would add a couple lines.
David Delene: right. I would go and write, write 2 lines of code, and then I would go down here and run my code.
David Delene: Okay? And so that's how I'd build up my code.
David Delene: I would start couple lines at a time.
David Delene: have one file open where I keep editing it, just like you did on the command on the
David Delene: bomb, and you keep going in.
David Delene: So when you write your code.
David Delene: you write it just one or 2 lines at a time, render code.
David Delene: and then you test it as you go.
David Delene: and that's how I how I.
Christian Nairy: Enact with
Christian Nairy: the python.
David Delene: So that's why I say, you don't use Jupiter notebooks to actually code.
Christian Nairy: To be added.
David Delene: But you get a.
Christian Nairy: A python.
David Delene: Done in star.
Christian Nairy: For the notebook.
David Delene: Granite, and I like the shell interfaces.
David Delene: You can do this with a development environment
David Delene: or something else.
David Delene: But that's how we are.
David Delene: Work on a cold.
David Delene: And, for example, this is all the python code for acquiring
David Delene: data from the
David Delene: weather stations I showed you
David Delene: so is that kind of long, winded answer to your question. Yes.
David Delene: okay, let's see if we can get online and go on to the
David Delene: workshop.
David Delene: So we can teach you how to write code as opposed to
David Delene: you, watching me.
Christian Nairy: To the company.
David Delene: Okay. Now, I'm gonna get confused. If.
Christian Nairy: They sent.
David Delene: If I don't kill that
David Delene: alright, everybody's on to Jupiterhub.
David Delene: Anybody getting onto it.
David Delene: Brian Henrick.
David Delene: that okay, everybody put up your frag for green when you get logged in.
Christian Nairy: Oh, I should have
Christian Nairy: still meeting from there.
David Delene: I'm getting an error. You guys, not getting an error.
Christian Nairy: This is a blondesh.
David Delene: Still doing that for you some.
Christian Nairy: Yeah, yeah.
Christian Nairy: anybody.
David Delene: Getting in.
David Delene: Sometimes they got a career.
Christian Nairy: Where.
David Delene: Create a cash
David Delene: and see if that helps on the
David Delene: browser.
David Delene: I still get an error.
David Delene: I think everybody's getting an error. Huh!
Christian Nairy: Yup.
Christian Nairy: helping.
David Delene: Yeah, it's
David Delene: maybe their whole system crashed overnight.
David Delene: okay.
David Delene: onward to my impromptu. That was one question. Anybody else has a question.
Jim Cooley: Well, hey, David, about that, so I didn't quite follow what you were saying with the 2 windows like, why would you write in one window, and then render code in the in the other one. Why, what is the why to that?
David Delene: Yeah, why I do that is, I just think it's faster.
Christian Nairy: This thing is faster.
David Delene: You can. Obviously.
Christian Nairy: Now.
David Delene: Same thing.
Christian Nairy: Thing.
David Delene: In this window, I mean, I can rent it
David Delene: in one window but a lot of times. You see error messages
David Delene: right? So if I go up here, and I
David Delene: must put an error in here, and then I can keep the editor open.
David Delene: and if I'm running it down in the other window
David Delene: I can see the error.
Christian Nairy: In the bottom window.
David Delene: Here. Sorry for the people. I should maybe
David Delene: move this up.
David Delene: They should yell at me if you can't see
David Delene: I could see the error. Messages come up when I render code
David Delene: in the one window, and then I can go back and look
David Delene: and it gives me the line number here like line 47.
David Delene: So I can go
David Delene: to line 47,
David Delene: see what it is.
Christian Nairy: I can compare.
David Delene: Care.
David Delene: and I just find it a lot faster.
David Delene: I don't know. Maybe should
David Delene: go to some of my other helpers.
David Delene: Do you guys have a favorite development environment favorite way to code. Maybe I start with Shawn and.
Christian Nairy: I use vim. So
Christian Nairy: you know. Do as I say, not as I do. I just. I just use a simple text editor, and then
Christian Nairy: have 1 1 terminal open and and the other one when I run it.
Christian Nairy: But it's pretty much the most basic way that you could do it, because that's how I learned it. And
Christian Nairy: I haven't gotten with the times of using the more advanced interfaces. So I.
David Delene: And if you haven't noticed, I'm using vim here.
David Delene: or vi
David Delene: which is a visual editor, it's all I can navigate through this, I can yank your brains and do stuff like that. It's incredibly fast.
David Delene: Yeah, I can type and program
David Delene: very quickly.
Jim Cooley: So so maybe it's very difficult to.
David Delene: Learn.
Jim Cooley: There, there's maybe there's a piece that we're just missing. So when I go to like the downloads page on
Jim Cooley: python, you know python.org downloads for windows.
Jim Cooley: I get a program called Terminal.
Jim Cooley: And is that what you're talking about?
David Delene: Yeah, I I haven't.
Christian Nairy: Done, too much.
David Delene: I'm running Linux here. But
David Delene: I should actually do it in windows. But yeah, you'll get a terminal where you get a prompt
David Delene: I'm not so familiar with windows. But basically yes, you you have to have a same
David Delene: interface. But it's a text editor.
David Delene: And Windows has gvim for a text editor. So whenever I'm on windows, I use Gbim
David Delene: as my text editor, and then.
Christian Nairy: And.
David Delene: You can do the same thing. I'm doing it down here.
David Delene: In the bath shell.
Christian Nairy: What? On?
David Delene: Windows, you can do it in the power, shell, or command shell.
David Delene: The other thing is now windows 1011 has ubuntu and other.
Christian Nairy: Linux versions.
David Delene: That you can install on top of windows. So
David Delene: I like that
David Delene: also. So sorry. I'm not too much familiar with windows, but maybe someone else in the audience has done more windows. Python programming.
Christian Nairy: Well with windows, you'd probably want to use something like spider, because so cause when we say terminal with Linux, what we mean is.
Christian Nairy: basically, it's it's effectively the command, prompt
Christian Nairy: of of windows. But in Linux, and it's very useful for doing things like coding. But for windows, things like.
David Delene: Spider exists which gives a nice user interface, but using python rather.
Jim Cooley: Tough to hear you. When you're away from the microphone. You have him come closer to where you're standing, David, because I couldn't.
David Delene: Okay, I repeat that for what Shawn was saying, Shawn's saying on on the windows, and you can do this on the Linux, too. Is this a development environment called Spider
David Delene: that you probably want to use?
David Delene: Yes.
David Delene: you want me to pull up Spider.
Jim Cooley: So like, so like just to. I guess I'm I'm asking. Maybe I'm.
David Delene: Come on!
Jim Cooley: Maybe I'm at one.
David Delene: Step behind.
Jim Cooley: You guys, but like.
David Delene: Christian nery. He's a Phd. Student and works with me.
David Delene: and
David Delene: so
David Delene: oh, you don't have a we don't have spider on this 1. 0, another thing to add.
David Delene: I can do it from. Should I do it on aircraft?
David Delene: I don't know if I can.
David Delene: see, that's the other problem with these computer.
David Delene: we're on a local computer and they don't have everything installed.
David Delene: See if I can share my screen.
David Delene: Oh, you want to log into zoom. And okay. So why don't I write Christian? But you, if you want to talk to you, should come up by the mic here.
David Delene: You come up.
David Delene: Use the podium if you want, but I'll stop sharing, and
David Delene: maybe Christian can give you a little
David Delene: demo of spider as a development environment.
David Delene: go to the mics here. So
David Delene: And you know.
Jim Cooley: I guess my question wasn't, hey? Can I see a develop? I it was. It was
Jim Cooley: having coded an R and and some of the things where you have the software that you need to in order to write the language. But what I'm just learning is that Python language works with different.
Jim Cooley: Text editors.
Jim Cooley: but
Jim Cooley: but with it. But you obviously need some sort of thing, some software to run the the code. And that's sort of what I was asking. And it what I thought was that you get, you know, the some software called Python, or something like that.
Jim Cooley: And that was news to me. That's all.
Jim Cooley: We don't see an example.
David Delene: Yeah, but or you can run on a command line, too.
David Delene: You usually run it from the development environment.
David Delene: So you're not used to running off on the command line.
David Delene: but you can.
David Delene: so you're always.
Jim Cooley: Don't know.
David Delene: Use in a development environment.
David Delene: And so that's what spider is.
David Delene: But spider, you can run multiple languages. Right?
David Delene: I believe. So, yeah, yeah, so there's
David Delene: a
David Delene: so the interface
David Delene: that you think of with the point and crick
David Delene: type of
David Delene: stuff is
David Delene: is the development environment
David Delene: is what they call it.
David Delene: So you're sharing a screen. Yeah. So like, this is an example of like a of like a
David Delene: graphical user interface
David Delene: to run python code in python.
David Delene: It's essentially what vim is
David Delene: is what Dave showed you this this left hand side is your your console essentially, or your your text editor.
David Delene: Right? So you can write all your code in here.
David Delene: And the reason why I like this so much is because in the bottom, right, it has your console.
David Delene: So
David Delene: I can go. It's essentially like a terminal, but all in one spot, all in one place.
David Delene: And
David Delene: you can run this. I mean, you guys are familiar with Jupiter Notebook and Jupiter Lab. Now,
David Delene: there's certain commands in here where you can essentially split off the certain cells and
David Delene: run individual cells like you were in Jupiterlab and Jupiter notebook
David Delene: and then also on the top. Right? You have your like, you can.
David Delene: I can just run this real quick.
David Delene: and it'll show you the plots in the top top, right? So it's all in one spot, and then you can also look at your variables. You can, you know, double check. Everything's looking correct and
David Delene: double click on this might take a look
David Delene: double click. You can look at your your data frames or your your X-rays, or whatever you're looking at.
David Delene: And so like this is, this is why I like it a lot, but it's it's
David Delene: you can download any other package like, what's pie charms another one?
David Delene: So I guess for windows. If you're on windows you could download something like this.
David Delene: All you gotta do is tell
David Delene: this program where your python is, and I'll read in your python, and then you just go from there. It's it's pretty easy.
David Delene: I guess
David Delene: this one second.
Jim Cooley: What do you mean? Thanks for that explanation. What do you mean by reading your python? What does that mean?
David Delene: Yeah, I'm gonna show you right, real quick.
Jim Cooley: Cool thanks.
David Delene: So it's a location of your your python exit.
David Delene: interpreter.
David Delene: because you can connect it to multiple versions of python
David Delene: also. Yes.
David Delene: like you have python 3.8 python, 3.10 python.
David Delene: 12
David Delene: 3.12.
David Delene: Yeah, yeah, right here.
David Delene: So python's the interpreted language. This is a development. Environment.
David Delene: So you would want to download both the the python language itself, and then a development environment. And they split them apart so that there's competition like you said, there's
David Delene: multiple development environments and and
David Delene: like, this, development environment can work with multiple languages.
David Delene: Oh, I think this is so. I think
David Delene: I think within this new version of Spider. You don't need to tell you. Tell it where your python is stored.
David Delene: but I think you can. You can go into here and then search for a different version of I of Python, but it just
David Delene: goes to the default. So whatever the latest version of Spider is capable with, like python 3.10 or whatever it is at. Now, that's what it will use.
David Delene: So I guess if you're a windows user, you download python, get it on your local machine.
David Delene: and then you can install Spider. You just go on to Spider's website, download it
David Delene: and then open it up, and it should be ready to go for you.
David Delene: So this is a lot easier, because I know, working with, like
David Delene: the
David Delene: the terminal, or the console in windows.
David Delene: It's not bash scripting, right? It's it's it's different. And so that might be a little bit of a learning curve. But
David Delene: this this is why the spider is so much easier and user friendly.
David Delene: So
David Delene: is it, Christopher? Is it? Does that answer your question online? There?
David Delene: Yeah. So he's Christopher Scott says, I had pie charm downloaded. So yeah, pie charm is also pretty good. I I started with pie charm.
David Delene: I don't know why I didn't continue using it. I think someone showed me spider.
David Delene: and I just liked it a lot a lot more. So I just stuck with that. So. But but pie charm is also pretty pretty good.
David Delene: okay, we got
David Delene: you can. Yes.
David Delene: So the question was, can you use Pip to install Spider? And the answer is, Yes, I think it's literally pip install spider.
David Delene: No, what was that? No, I it's literally it's just preference. I think the the main reason why I like this so much
David Delene: better
David Delene: is. It's kind of how I
David Delene: learn python.
David Delene: So it's like, it's
David Delene: if you change something, then you're just screwing with my mental. Essentially at that point. Yeah, that's that's essentially it. So awesome. Something that I would add to note is when you start programming, your habits will stick with you forever. Yeah. And so
David Delene: while working in the text editors is like, super fast and and very nice. And it will tell you where your errors are
David Delene: when you're working with code that takes like 10 to 15 min to run, and then you get an error.
David Delene: and then all your variables are gone.
David Delene: Then you start putting in print statements to figure out where your error was. It ends up adding a lot of but using stuff like spider where you have an interface, and it stores variables.
David Delene: You can do air checking a lot faster.
David Delene: So I've wanted to use Spider for a long time.
David Delene: but it takes time to learn, and my habits are already there. So I just keep torturing myself with print statements and having to rerun code. Okay, move over. I chose Sean how to fix that. Yeah, alright stop.
David Delene: So
David Delene: I gotta teach Shawn something here. Let me share the screen. So
David Delene: sorry where.
David Delene: and I'll script. But
David Delene: so my hello world program there when I ran it.
David Delene: if you want to have your variables and everything accessible.
David Delene: you ran interactive python.
David Delene: So
David Delene: acquire python.
David Delene: So before I was running period, Hello, world.
David Delene: and I'm getting this error
David Delene: and stuff so I could do python
David Delene: 3 and do a minus I. And it does interactive python.
David Delene: So when you run it 10 times, you get your variables here and I can print out
David Delene: my variable X
David Delene: I think I can.
David Delene: That lesson is 6 years.
David Delene: No one asked me this question 6 years ago.
David Delene: and I'm trying to think
David Delene: So because it's an interpretive language. You don't need to compile it.
David Delene: and
David Delene: haven't speak.
David Delene: So see, I have access to the variable list.
David Delene: So I ran it with interactive. I'll show you this again where?
David Delene: So
David Delene: so I'll do python 3
David Delene: minus. I is interactive. So it doesn't drop you out of your python
David Delene: when you render code. So you can do this and you get to the bottom your code.
David Delene: Yeah. And so you can just go here and say, you know, Print
David Delene: X. And then, when you actually do this, I go back up here and you start writing your code, you say, Okay, what's my next print statement. You put it in here. Print?
David Delene: Hello, 2.
David Delene: And you test this code, or you'd say, print, Hello, 2 comma x.
David Delene: right?
David Delene: And then I test this code here
David Delene: one line at a time. I copied that.
David Delene: and I put it back into
David Delene: my core.
David Delene: And so you can just build up your code
David Delene: as you go.
David Delene: And this is why you test
David Delene: and
David Delene: test as you go.
David Delene: and you don't have to.
David Delene: You know. Break it and stop it. You just have. I mean, if you cost subroutines and stuff. The only problem with this is, if you have well, we should talk about subcode.
David Delene: If you drop, if you call a function
David Delene: and subcodes it.
David Delene: it will return to the main code. It's hard to get into the sub codes this way.
David Delene: Right?
David Delene: Yeah. You can have print comments to do this. But
David Delene: if I had variables, you know, like z equals 10 and
David Delene: y equals x times 10
David Delene: cubed or something like that.
David Delene: And I wanted to have this code.
David Delene: you know. Copy. I can put that right into here.
David Delene: and then when
David Delene: why?
David Delene: not sure. Why? Why is
David Delene: that? How you do, python?
David Delene: 83 like that? I guess it's not the I forget what the hat is in python.
David Delene: I think the
David Delene: always like that.
David Delene: But you can. You? Actually, I'm doing it backwards. You can. You should test it in the environment 1st
David Delene: and then
David Delene: put it in your code to store it.
David Delene: But it's all interactive with a minus I. So you don't have to lose your variables. For this.
David Delene: So
David Delene: so advanced users.
David Delene: But anybody get on there yet.
David Delene: Keep checking.
David Delene: I don't know. They usually
David Delene: respond pretty quickly.
David Delene: Oh, okay.
David Delene: okay, they are working on the problem. I got an email back.
David Delene: And you want me a quote their email.
David Delene: M. Apologies. I think it's supposed to be my, my apologies for the inconveniences appear to be a problem at JS. 2.
David Delene: Anybody know what JS. 2 is?
David Delene: and your Jupiter Hub wasn't the only one affected. We hope to have it back soon.
David Delene: Yeah.
David Delene: So everybody keep
David Delene: keep trying
David Delene: So they are working on the problem.
David Delene: But that's another way to run it interactively. I got a couple more. Is there any other questions before I go on to something else while we wait here?
David Delene: I got one other
David Delene: a lot of things I can share.
David Delene: Where is okay? Everybody sees that online.
David Delene: So yeah, I use spider or some type of development environment.
David Delene: or and and this is why it's nice to talk to other people.
David Delene: And say, Hey, I'm having this problem with coding. You know, i i i want to figure out how to do that.
David Delene: And so
David Delene: you know you don't know the questions
David Delene: to ask.
David Delene: And where did my.
Christian Nairy: All I have to say to that is.
Christian Nairy: the Internet is your best friend. Yeah.
David Delene: Google stuff at the Internet? And ask questions, you know, like, How do you, you know.
David Delene: find that?
David Delene: The only problem with Googling stuff is knowing what to put in. And and
David Delene: Google. So
David Delene: that's part of the problem. Okay, I got a couple other things here.
David Delene: oh, and I'm losing my chat. I'm just gonna
David Delene: see if this
David Delene: my chat screen here. Some praise.
David Delene: because people are probably putting stuff in the chat.
David Delene: oh, yeah, our studios is the development environment.
David Delene: our is the language. Our studios is a development environment.
David Delene: I'm sorry I'm not an expert at all, although I've used it
David Delene: once.
David Delene: okay, the other thing I wanted to
David Delene: tell people
David Delene: is about coding on the website.
David Delene: It's kind of at the end for style.
David Delene: and for my students, I look right at you guys, and these guys will hopefully know it. I have a programming guide
David Delene: online. And this is kind of stylish type of guide.
David Delene: Okay, this is not something that's enforceable.
David Delene: But if you saw my
David Delene: my example code
David Delene: in my Hello, world.
David Delene: I have this header at the beginning.
David Delene: This metadata header
David Delene: and I assist everyone in my programs has name, purpose, example, how to render code. Who's the authors? When was it last modified? Okay, so we modify this code all the time?
David Delene: Okay? And when people break the code, I want to know who to go and
David Delene: talk to
David Delene: and stuff, and then I make a copyright. So you know what you can do with this code, you know.
David Delene: and so I insist upon every one of the codes having this information.
David Delene: and
David Delene: to give you an example, since I have on my code database in here.
David Delene: is of concern.
David Delene: Oh, it is okay.
David Delene: Alright. Everybody log in as I go back and finish this up.
David Delene: right?
David Delene: okay. So, for example, this is the a longer one that
David Delene: goes through this. But this is the modification history of this one.
David Delene: So see, I started writing this code in 2,003.
David Delene: Okay, well, though.
David Delene: I didn't add much, or I didn't put it much comments in in 2,014
David Delene: so about 10 years, I wasn't actually put in
David Delene: things into this.
David Delene: but I modified it. Jamie Eckness did Joseph O'brien, Kurt, Hibert, Andy
David Delene: Newman
David Delene: did a lot. Shawn did a modification of this in 2,019.
David Delene: Andrea did some more modification. Jennifer Moore
David Delene: Sean did again.
David Delene: So you see this history? This is what
David Delene: we do.
David Delene: and and we put in there. What was changed?
David Delene: Okay?
David Delene: And we got pretty good at keeping track of who does what
David Delene: the other thing we do is we use repositories
David Delene: for keeping track of the code.
David Delene: so I can't show you on this one. But I'll
David Delene: I'll show you on my server.
David Delene: So when we share code
David Delene: we use a repository because Micfold base
David Delene: is used around the world.
David Delene: On many research aircraft
David Delene: and
David Delene: all the time. And it's live. It's on there, and we have people all over developing for it.
David Delene: And so we have
David Delene: a repository that we keep the code. So
David Delene: that would be the other thing. I would
David Delene: strongly suggest
David Delene: that everybody and I require this of my
David Delene: graduate students at least, haven't required as my undergraduates yet.
David Delene: Either. But the undergraduates gets to be developers on my Adpa package and put stuff in that to it.
David Delene: Okay.
David Delene: graduate students sometimes have projects that diverge have their own special code.
David Delene: But everybody becomes a developer on the package.
David Delene: And then what we can do is, how do you keep all your
David Delene: computers sync with the same software.
David Delene: Okay, I have this one on this aircraft. We have this installed on dozens of computers around the world. How do you keep them? Sync. And this is a small project.
David Delene: Okay? The open source. Like spider and python, they got hundreds, if not thousands, of developers.
David Delene: and they got to keep this all synced.
David Delene: So Svn update will update my repository. So there's a database.
David Delene: And you see, on this one it Updated
David Delene: half a dozen files.
David Delene: Since I ran this last time
David Delene: I got a conflict here.
David Delene: This is something that usually my
David Delene: versions get conflicted.
David Delene: and I can just delete it and grab the version from the repository. And I'm at version 4,755.
David Delene: That's how many times this has been updated.
David Delene: Okay.
David Delene: And this started.
David Delene: I put this in like, in 2,007.
David Delene: So
David Delene: you can get big packages and and have lots of developers
David Delene: for this. And I can go through all my past students that were developers.
David Delene: But the idea is to get a
David Delene: a repository for your code.
David Delene: and then you can publish your your code base and your repositories.
David Delene: And so has anybody ever published code?
David Delene: You know you can publish code.
David Delene: Okay.
David Delene: when you publish something.
David Delene: So this code has changed 4,000
David Delene: 500 7,755 times.
David Delene: A publication cannot change.
David Delene: This is changing constantly every day.
David Delene: Almost
David Delene: okay.
David Delene: Well, how can you publish something that changes all the time?
David Delene: You can't.
David Delene: So what do you do?
David Delene: You freeze the publication, or you freeze the database, and you make an archive of it.
David Delene: So here's my open source archive.
David Delene: So here's my publication list.
David Delene: or my repository.
David Delene: This was last done in January 16, th 2,024.
David Delene: And this is version 4,632.
David Delene: Okay, so I can reference that that is a referable
David Delene: citable reference in a paper.
David Delene: I use this version of the code to process the data to make these plots.
David Delene: Okay.
David Delene: so you create an archive
David Delene: of your repository.
David Delene: And I try to do this every year
David Delene: I skipped 2,023
David Delene: on this.
David Delene: and likewise
David Delene: we do databases or data sets also. But
David Delene: and by the way, the library has a big data correction.
David Delene: That you can submit data to
David Delene: for publication of database data sets. So
David Delene: anyway, I'm trying to finish this up. Any questions about repositories and the usefulness of publishing.
David Delene: So my students should have 3 things when they graduate. They should have a thesis published, a software rep, code published and a data set.
David Delene: because it's pretty hard for my students to do anything without a data set.
David Delene: Oh, okay, he's working. And I that's a hint to start
David Delene: working on that. But I want to show you one last thing
David Delene: since I got you unlimited attention. Okay,
David Delene: program and guide
David Delene: go through this.
David Delene: and we could try to do some of this
David Delene: coding style.
David Delene: indent do loops.
David Delene: I like to keep the column short like 80 characters.
David Delene: Sometimes you comment out care lines of code, but you got to fix that up when you're done.
David Delene: use blank lines to separate big blocks of code, use 2 blank lines to separate major blocks of code, use variable names that make sense. So all these things
David Delene: equation loops, comments.
David Delene: you know. And then there's stuff about how you create plots and other things. So the main thing is
David Delene: read my code guide for my students
David Delene: and follow it
David Delene: and since my students.
David Delene: oh.
David Delene: so for my students, one of the things.
David Delene: and Jenna maybe
David Delene: just to give her an assignment. Because I tell people to read the
David Delene: Oh, I don't have one for programming. I have to make a programming quiz for Jenna.
David Delene: I have a data processing guide quiz. So
David Delene: Well, my students, I find that if I don't give quizzes and give them something to test themselves on they won't do it. So
David Delene: you know. So Jenna's gonna have to read my documentation data Processing Guide and take the quiz.
David Delene: read my software paper, take the quiz on like one of my former master students, that
David Delene: it took him 7 years to read my paper.
David Delene: And he finally did and said.
David Delene: Yeah, I should have read that when you told me to the 1st day.
David Delene: So
David Delene: you can go through that. So I'll make a quiz on my programming guide.
David Delene: So that you can. I can check
David Delene: that. You complete the quiz and pass
David Delene: so you do that. So, anyway, that was supposed to be at the end of the day. We did at the beginning of the day, so I guess we didn't waste any time, but that was supposed to be the
David Delene: you know. Go out and code
David Delene: take home Meg message. So
David Delene: any questions.
David Delene: Do we want to take a 5 min, break and get coffee before we start coding? Since we've been.
David Delene: Listen to me. Talk for an hour.
David Delene: 30 seconds. Yeah.
David Delene: get some coffee. Take a 30 min.
David Delene: 3 min. Break
David Delene: log in.
David Delene: There's coffee and donuts over there. I got more cookies.
David Delene: With some waters.
David Delene: The mother stuff, the bathroom building. So
David Delene: and we'll start the actual
David Delene: python stuff
David Delene: shortly
David Delene: and yeah.
David Delene: yeah, just come into zoom, you know the the links on the website. And of course, on my homepage
David Delene: and stuff. Yeah, if anybody has to go today, just walk out on me or whatever
David Delene: yeah.
David Delene: physical.
David Delene: right? There.
David Delene: that's website. I don't think
David Delene: so. I I don't remember.
David Delene: I didn't know.
David Delene: have you?
David Delene: And stuff like that
David Delene: awesome, happy.
David Delene: Okay.
David Delene: fairly
David Delene: like we're gonna find out
David Delene: when you speak.
David Delene: Yeah.
David Delene: it happens.
David Delene: And
David Delene: grabbing contract right there.
David Delene: Yeah, that's good.
David Delene: Quite a long
David Delene: 30
David Delene: tissue
David Delene: coat in the box like the box.
David Delene: Oh, man, I remember that
David Delene: these things like excel.
David Delene: So when I have my supervisor.
David Delene: he's not going forward to.
David Delene: Which is why? Because also now I
David Delene: oh, that's great.
David Delene: Basically, just yeah, thank you.
David Delene: Okay, sounds good. We have some stuff
David Delene: I got
David Delene: Christian to help
David Delene: here today.
David Delene: Okay, this is
David Delene: great.
David Delene: They told me, like today in my mind.
David Delene: Okay.
David Delene: okay, we had our little fun this morning.
David Delene: let's start now with
David Delene: the hard part of actually learning how to code.
David Delene: I should still be recording. Everybody can hear me online. I got the chat.
David Delene: share my screen.
David Delene: Anybody online. Let me know if anything is up.
David Delene: assume. You can hear me. And you can see
David Delene: online.
David Delene: And we want to do pandas, data frames next.
David Delene: And
David Delene: so this is
David Delene: kind of going on with what we ended up last
David Delene: night.
David Delene: And
David Delene: how can we do statistical analysis with tabular data is one of the main questions we'll answer here.
David Delene: The objectives are to
David Delene: select individual values from a pandas data frame.
David Delene: select entire rows, entire columns of the data frame.
David Delene: select a subset of both rows and columns.
David Delene: from a data frame in a single operation, select subsets of data frames,
David Delene: by single and booing criteria. So basically, the idea here is you have a data file. You have some information. You read it into this pandas data frame, and then we want to slice and dice and manipulate subset. Get to the actual information we want
David Delene: in that data.
David Delene: patents represents a tables or series of data structure.
David Delene: data.
David Delene: Pat, this is built on top of numpy
David Delene: library. Numpy is another very popular library.
David Delene: and lot of people use numpy arrays a prize to pandas data series and data frames.
David Delene: So one of almost everything I do always uses numpy.
David Delene: So what makes Panda so attractive is this powerful interface to access?
David Delene: Individual records of tables.
David Delene: proper hammer missing values.
David Delene: and relational databases between data frames. I think
David Delene: Christian mentioned X-rays, which is another popular
David Delene: type of way to manipulate and use data. So there's multiple ones.
David Delene: Of these kind of
David Delene: ways to handle data.
David Delene: But we'll go upon this
David Delene: for this. So
David Delene: we want to select values and access values in a position like I and J in the data frame
David Delene: and a position for that. So let's start here. 1st thing is, we need an import right?
David Delene: Import panness.
David Delene: as Pd.
David Delene: data equals. Pd, read
David Delene: Csv.
David Delene: and then we'll go slash that
David Delene: the
David Delene: minor G.
David Delene: CP.
David Delene: And we'll go to Europe today
David Delene: and we'll go to an index. Equals
David Delene: column equals
David Delene: country.
David Delene: and we'll print data. And now we got this new one. I
David Delene: loc, I locate
David Delene: 0 comma 0
David Delene: to get a
David Delene: What did I spell on? Oh.
David Delene: hey.
David Delene: correct my values. So
David Delene: we're reading some data here.
David Delene: With pan is, we have the data file
David Delene: given here.
David Delene: and then
David Delene: we like to access.
David Delene: an element of that data.
David Delene: So this is kind of like,
David Delene: doing an app.
David Delene: Yeah, when you write these I've made this
David Delene: name, you can save it with your name. So we're not overwriting everything.
David Delene: I made
David Delene: this notebook. Oh, I should make this
David Delene: Djd, and 2,024, 0, 8. Today's 20.
David Delene: So I'm I mean.
David Delene: I'm putting down Panis data frames.
David Delene: and then my initials, and then the date
David Delene: to create my Jupiter notebook.
David Delene: so that makes sense.
David Delene: Okay, everybody could take their frags down. So I don't see any red flags yet.
David Delene: So you got the numbers here. But the other thing that's nice is I put I locate in here the other way to do the data is
David Delene: just with locate.
David Delene: And here you could put in the actual names
David Delene: which may be more intuitive.
David Delene: Particularly if you have variables that you really understand. You don't have to remember the position of them.
David Delene: Okay, you can access it by
David Delene: the column and row names
David Delene: the event.
David Delene: So you can do that.
David Delene: We did this a little bit before.
David Delene: We can do a colon to represent everything
David Delene: locate.
David Delene: and then that's a square bracket.
David Delene: and then we can just put a Colon in there to represent everything
David Delene: in
David Delene: that value.
David Delene: Okay?
David Delene: So then you get all the parameters?
David Delene: Not just the one
David Delene: here's a question. Would you get the same thing? Maybe you guys could try that if you just left out the common colon
David Delene: and someone try that. Tell me if you get the same thing. If we just left out the comma colon.
David Delene: what would that give you?
David Delene: So I'm gonna answer that
David Delene: they know. What I'm saying is, we'll just
David Delene: delete
David Delene: this common coin. Does that work.
David Delene: Yes, and it gives you the same thing. Okay.
David Delene: so you could do it that way, too.
David Delene: Of course you can repeat the opposite way
David Delene: and do
David Delene: And I want to make sure everybody can read that.
David Delene: grant
David Delene: data. Locate.
David Delene: We can do Colon, comma
David Delene: to get the other
David Delene: variable.
David Delene: What did I spell wrong?
David Delene: Gdp per cap underscore?
David Delene: Oh, I need a parent. See? At the end.
David Delene: Okay?
David Delene: So then you can have all the countries listed
David Delene: to give you the values.
David Delene: And I'm assuming you would get the same thing
David Delene: if you just did that.
David Delene: Oh, no, you get an error. Hmm! Why do you get an error?
David Delene: What about if we did.
David Delene: Oh, never tried this one before.
David Delene: Oh, get rid of the quotes. Yeah.
David Delene: that one works
David Delene: auto method with the
David Delene: name of it. So there's lots of different ways
David Delene: to access the data. And that may be one of the confusion things. If you're looking at someone else's code
David Delene: to see that.
David Delene: you know they may have a different style than you do. That's why it's always nice to try different things.
David Delene: results of slicing. Of course, this is called slicing. The data can be used for further operation
David Delene: usually don't. Just print the a slice
David Delene: So all the statistical operations that work on the entire data frame works on slices of data.
David Delene: So if you want to calculate the Max value, you might want to do that with a slice of the data.
David Delene: For that.
David Delene: So let's slice some data and
David Delene: calculate a Max value.
David Delene: So locate.
David Delene: we're going to slice the data.
David Delene: Italy.
David Delene: Owen, Owen
David Delene: and Gdp per
David Delene: cap. 1962
David Delene: Owen
David Delene: per cap. 1972.
David Delene: And then let's put dot, Max.
David Delene: So the idea here is, we're going to slice the data
David Delene: anyway
David Delene: on Poland. And then we have
David Delene: a span of data. And then we're going to take the maximum of all that data.
David Delene: So the amount of maximums for each of the year between I
David Delene: area and
David Delene: Poland.
David Delene: Likewise you could do men
David Delene: for that.
David Delene: let's look at a comparison to selected data based on values.
David Delene: a comparison is applied. Element by element returns a similar shaped data frame of trues and false.
David Delene: So
David Delene: let's use a subset of data. So we go back to
David Delene: a comment here.
David Delene: And if you want.
David Delene: we're going to use a subset. So we're going to say subset equals the data.
David Delene: and we'll slice the data like we had before.
David Delene: hey?
David Delene: And
David Delene: we can print that out.
David Delene: And then we can print out
David Delene: which values are greater than 10,000.
David Delene: The slash. N means to give you a blank line
David Delene: subset grading 10,000. So obviously, I'm putting some comments in here.
David Delene: and if you want to try to keep up. You can just leave the comments out.
David Delene: of your
David Delene: data set.
David Delene: Let's see.
David Delene: trying to keep this.
David Delene: Okay. So I printed out the subset of data
David Delene: for this
David Delene: set of data, so it'll be to pull in. So you got
David Delene: 5 countries here
David Delene: and
David Delene: then you have the 3 years of data.
David Delene: And then where are values larger?
David Delene: And then in this case we're doing larger than 10,000,
David Delene: and then you print out true and false.
David Delene: So yes or no.
David Delene: And you see, obviously where
David Delene: it's above 10,000, you get a true value.
David Delene: So this is useful.
David Delene: For
David Delene: buying in
David Delene: particularly values of interest
David Delene: in your data.
David Delene: so one of the things that's very useful, these Booleans, yes or no.
David Delene: Is something called a mask.
David Delene: This is a concept across
David Delene: all languages. I 1st learned how to do this like 25 years ago. And idl masking data. Very powerful
David Delene: analytical technique. So a mask
David Delene: is applied to a data frame or an array.
David Delene: So we'll create the mask.
David Delene: so mask
David Delene: eco subset
David Delene: greater than 1,000,
David Delene: and then we can print out the subset, and then we'll put in the mask.
David Delene: and that mask is indexed
David Delene: within.
David Delene: Your variable. So I have the subset of the data here.
David Delene: So usually, that's what you have.
David Delene: Do I need to some? Yeah, let me make my screen
David Delene: a little bit higher, because some people can't see over the
David Delene: is that better?
David Delene: Okay? Sorry for the people up in the front to try to keep it.
David Delene: so
David Delene: yeah. And then you gotta. And then I try to keep it, not
David Delene: going up. So much so
David Delene: in a way.
David Delene: it's hard to have a big enough screen, and all these people in here. So
David Delene: so maths are are great. For getting the data
David Delene: and
David Delene: So I have the subset mask done.
David Delene: And
David Delene: I want to print out that mask, and what I was saying is, it's applied to the index values.
David Delene: So
David Delene: a mask
David Delene: is a way to get
David Delene: a subset of
David Delene: of the data frame. You know, you have a subset of data, but it's it's where something is true.
David Delene: you know, I want all the data where it's greater than a thousand. You could do this, for example.
David Delene: and atmospheric science. Right?
David Delene: I'm looking at aircraft data. I'm looking at the true air speed of the aircraft. But I only want to do that when the temperature is above 0.
David Delene: Okay, some other parameter.
David Delene: I could take that mask and say, oh, where is my temperature above 0
David Delene: buying that
David Delene: array? And it's that data frame and apply it to another variable.
David Delene: okay?
David Delene: Or more likely, something like cloud, like wicked water content in a cloud.
David Delene: I want to look and see where is that above 0?
David Delene: Find the temperatures where it's above 0.
David Delene: Find that mask, and then apply it to another
David Delene: variable.
David Delene: another part of the data. But they're all
David Delene: span the same time the same frame of data
David Delene: that makes sense.
David Delene: That's where the power of mass come in.
David Delene: So
David Delene: What they do here is when the mask is not true, is says, not a number.
David Delene: Okay, this is their missing value code.
David Delene: Okay, the data is masked out.
David Delene: Which is nice and powerful.
David Delene: and you put not a number where it is false.
David Delene: and the reason that this is useful
David Delene: is that not a numbers are ignored in operations like Max, Min.
David Delene: Averages.
David Delene: Okay?
David Delene: Sometimes, in my ideal code. I explicitly exclude
David Delene: missing value codes, but it's built into python.
David Delene: Let's put in a mask
David Delene: caught not a number.
David Delene: And then we can do averages and statistics on it.
David Delene: and it's very powerful when you you know.
David Delene: you know, if I was going back to my temperature example
David Delene: well, give me the min of the temperatures.
David Delene: and if I masked out the data where all the temperatures above 0, I better have all the temperatures above 0, and my minimum value should be above 0.
David Delene: But the power really becomes when you apply that mask
David Delene: to another parameter.
David Delene: Okay.
David Delene: so
David Delene: we'll go down and print.
David Delene: Okay, anybody want me to stop.
David Delene: And okay, you can help.
David Delene: Yeah, anybody needs help.
David Delene: Getting where I'm at. Here. Am I going too fast?
David Delene: Has anybody.
David Delene: I guess. Use that concept of a mask before.
David Delene: Okay.
David Delene: so it's
David Delene: It's almost the only thing I do when I analyze data
David Delene: is to apply mass to the data to get the data I want. So
David Delene: you know, we're looking at James Raft here. But for his thesis
David Delene: we're looking at images of particles, and I want to apply.
David Delene: We got something called an area ratio.
David Delene: and when the area ratio is low, that means we got long and gated particles.
David Delene: Show me these particles that are between point 2 and point 3
David Delene: and I want to see what they look like. You can subset and look at specific types of data.
David Delene: Because usually in science.
David Delene: the
David Delene: outliers
David Delene: are of interest or the pacific values.
David Delene: you know, maybe you got some data, and there's 1 outlier. Why is that one so much different than the other ones.
David Delene: you know.
David Delene: and goes with that?
David Delene: Okay,
David Delene: quint
David Delene: subset
David Delene: a subset
David Delene: greater than 1,000.
David Delene: Describe.
David Delene: you can describe the data.
David Delene: That's there.
David Delene: so pandas vectorization methods and grouping operations are features that provide
David Delene: users flexibility to analyze the data.
David Delene: we want to have a clear view of how European countries split themselves among
David Delene: according to their Gp, Gdp.
David Delene: so we may have a grims by spreading the countries into 2 groups.
David Delene: During a year. Survey those who presented you'd be higher higher than the average, and those that are below.
David Delene: you know, that might be some way you want to look at your data. Let's look at the ones above the average and ones below.
David Delene: you know, you can look at the A wealth score based on historical data
David Delene: where you account for this.
David Delene: So let's say, let's find the mask of the higher value
David Delene: data. We can do a mask
David Delene: higher.
David Delene: which would equal our data.
David Delene: So we can find the data of the mean, MEAN,
David Delene: okay.
David Delene: that'll give us a mask above that.
David Delene: and they got something called a wealth score
David Delene: a X
David Delene: oops. I forgot something here.
David Delene: Oh, I forgot a parenthes
David Delene: and print.
David Delene: See, did I get that? All right?
David Delene: So
David Delene: the wealth score
David Delene: is looking at?
David Delene: you know. Values of.
David Delene: you know? Are we higher than the mean or not?
David Delene: Where the wealthier countries.
David Delene: and how much higher are they? And they calculate this wealth score. So you got just a couple of lines of code
David Delene: to analyze and calculate the values. So it's pretty powerful
David Delene: when you apply these masks
David Delene: to the data, and how you can do that.
David Delene: In this data set. So again, when you do this.
David Delene: you should look at
David Delene: you know what it is the results you're getting? Do they make sense
David Delene: and check your code, and and that you're getting the right results?
David Delene: So
David Delene: we could do a well scored table
David Delene: and look at the differences across the
David Delene: the years.
David Delene: So I have that
David Delene: well scored there.
David Delene: And let's put in here a nice sort of table print data
David Delene: boop by
David Delene: well, score
David Delene: some
David Delene: of the tables.
David Delene: So
David Delene: we can do this and create a table. For the well scores given.
David Delene: Okay, so that's these numbers here that gives you this table of data.
David Delene: Okay.
David Delene: assign something for you to do.
David Delene: let's see what you can do for this.
David Delene: Okay, I will
David Delene: give you the 1st part of this. Let's do import.
David Delene: Well, we imported pandas already.
David Delene: Let's define data.
David Delene: do we do data Europe already?
David Delene: like, can't we? Yeah, we we imported Europe, right?
David Delene: No.
David Delene: Oh, yeah.
David Delene: Well, I wish we do it.
David Delene: So data.
David Delene: Europe
David Delene: equals. Pd, read.
David Delene: Csv.
David Delene: flash.
David Delene: GAPM. IDR
David Delene: EPE.
David Delene: Oh, what did I do wrong with this?
David Delene: I did. Gee.
David Delene: yeah, I always do that wrong. Yeah. It's the 1st time I did it wrong this time.
David Delene: So
David Delene: that's
David Delene: your code.
David Delene: Let the question be
David Delene: right here.
David Delene: Assignment your task.
David Delene: or any expression to find per
David Delene: capital.
David Delene: Gdp of
David Delene: Siberia
David Delene: in 2,007.
David Delene: Okay, so maybe I'll put this online for the people there.
David Delene: paste. Oh.
David Delene: make copy
David Delene: copy South.
David Delene: Well, I guess you guys have to copy this stuff. But this is the question.
David Delene: Do that.
David Delene: No.
David Delene: Hi.
David Delene: I'll try to paste this online. But see? Pick down your frags. See if you can do this
David Delene: assignment
David Delene: or this task
David Delene: where people online.
David Delene: you could put in a chat. Let me know when you get the
David Delene: expression done.
David Delene: So you want to write an expression of per capital
David Delene: Gdp.
David Delene: For Siberia and
David Delene: 2,007,
David Delene: and then put up your green frag when you get your answer.
David Delene: Oh.
David Delene: go up a little bit more
David Delene: fair enough right there.
David Delene: Exactly.
David Delene: I don't know.
David Delene: Oh, sorry!
David Delene: It's always a
David Delene: question of how big to make this
David Delene: versus Australia.
David Delene: So that's the
David Delene: I got. See some green frags.
David Delene: Wow.
David Delene: yeah. Gdp, sorry
David Delene: I keep getting my Gdp, G dp.
David Delene: wrong.
David Delene: gross domestic product. I gotta say that myself.
David Delene: Alright.
David Delene: I might need help put up the red flag.
David Delene: so I'll tell you. There
David Delene: the answer.
David Delene: So we did this. Oc, and we just need to put in the correct
David Delene: values.
David Delene: For the
David Delene: data we want. Right? So
David Delene: and what did I do wrong?
David Delene: I don't have my last bracket. Yeah.
David Delene: okay.
David Delene: Was that whatever we got, or is there a different way to do it? I get a different answer.
David Delene: Everybody good.
David Delene: Okay.
David Delene: let's look at a couple
David Delene: statements here.
David Delene: So
David Delene: do these statements
David Delene: produce the same output.
David Delene: Remember, we got a
David Delene: spanning the data with the
David Delene: index values.
David Delene: And then we can also span the data
David Delene: or slice the data. I guess I could get the right answer here.
David Delene: So
David Delene: by now.
David Delene: and tell me, do these produce the same answer?
David Delene: So
David Delene: red for the same answer, and green for different answers.
David Delene: yeah. Sorry
David Delene: period there
David Delene: they were not. So let's see, what did I say? Green for? Not the same answer, and red
David Delene: for the same answer.
David Delene: Okay.
David Delene: Johnny.
David Delene: Oh, is it data? Yeah.
David Delene: data underscore Europe?
David Delene: yeah.
David Delene: I had it right. To begin with, I had the second one wrong.
David Delene: Okay.
David Delene: so this this proves that
David Delene: you know. Well, one in 10 wines is written wrong, even if you
David Delene: some type in there
David Delene: so green for different red for the same. Is that what it is, or is it the opposite way? Okay, green for different
David Delene: And
David Delene: I need more time.
Jim Cooley: Hey, Dave, that ILOC. Function? Is that a typo? Is it just a lookup
Jim Cooley: or locate function
Jim Cooley: that misspelled? Or is that something new.
David Delene: I can't hear you. What was the question? Speak very loud.
Jim Cooley: the ILOC. Function. What is that?
David Delene: I always see that that's the index.
David Delene: Thanks.
David Delene: Index location.
Jim Cooley: Okay.
David Delene: Kind of been going by.
David Delene: Yeah. So that goes by the numbers
David Delene: index and by numbers. And the other is just location. Loc is for location.
David Delene: And I as index location.
David Delene: I see a lot of green frags, no red flags.
David Delene: so on. My got a question.
David Delene: Okay.
David Delene: it does not get the same answer.
David Delene: So
David Delene: it does not get the same answer. So the second statement, I guess I'll run this
David Delene: if mine worked
David Delene: stuff that didn't work.
David Delene: Yeah.
David Delene: Oh, CI am
David Delene: okay.
David Delene: There we go.
David Delene: That's what the output's supposed to be.
David Delene: And Korea not the same. So
David Delene: the the second column produces additional column.
David Delene: an additional row compared to the first, st
David Delene: so slicing 0 to 2 emits the final index. So this is like we are indexing before.
David Delene: So it does not include the final index, it up 2, but does not include the 2.
David Delene: while the name slices includes a photo indexing.
David Delene: Okay.
David Delene: so this is a little bit.
David Delene: bye, bye.
David Delene: A thing to keep in mind
David Delene: on how to do this.
David Delene: okay.
David Delene: if everybody
David Delene: once
David Delene: let's try this code example.
David Delene: I'll put that in there. I explain what each line of this short program does.
David Delene: What's first, st second, and 3.rd
David Delene: Okay, so there's my code.
David Delene: so
David Delene: what do we do? I go through the
David Delene: the roles and put you in
David Delene: with your role.
David Delene: So if someone want to
David Delene: talk about this
David Delene: and tell me.
David Delene: what the 1st line does. So first.st
David Delene: What does this do? Maybe someone in this 1st row here?
David Delene: Can you explain what this 1st
David Delene: line of code does
David Delene: right here.
David Delene: who was a volunteer?
David Delene: I'm not someone
David Delene: basically just renewed the
David Delene: well, see?
David Delene: So this is, reads a Csv file. This line loads the data set so reads loads
David Delene: and it does it from all countries. So that's what the name of the data file is.
David Delene: And the data frame is called first.st
David Delene: Okay?
David Delene: So that's what we call the data frame
David Delene: and the the index underscore COL.
David Delene: Parameter selects the columns to use as the row labels in the data frame.
David Delene: Okay.
David Delene: very good.
David Delene: What about the second line?
David Delene: someone wanted to tell me
David Delene: what that does
David Delene: second equals. First, st
David Delene: what 1st continental equals America.
David Delene: Anyone want to take a guess at this
David Delene: Marcos, you guys.
David Delene: it selects the countries which are.
David Delene: yeah. So you have this?
David Delene: Yeah, you have the equal sign here.
David Delene: Okay.
David Delene: that's a bullion.
David Delene: You know. Does this match?
David Delene: So the bony expression inside the brackets
David Delene: is used to select only those roles where the expression is true.
David Delene: so you could put
David Delene: like greater than equal to, but it selects the ones where this is
David Delene: where
David Delene: this
David Delene: expression is true.
David Delene: Okay.
David Delene: where that expression is true.
David Delene: it takes some index, values, indexes 1st and puts it into the data frame. Second.
David Delene: okay.
David Delene: what a bit confusing. But
David Delene: you can have, you know, pretty complicated expressions. And the idea is to work work from the inside out.
David Delene: Whenever you have these expressions.
David Delene: what about the 3rd vine?
David Delene: Let's see, what does a 3rd one do?
David Delene: 3rd equals
David Delene: second.
David Delene: period. Drop
David Delene: Puerto rico
David Delene: So
David Delene: So we apply this drop function, but in this case we are dropping, not a row, but a whole column
David Delene: to accomplish.
David Delene: This we want to specify the axis value. We want to drop the second column.
David Delene: which is index one, so
David Delene: they say. Should we put in access equals
David Delene: one?
David Delene: Someone could try that
David Delene: both ways.
David Delene: Final expression.
David Delene: Is to write the data frame we have working on to a Csv file. Okay, so remember.
David Delene: we have this 2 Csv.
David Delene: and you can write out out to results.
David Delene: So let's see if that results section.
David Delene: And what did I
David Delene: do wrong?
David Delene: Oh.
David Delene: sorry I didn't put in my slash
David Delene: share here because I copied this directory.
David Delene: Oh.
David Delene: wrote
David Delene: that need that?
David Delene: Oh.
David Delene: yes, you don't need it in that, Puerto Rico you just need in the Continent one
David Delene: what I was trying to do is see if we get the
David Delene: results.
David Delene: Data file to show you, because we haven't really done this.
David Delene: let me open this up
David Delene: so you can create the data file here.
David Delene: So I'll just show you that we can create a data file
David Delene: on this
David Delene: type of format.
David Delene: so there's many ways to access data.
David Delene: So we went over 2 ways to access data,
David Delene: values or slices of data by name or by index. However, there are many other examples. For example, a single column, a row can be accessed.
David Delene: With a data frame or a series of objects.
David Delene: you can access single rows, single columns.
David Delene: access, individual data, frame elements
David Delene: access, several rows of data, several columns of data access subsets of specific rows and columns
David Delene: and access subset of columns and role ranges.
David Delene: So all types of ways to slice and access the data.
David Delene: oh, there's another one here.
David Delene: Yeah.
David Delene: you won't.
David Delene: Won't talk about that. Okay, we're almost done with this hour.
David Delene: key points. Use data frames, direct values by integer vocation. That's what we started with
David Delene: use a coin on its own means that all columns and all rows
David Delene: you can select multi columns with locate.
David Delene: and the name of the size.
David Delene: Slices can be used to further operation. So you can
David Delene: slice the data, get a new value.
David Delene: Use comparison of the data, select database on a value, and when you select a value and you replace it with
David Delene: not a number, you can use that
David Delene: in further operations with
David Delene: like Max and Min.
David Delene: So this is a very powerful
David Delene: tool.
David Delene: So with that, why don't we quit? Then take over the break here
David Delene: and we'll go on next.
David Delene: We'll get to broaden
David Delene: the data.
David Delene: So
David Delene: we did the data frames. And then before lunch, we got to go back and do part in the data. So take a 5 min break here
David Delene: and
David Delene: we will go
David Delene: to plot in
David Delene: data.
David Delene: Yeah, go to my meeting. Yeah, I'll be back here.
David Delene: Yeah. And if you want food, come back
David Delene: for the food.
David Delene: Yeah. Been enough.
David Delene: I think. I was gonna pause. The
David Delene: yes.
David Delene: I think the second information
David Delene: that I think we used before.
David Delene: so
David Delene: trying to see which one it
David Delene: was
David Delene: up.
David Delene: Yeah.
David Delene: Oh, this aggregate. I think that
David Delene: mask higher aggregate.
David Delene: that wealth score.
David Delene: maybe mask higher, aggregate some.
David Delene: So when you don't have know exactly what it is.
David Delene: so oh.
David Delene: I so mask higher aggregate, and then that's a sum.
David Delene: and so it looks like it. The numbers.
David Delene: the aggregate is probably adding them all together with the sum being what you're aggregating, how you're doing an aggregation. And I think the other thing is, can we do a help on that?
David Delene: I don't know if this will work.
David Delene: they have
David Delene: click on that
David Delene: 15.
David Delene: Yeah, they're up to 12. Yeah.
David Delene: So I went back through. And I did help on the aggregation method. And you got access.
David Delene: so there's. And then there's a sum here. So the sum is going across all them, I'm pretty sure, as opposed to minimum. And there's different values you import.
David Delene: But that's the idea of
David Delene: when you don't know how to do something. Look at the help, print it out
David Delene: and and figure out
David Delene: what it does.
David Delene: I remember the size of them. I can show you on the computer. You're right that python loopy examples sometimes help to see it in a code. Yeah, with it. Yeah.
David Delene: yeah, there's no seed as examples down here. Yeah. So there's
David Delene: And there's a lot.
David Delene: It's kind of easy to figure out what it is once, you know, like what the command is, but so many times you don't know like what to do. You know, what function do I use for this or and that's where it's nice to have examples of other things that we've done, you know. Because you don't know
David Delene: to
David Delene: to do something.
David Delene: and that's the hard part is, you know.
David Delene: it's easier to figure out how
David Delene: how to do something when you have like something like aggregate. But if you want to do something like that, what's the function? You know what? What's the method?
David Delene: And so you can look at some of these different
David Delene: methods that are available. Because if
David Delene: if you want to do something, someone else probably want to do the same thing
David Delene: right? So they probably wrote that function already, and if it's something
David Delene: that hasn't been written before me, you probably want to think we do. You really want to do that, you know. Is that so.
David Delene: yeah, it's almost
David Delene: I'm not
David Delene: however, it is. You know, you build up
David Delene: different routines, different stuff.
David Delene: And how you manipulate the data and
David Delene: to get different methods because you can do more fancy things. But
David Delene: basically everything, almost everything's been done
David Delene: because there's so many ways to slice the data and do this, you just need to know the.
David Delene: you know, some of the concepts like mass that are applied. That's a concept
David Delene: and then the slicing of the data, taking rows and columns. That concept of slicing.
David Delene: But you don't have to
David Delene: but go through the array and pick out individual elements with double loops, like we used to do with Fortran. And
David Delene: and so, yeah, yeah, so you, you know, you used to always have to loop through your rays and do that. This
David Delene: I mean, it's higher level. It does the same stuff you did in the other ones. But it's a higher level concept. But you gotta keep track of them.
David Delene: the different levels of doing in the data and operation
David Delene: and
David Delene: and that's why they're, you know, it's developing. You know, you get more and more powerful tools.
David Delene: Just to give you more access to more data and
David Delene: or ways to manipulate the data
David Delene: stuff in that. So?
David Delene: Yeah.
David Delene: thank you.
David Delene: Yeah.
David Delene: I've played around a bit just to get used to the software. I've made a small little application just a little bit of fun, but I feel like I've written it as a like
David Delene: hard code.
David Delene: very like
David Delene: brushwood, Java like.
David Delene: Is it possible that when we have a more time to just go through it and go like, yeah, this might be an easy way to do that. Yeah, we can talk to you, maybe in a day, and I I got another application that I can show you. I didn't show at the beginning.
David Delene: That we have a product routine.
David Delene: That we written in python. Well, I didn't read it, but when my students grow.
David Delene: and we can look at some of that
David Delene: to to kind of look at a more sophisticated, excellent.
David Delene: And just because I want to do something with like, if loops or loops, I'll loop something like that.
David Delene: But I feel like it's it's like people.
David Delene: Yeah, we we'll get back to after we do plotting. We got loops. And if stuff and I'm looping over the data and stuff this afternoon, too. So that's the last
David Delene: concept to iterate.
David Delene: But yeah, I can look at it and see if I think
David Delene: if I can follow, it's it's very amazing. So let's just now I feel it's just there's a lot of new segments. I feel like there should be an easier way.
David Delene: Yeah. Well, maybe mask in the data. Well, but that's the problem is right now. I thought about most of them. But like I have a conditional set. And right now, the conditional set is what the computer doesn't matter.
David Delene: And then what the user input was. And then, according to that, oh, you choose rock, you choose paper. Oh, you chose whatever you want.
David Delene: Yeah, that was just my thought. It'd be like, nice to see. Yeah, I can look at it and stuff. So thanks. Yeah, go get something to drink. I'm gotta get
David Delene: okay.
David Delene: we are getting to
David Delene: bought in now.
David Delene: And
David Delene: let's see here, I gotta did. I create my
David Delene: my spot in.
David Delene: So this is called plotting and programming in Python.
David Delene: because we really want to emphasize the
David Delene: power brought in.
David Delene: Because that's the end result
David Delene: of so much of what we do.
David Delene: you know you talk to your
David Delene: colleagues, your advisors
David Delene: present at a conference. It's almost always you're making some type of bot.
David Delene: So
David Delene: so the basic question is, how do I plot my data? We talked about reading the data.
David Delene: that's the hard part reading in the data.
David Delene: plotting is pretty easy, however, creating plots that
David Delene: people can look at quickly.
David Delene: You go to a conference, and there's 400 posters there.
David Delene: and you got an hour to browse through them.
David Delene: Boy, how much time you got to spend on you look at the title, and maybe you can look at one plot. What is it that you're going to pull away from that thing?
David Delene: And of course, if you plot the data you want to save it so that you can put it on that poster
David Delene: objectives create a time series
David Delene: plot showing a single data set.
David Delene: create a scatter plot, a relationship between 2 data sets. So that's the
David Delene: the basic of what I do.
David Delene: I do a lot of aircraft surface measurements. Everything's a time series data.
David Delene: So time series is what I plot most of the time.
David Delene: and then
David Delene: you know, scatter plots. One variable versus another would be the other
David Delene: type of plot. So
David Delene: map plot lib is the most widely used scientific modern library and python.
David Delene: But you know how you graduate. Now, if you didn't do this import.
David Delene: Matt, but lib dot
David Delene: I've got.
David Delene: and then as plt
David Delene: -oh, Matt.
David Delene: I can't spell it right.
David Delene: MAT. Plot.
David Delene: Okay, Matt.
David Delene: MAT.
David Delene: Bot lab.
David Delene: and then we're using
David Delene: pipot common use sub library
David Delene: of mappot lab.
David Delene: Jupiter! Notebooks will render the plots in line by default.
David Delene: So a lot of times when you we're talking about coding with spider and other stuff, you got to render them and display them when we do it in here. It's automatically sprayed as part of the development environment.
David Delene: So simple parts are usually easy to create.
David Delene: Let's do time.
David Delene: We'll start at 1, 2,
David Delene: 2, 3, and 4. Make an array.
David Delene: Position equals.
David Delene: is
David Delene: 0 comma. 1,000 comma, 200 comma, 300.
David Delene: Okay?
David Delene: So there's our 2 variables that we want.
David Delene: I guess I should
David Delene: put a space there
David Delene: and plt
David Delene: we get our vowels. But
David Delene: time, position.
David Delene: time, and position.
David Delene: Let's put some axis values on here.
David Delene: Access labels.
David Delene: Time. Put some units on the time.
David Delene: so
David Delene: kilometers
David Delene: have to rise.
David Delene: the titles.
David Delene: And let's make a plot.
David Delene: Yeah, so easy.
David Delene: that is
David Delene: 5 lines of code. You got the axis. You got the X and y.
David Delene: try that something like that in C can't do it in C,
David Delene: But it's 5 lines of code to make a plot.
David Delene: You put in your data.
David Delene: It makes the tick values. It makes the x, and y axis values
David Delene: you plot x versus y
David Delene: and there's a lot of defaults.
David Delene: So
David Delene: I think that's easier than like doing an excel. You could put them in excel sheet
David Delene: You could then select the cells and make the plot.
David Delene: and then you gotta go and label the X and y axis values. But
David Delene: I would argue that it's fast to make a prod in python than it is in excel
David Delene: baby
David Delene: to do that. Very good.
David Delene: so I said. Jupyter. Notebooks
David Delene: cells generate the figures directly below the code.
David Delene: other python environments. When you do it interactively. You have to show the plot. So typically when you do this, you got to do Plt show and show
David Delene: the plot.
David Delene: So for completeness, that's how you actually show it. Here the cells automatically make the plots.
Jim Cooley: Hey, Dave? I didn't understand that. The we we can see the the plot, obviously.
Jim Cooley: But you're saying
Jim Cooley: we have to do plot. Show what? Why, what, what's different.
David Delene: So Jupiter notebooks here.
David Delene: when you run this cell here.
David Delene: right? It automatically makes the plot.
David Delene: But if you did this in
David Delene: on the command line or in a program or in a
David Delene: a development environment.
David Delene: It would make the plot. But
David Delene: it would be in
David Delene: basically, you wouldn't see it on the screen.
David Delene: Okay?
David Delene: So if you want to make the plot come out, you have to do the plot show.
David Delene: and that's
David Delene: part of the
David Delene: the functionality of the
David Delene: development environment.
David Delene: So if you are on a different computer.
David Delene: it doesn't do it.
David Delene: for that, because usually what you would do is you do the
David Delene: the command up above?
David Delene: If you're doing this in a development
David Delene: environment, you have to put Plt
David Delene: dot show
David Delene: like that
David Delene: to get it to work. You would add this
David Delene: this command
David Delene: to it. But that's kind of like
David Delene: automatically done in the network. The Jupiter notebooks.
David Delene: I don't know, save type in.
David Delene: I guess that's why they
David Delene: they do it.
David Delene: Okay, let's go back and get a little bit fancier now
David Delene: and go back and combine odds with pandas.
David Delene: and let's read in some data.
David Delene: And
David Delene: oh, what did I write
David Delene: wrong with this one?
David Delene: And it read shared
David Delene: oops. I need a comment.
David Delene: But see, at the beginning.
David Delene: there we go.
David Delene: So let's extract
David Delene: a year for the 4 characters of each of the columns.
David Delene: I'll put in here what we're
David Delene: with doing it. You don't have to
David Delene: Let's
David Delene: type that
David Delene: because these are comments. But
David Delene: these are good comments to put in.
David Delene: We're gonna extract year
David Delene: from the 4 characters of each column. Name the current column. Names are structured as
David Delene: Gdp underscore that which is a format.
David Delene: So we need to keep the year part
David Delene: of this data so we can plot Gdp versus year
David Delene: so we use replace to remove the from the string character.
David Delene: the starting element.
David Delene: This work with strings. So we usually brace on the panelists
David Delene: series string. So basically, this is telling us what we're doing
David Delene: with this command because we want to get years
David Delene: so that we can plot the data
David Delene: Gdp
David Delene: for a cap.
David Delene: I'll just print years to show you what we're getting.
David Delene: So that extracts the years of data.
David Delene: Using a string.
David Delene: Okay.
David Delene: data column.
David Delene: Oh, now, where I can change that to a
David Delene: an integer type.
David Delene: Now, we want to extract extraia.
David Delene: Oh, we can do this with the profit team.
David Delene: Oh, data columns, data locate.
David Delene: So this defines the data columns that we're going to use for our plot.
David Delene: and we are then
David Delene: I did that wrong.
David Delene: I think
David Delene: I need a variable here, a
David Delene: there we go.
David Delene: So now leave that up there so you can copy the vines. But basically we made a font
David Delene: of the
David Delene: Gdp
David Delene: on the Y axis versus the years on the X axis.
David Delene: So this is standard
David Delene: bought in routines, for you know you put your
David Delene: dependent variable year and your independent, variable.
David Delene: I see, dependent and independent.
David Delene: Basically, you know what varies. What's changing as a year is that makes sense to be on the X axis, and the value that you want to plot is on the Y axis.
David Delene: so
David Delene: independent is the X and the dependent is a y.
David Delene: so there, we we kind of went full circle now and
David Delene: get some data out of your data. Set
David Delene: and plot the data.
David Delene: See what it looks like.
David Delene: and you know you could label years and
David Delene: Gdp, but you see the increase
David Delene: of the gross product with years.
David Delene: as you would expect.
David Delene: so we could.
David Delene: rose is on the X-axis. We can transpose the data in order to plot multiple series
David Delene: of data.
David Delene: So let's do
David Delene: the data transpose. Here the T is transposed again.
David Delene: and
David Delene: and then we can add a label Gdp.
David Delene: so now you can plot 2
David Delene: values.
David Delene: Okay? And the transpose is just because of the way they do the the labeling of the data.
David Delene: So
David Delene: that's pretty easy. You know, you read in your data with couple of lines of code.
David Delene: You brought it up.
David Delene: You don't need 10 or 12 parts in your thesis
David Delene: only takes couple lines of code, so
David Delene: to be. Have it done very quickly. Right?
David Delene: Slice up your data and get it there. Everybody good questions.
David Delene: Well, anyway.
David Delene: so you can see the plot there.
David Delene: Make it a little bit smaller. So you can see
David Delene: the plot of the data.
David Delene: what what it gives.
David Delene: So there are many styles of plots available.
David Delene: We could plot different ones.
David Delene: let's use this gg, plot.
David Delene: Data transpose plot.
David Delene: The kind is a keyword.
David Delene: So
David Delene: when you have something like kind equals bar I I call them keywords.
David Delene: so
David Delene: we can. XY axis it and you can do a ballpark.
David Delene: and I mapport ribs has tons and tons of different plots of data.
David Delene: So you could go back. And
David Delene: we did just types of data.
David Delene: Yes.
David Delene: how does it go to Australia and New Zealand.
David Delene: Where? Where are we started doing?
David Delene: I, I,
David Delene: yeah, transposing it, it flips it around. And there's only
David Delene: There's only 2 countries.
David Delene: because we read in
David Delene: the oceanic.
David Delene: Remember, we went back to this one, this one's oceanic and only has the 2 countries.
David Delene: So that's why we went back and use this, especially Europe, that has so many of them.
David Delene: So you could if this plots all the data by default.
David Delene: Yes.
David Delene: it is
David Delene: good.
David Delene: yes, but
David Delene: a better resolution.
David Delene: it's you can output high quality data when you do the
David Delene: we're not saving the data. We only put it out here. If you're going to
David Delene: I think save plots, I think we get to at the end.
David Delene: and then you can make like png files with
David Delene: you know 300 dpi dots per inch or something when you
David Delene: thank you.
David Delene: That's the first.st
David Delene: Oh.
David Delene: ye yeah, you can change the XY values. I'm not.
David Delene: You're
David Delene: exactly how
David Delene: but yeah, you can. There's so many options to it. And that's part of the problem is,
David Delene: it's kind of like. Excel. You don't necessarily get the
David Delene: the best high quality exactly where you want it graph.
David Delene: So when you make your plots.
David Delene: that's easy. But to get it
David Delene: to give you the very high quality exactly what you want
David Delene: and manipulate around and
David Delene: change things.
David Delene: can take some time
David Delene: to get something.
David Delene: We're it's looking at the data and then getting a high quality plot.
David Delene: That really communicates what you want can be a little bit more work.
David Delene: okay. We we talked about before we get in both of the
David Delene: data. Let's just get Australia data here
David Delene: years, equal data columns
David Delene: and Gdp, Australia.
David Delene: It all
David Delene: A, IA
David Delene: data Llc, and we're going to extract
David Delene: Australia.
David Delene: And then we're going to plot.
David Delene: And then we're going to make a particular type of plot
David Delene: which is coded with G being green and dashed lines.
David Delene: So
David Delene: there's our data where I created dash lines instead of
David Delene: the sour lines
David Delene: and a note to people that we've been published because
David Delene: lot of people can't see the difference between different colors.
David Delene: And there's different types of color blindness.
David Delene: it's very problematic to use powers to separate data types.
David Delene: So if you use powers, you should use something else also.
David Delene: So you soured and dash
David Delene: use different symbols.
David Delene: So don't just depend on power.
David Delene: Because if you try to get good cow powers, there's no such thing as I understand it.
David Delene: because one works for one type of color blindness. But there's many different types. So it's best to use multiple things to differentiate your types of plots.
David Delene: Okay,
David Delene: let's say, here we can
David Delene: select different countries.
David Delene: And maybe if
David Delene: I'll
David Delene: so 2 countries worth of data.
David Delene: so Gdp, Australia.
David Delene: it's t aught
David Delene: a LIA equals data. LC.
David Delene: Extract that Gdp, New Zealand and Z, because New Zealand's too long to spell
David Delene: extracting the data here.
David Delene: bought the data
David Delene: years of data. Gdp, Australia.
David Delene: BRA.
David Delene: And then we'll put this in. Blue.
David Delene: went on dashed.
David Delene: And when we put a label on, this
David Delene: would do another part of the data
David Delene: years. Gdp.
David Delene: New Zealand.
David Delene: Let's do this one in green
David Delene: label.
David Delene: and then let's create a legend.
David Delene: We'll put the location of the legend up for
David Delene: left.
David Delene: So this is very high level, right? We just specify upper raft as opposed to an XY location.
David Delene: Our vision is, gonna be a year.
David Delene: Wow.
David Delene: a label. Actually, it was going to be year.
David Delene: A Y label
David Delene: will be Gdp per cap.
David Delene: Okay, select 2 countries. We got the data that we selected worth of data.
David Delene: We brought up the 2 data at different colors.
David Delene: we can put a legend and
David Delene: thoughts on that.
David Delene: And I got this one wrong.
David Delene: They all look right. No.
David Delene: Gdp.
David Delene: I spelled that wrong some phrase.
David Delene: G
David Delene: the
David Delene: B.
David Delene: And what else? I'm misspelling wrong. Gdp.
David Delene: Gdp, Bd
David Delene: E.
David Delene: Days.
David Delene: Thank you.
David Delene: Oh.
David Delene: so yeah. Tell me, what's
David Delene: Gdp, Gdp near 0. And but Gdp, Australia, but
David Delene: Gdp, Nz.
David Delene: Wonder
David Delene: both are the other.
David Delene: Oh, yeah.
David Delene: and to the
David Delene: okay, that one's done. But I think on my line 6. I still have
David Delene: but years
David Delene: building rush all in.
Jim Cooley: Does label? Does the Ellen label need to be lowercase.
David Delene: Okay.
David Delene: Okay, let's see. But oh, got another
David Delene: problem here.
David Delene: Hey? Only 3 mistakes. So this is why
David Delene: you don't write.
David Delene: What is that 8 lines of code.
David Delene: I cannot write 8 lines of code without make a mistake
David Delene: and write about 2 lines.
David Delene: so test it as you go.
David Delene: So
David Delene: we added a legend here.
David Delene: so
David Delene: so that this regime could be done. 2 rays
David Delene: provide a labor for each data set in the figure
David Delene: and then you initialize legend
David Delene: or
David Delene: on the data figures. And see, I'm trying to think of what the 2 ways are here.
David Delene: or 2 separate stages. Sorry
David Delene: you define what the legends is, and then you add the legend.
David Delene: So this adds the legend here to the plot, and this defines
David Delene: what the legends are above
David Delene: with the labels. So these labels are used in in the legend.
David Delene: because if you do the part here, you're saying, well, what's in the ledger, and it comes from the labels.
David Delene: You don't have to put the location and specify where it is. It'll it'll go and find a good place for the legend by a
David Delene: automatically, but
David Delene: lot of times you do that
David Delene: because you don't have to specify
David Delene: the plot legend.
David Delene: If you want. I think you can just do
David Delene: do something like that and it'll work the same because this happens to put the plot in the upper left.
David Delene: okay,
David Delene: so that's the time series data scatter plots.
David Delene: We can either use a plot, scatter or data frame plot, scatter.
David Delene: So let's plot some scattered data here.
David Delene: you know. See? Scatter!
David Delene: Gdp.
David Delene: there we go. Just make
David Delene: a
David Delene: scatter part of the data
David Delene: very easy.
David Delene: Just plot your X versus your y.
David Delene: see how
David Delene: the increase of one data frame goes with another data frame
David Delene: or not as variable
David Delene: and we could transpose and plot. The data.
David Delene: I see that
David Delene: data transpose this is another
David Delene: bought
David Delene: scatter
David Delene: X equals.
David Delene: So
David Delene: you can do a plot of the data.
David Delene: You transpose and import
David Delene: brought in the data
David Delene: as a scatter plot in the same one. So remember, these are methods that we're calling.
David Delene: And they're part of the built in function.
David Delene: okay.
David Delene: Russ,
David Delene: have you work on an example here?
David Delene: And
David Delene: I put this in a chat and I got a
David Delene: paste it. So remember from yesterday.
David Delene: We had a
David Delene: code in example.
David Delene: And the idea is, you have to
David Delene: where I have the underscores you have to fill in code.
David Delene: Okay?
David Delene: So we want to
David Delene: do minimum maxima.
David Delene: So what you need to do in the above
David Delene: is
David Delene: is to fill in
David Delene: They're in the Bronx.
David Delene: To plot the minimum Gdp per capita over time for all countries in Europe.
David Delene: and then to modify that to plot
David Delene: the maximum.
David Delene: Okay.
David Delene: so.
David Delene: And it. Oh, by the way, I gotta change this because this is not flash data. This is slash share.
David Delene: Okay, that's where our data is.
David Delene: And
David Delene: So you want to do the minimum
David Delene: first, st and then you can modify the code to do the maximum
David Delene: or
David Delene: but
David Delene: and put up your green frags when you're done.
David Delene: And for the people online.
David Delene: that's the question is what we do with this code.
David Delene: So you're ready.
David Delene: Okay?
David Delene: Got lunch here already.
David Delene: Alright. I don't see anybody get that done.
David Delene: Everybody's still working on it.
David Delene: I don't see any green flags up.
David Delene: Anybody trying it.
David Delene: People are trying, I think.
David Delene: get my solution
David Delene: need help.
David Delene: Yeah.
David Delene: you need help.
David Delene: I might give everybody help and then
David Delene: want some help.
David Delene: There, we have that line.
David Delene: and the help is data.
David Delene: and if you want minimum.
David Delene: I'm going to put minimum in here
David Delene: and bought the data.
David Delene: and I got a X
David Delene: need a
David Delene: underscore Europe. Huh? Yep.
David Delene: So there's the minimum
David Delene: And then if that was a minimum
David Delene: we can do the same thing and do maximum.
David Delene: Okay? And then we have the other 2 lines here
David Delene: do
David Delene: add in the
David Delene: to add in both of the plots.
David Delene: so minimum maximums are your functions.
David Delene: Go to European data.
David Delene: So you can see
David Delene: how the data would be between that minimum and maximum.
David Delene: Gdp.
David Delene: there's a bunch of ways to do correlation plots, a lot of different plots.
David Delene: But.
Jim Cooley: Hey, Dave, can you scroll up so we can see the code.
David Delene: Yeah, say, go ahead.
Jim Cooley: So scroll up so we can see. Can you make the window bigger or scroll up so we can see the code? Please update.
David Delene: Bigger.
Jim Cooley: No negative, the window, not the text.
Jim Cooley: We just couldn't see the plot in the, in, the, in the code.
David Delene: Yeah, it's hard to see
David Delene: both of them. So.
David Delene: boy.
Jim Cooley: Don't worry about it. I just couldn't. We couldn't see the code because you were scrolled down. Now it's good, just we. It's okay to move on.
David Delene: Yeah. So that's the part in the code. There's 2 parts minimum maximum of the data.
David Delene: And it's holiday.
David Delene: I can maybe make this a bit of a bigger
David Delene: at least on this screen you could see everything then.
David Delene: The last one was to save the figure.
David Delene: So if you want to save the figure?
David Delene: Plt.
David Delene: Save big.
David Delene: My! I'll put
David Delene: DAD. You can use your initials.
David Delene: so that we ought to overwrite them.
David Delene: And then we should have
David Delene: in our data set
David Delene: some place in here.
David Delene: Oh, sorry I was.
David Delene: So then you have a figure here
David Delene: and
David Delene: want to open it up.
David Delene: Open wit
David Delene: image.
David Delene: Oh, not given the image. Did I do something wrong?
David Delene: Maybe the view is not working on this one. It just gives you a prank.
David Delene: They may work on your laptops.
David Delene: I tried to.
David Delene: Oh, it needs to be in the same.
David Delene: So oh.
David Delene: I have to put that probably up in the
David Delene: oh.
David Delene: probably up in here, right
David Delene: there we go.
David Delene: put in the same cell because it doesn't know
David Delene: from the previous cell.
David Delene: So I added that to the end, yeah.
David Delene: good.
David Delene: Oh, the text on it, or
David Delene: Gdp would have
David Delene: that. So?
David Delene: Oh, I
David Delene: phone.
David Delene: or in the image itself.
David Delene: Oh, yeah, I think it's probably cutting off stuff at the bottom.
David Delene: There's probably a box around it that you have to expand. Yeah.
David Delene: So
David Delene: anyway, it is about a lot of things like that. So
David Delene: anyway, we have lunch here. But the key points are
David Delene: map plot web is widely used for scientific plotting at python.
David Delene: You could plot data directly from the Pandas data frame.
David Delene: select, transform the data and then plot it.
David Delene: Many styles of data available. There's a whole graphics. For doing that.
David Delene: And you could plot data sets together. So
David Delene: before lunch here, if you don't mind, and you don't mind your picture being taken. Why don't we go out here in the area
David Delene: kind of right in front here of the
David Delene: just outside them 2 doors, and we could take a picture of everybody.
David Delene: So I can have an idea of how many people are here.
David Delene: You don't want your picture taken. I guess you can go hide in the lunch room. So if you don't mind, and for the people online, I won't take your picture,
David Delene: and I will just stop the sharing, and I will stop this recording
David Delene: and then come back in an hour.
David Delene: and we're convene to go over loops and additionals and stuff, so
David Delene: come back at one.