David Delene: Record to the cloud. I'm recording everybody. This is the afternoon session
David Delene: on the 1st day
David Delene: of 2,024.
David Delene: So someone put in a chat. Can you hear me
David Delene: and
David Delene: try to get the participants to this?
David Delene: Yes, okay. I tried to get the stuff going, and I got the
David Delene: the audio a little bit
David Delene: if I use that.
David Delene: So if everybody's quiet, someone say something I'm on. I can just barely hear you. Maybe
David Delene: Jim or.
Christopher Scott: Say something.
David Delene: Did you hear that?
David Delene: Someone.
David Delene: Christopher? You're muted.
Christopher Scott: Yeah, I was muted a second ago.
David Delene: Okay. I heard you
David Delene: just a second ago. So you're very
David Delene: faint. But I can hear you say good afternoon, or something.
Christopher Scott: Good afternoon.
David Delene: Okay, I could just barely hear you, but I can't get it any louder.
David Delene: And it is coming through there, isn't it?
David Delene: Okay? Somehow it's coming through the ceiling, speakers.
David Delene: But I have you
David Delene: Maxed out, and I cannot find physically how to turn up the volume anymore. So I guess it kind of works. If you guys unmute yourself and shout loudly.
David Delene: the other thing is, I got it recorded. And I need to share the screen.
David Delene: Okay, so
David Delene: online, can you see.
David Delene: did I start sharing his screen?
David Delene: Then it's
David Delene: hit share.
David Delene: sure.
David Delene: Okay. Now, I gotta select the screen.
David Delene: Okay. Now, you should see the screen screen being shared.
David Delene: I got too many windows here to kind of keep track of what I'm doing.
David Delene: And I got the chat window here.
David Delene: Okay, now you can see the screen. Everybody? Yes.
David Delene: and you should have
David Delene: The web browser with the
David Delene: afternoon built in sessions highlighted.
David Delene: Is that good Christian?
David Delene: They're not saying thing.
David Delene: Yes. Okay.
David Delene: thank you.
David Delene: Okay, welcome back.
David Delene: We are going to do
David Delene: built in functions in the afternoon. Here everybody should have
David Delene: data type.
David Delene: I'll save all my tabs.
David Delene: I'm going to overwrite everybody else's.
David Delene: and I'm going to start a new
David Delene: launcher
David Delene: with a new session. So everybody start a new session.
David Delene: and this one is
David Delene: built in functions. I'm going to call it
David Delene: so I'll rename my tab.
David Delene: I'm just gonna call it built in functions.
David Delene: but use different initials than I did.
David Delene: And
David Delene: we'll do that.
David Delene: Okay, questions.
David Delene: how can we use built in functions? How can we find out what it, what they do
David Delene: and what kinds of errors can
David Delene: occur in programs? That's the questions we want to answer.
David Delene: Objectives explain the purpose of functions correctly call built in python functions. Correctly, nest
David Delene: calls to built-in functions, help
David Delene: use help to display documentations on, built in functions, and correctly describe situations which in which, in
David Delene: in which syntax and name and errors occur.
David Delene: So
David Delene: since this afternoon, I'm gonna grab my chair and I'm gonna get tired of standing.
David Delene: so
David Delene: that's the objectives.
David Delene: so functions can take 0 or one argument.
David Delene: arguments are parameters to the function.
David Delene: so we already looked at some of this before
David Delene: in terms of different functions.
David Delene: We did print where we had arguments.
David Delene: So let's say.
David Delene: print statement. Can someone write a print statement where you don't have any arguments.
David Delene: anybody quint
David Delene: so inside the brackets is the arguments.
David Delene: So print with 2 curry brackets. This returns a blank line.
David Delene: so the value is passed to the function.
David Delene: So it's great to always pass
David Delene: values into functions, to arguments.
David Delene: Okay, that's the best way to do it. There are others.
David Delene: but that's the only way you should actually do it most of the time.
David Delene: some take different numbers of arguments. Some of our arguments are optional. So, for example, link link
David Delene: LEN, takes exactly one argument.
David Delene: so some functions like in string flow, create
David Delene: new values from existing ones.
David Delene: When it takes 0 more arguments.
David Delene: Okay.
David Delene: so another key concept is, every function returns something.
David Delene: Okay?
David Delene: if the function doesn't have a useful result to return, it usually returns a special value. None.
David Delene: Okay. So
David Delene: it's like, none is something, because it's an argument. It's something that's always returned.
David Delene: so none is a python object that stands for anything. There is
David Delene: no value of.
David Delene: Okay.
David Delene: So let's assign result.
David Delene: So you can start typing result equals print
David Delene: the example.
David Delene: So now we're signing a the result
David Delene: of this function call
David Delene: to the variable result
David Delene: right?
David Delene: And we haven't looked at that before. And now let's print out
David Delene: without
David Delene: of print is
David Delene: result.
David Delene: And can you guess I just talking?
David Delene: Well, it's in there if I know how to spell. Result?
David Delene: so
David Delene: result of print is none.
David Delene: Okay.
David Delene: that's why I say, every function returns something so print doesn't really have anything to return, because it's to print out the line.
David Delene: so common views functions. Max. Min.
David Delene: our stuff. So let's use some functions. Print. Max.
David Delene: One comma, 2 comma, 3
David Delene: print
David Delene: men of
David Delene: a
David Delene: hey?
David Delene: Okay?
David Delene: So everybody understands the Max of 1, 2, and 3 is 3.
David Delene: There's a list.
David Delene: Can somebody explain how
David Delene: the men of
David Delene: a A and 0 is 0.
David Delene: But these are string characters.
David Delene: How can you have a miniature of a string?
David Delene: But then they all be the same.
David Delene: So
David Delene: yeah.
David Delene: but it's taken a minimum of a a
David Delene: let's try what if I do, men?
David Delene: So you always test things right, man.
David Delene: a comma a.
David Delene: I put 2 in there
David Delene: that gives you capital A,
David Delene: so you're probably not familiar with this, but there's a for every character. There's a equivalent
David Delene: integer value.
David Delene: These are called as CII
David Delene: codes.
David Delene: Yeah.
David Delene: And so it goes by that in that order.
David Delene: So capital letters are before lowercase.
David Delene: So it's the equivalent number of Ascii characters.
David Delene: So there's 256 Ascii characters that are defined, and it uses that minimum assignment of the network of the numbers.
David Delene: So
David Delene: you know you may not understand
David Delene: why.
David Delene: You know the minimum of readers are what they are, but understand that they are. It's a variable, it's a valid function, and you can always Google that
David Delene: you know, that'd be a thing you could put into AI where Google could find that value.
David Delene: oh.
David Delene: will this work, if I mix numbers and
David Delene: strings.
David Delene: how many people stayed out of work?
David Delene: People say it won't work.
David Delene: How many people don't know.
David Delene: so that gives an error.
David Delene: So it's not a supported instance to have both strings and integers.
David Delene: you have a function called round
David Delene: round 3.7 1 2.
David Delene: And why did I do that wrong? Oh, I gotta spell round right
David Delene: so round it up to 4.
David Delene: So this is not like
David Delene: for searing
David Delene: you can do that. Oh, but round takes multiple arguments
David Delene: right round 3 point
David Delene: 7 1 2. Let's put a number in for the second argument.
David Delene: What do you think that second argument number would do.
David Delene: Huh?
David Delene: Yeah, and give you one decimal, that around the 2.
David Delene: So it's the precision of how much you round to.
David Delene: Okay. So some functions that you may think only has one argument will actually take multiple arguments
David Delene: for this. So
David Delene: keep trying to type and keep up
David Delene: with all this stuff. So it makes a lot more sense.
David Delene: so here's the big thing.
David Delene: Functions attached to objects
David Delene: are called methods.
David Delene: Okay?
David Delene: So this goes back to whatever object oriented programming.
David Delene: So without objects.
David Delene: when you don't have objects, you just have functions and variables.
David Delene: Okay, functions and data.
David Delene: Okay, an object contains both data
David Delene: and functions
David Delene: to operate on that data.
David Delene: Okay, so this is very powerful to combine these 2 concepts.
David Delene: And so this is a method.
David Delene: hey?
David Delene: so methods have parentheses like functions.
David Delene: but
David Delene: come after the variable.
David Delene: Some methods are you used internally in python operations.
David Delene: and I mark with
David Delene: the double under
David Delene: lines.
David Delene: So let's create a string
David Delene: called
David Delene: my string
David Delene: equals LO,
David Delene: world.
David Delene: So that creates a string
David Delene: point, the links
David Delene: of my string.
David Delene: Okay? And then with print
David Delene: my string
David Delene: and then swap case.
David Delene: Okay?
David Delene: And then
David Delene: let's do print
David Delene: my string.
David Delene: Dot underscore 2 underscores link 2 underscores
David Delene: like that.
David Delene: Okay? What did I get wrong here?
David Delene: Oh,
David Delene: oh, I put 3 underscores.
David Delene: Yeah, 2 underscores, not 3 underscores.
David Delene: So print the link to my string is 12. We talked about that before.
David Delene: Hello, world.
David Delene: you print that out. But
David Delene: what it prints out is swap case.
David Delene: A swap case is a method
David Delene: to my string object.
David Delene: Okay.
David Delene: so this is very
David Delene: complicated to get your
David Delene: head around what is called an object.
David Delene: which is my string. It's an object
David Delene: kind of like a toy as an object.
David Delene: Okay.
David Delene: and then a method is something you can do with the toy.
David Delene: Right? I'm making this up, but you can pray with the toy.
David Delene: Okay, in this case you could do swap case on that pretty object.
David Delene: Okay? But objects only have certain methods.
David Delene: Right? If you got a
David Delene: toy like a baseball bat.
David Delene: You can't play basketball with him.
David Delene: Okay?
David Delene: Can only use the method to do certain things.
David Delene: So swap case is something that you can do
David Delene: Then you also have certain built in ones like rings.
David Delene: So my string and you do the method
David Delene: that's built into my string
David Delene: to get the length of that.
David Delene: Hi!
David Delene: You ever get that? Any red flags?
David Delene: Okay, yes.
David Delene: All the difference between an object and a variable
David Delene: what's the difference? A variable has
David Delene: a numbered
David Delene: okay.
David Delene: object has both a number and a function.
David Delene: Okay?
David Delene: So I'm defining in terms of the thing. It's
David Delene: a variable. You can just assign numbers to.
David Delene: But a
David Delene: object
David Delene: is
David Delene: something that you can apply.
David Delene: It has both
David Delene: a number
David Delene: which is data
David Delene: and things you can do with that data.
David Delene: Okay.
David Delene: think of a
David Delene: a car
David Delene: is an object.
David Delene: and you can have a value to that car
David Delene: which you could assign
David Delene: a value to it. A number to that car. But you can also do things with that car like drive.
David Delene: Okay, if you can do stuff and do functions on that object.
David Delene: it's a, it's an object, not just a variable.
David Delene: Okay, it's
David Delene: and it won't make sense to you
David Delene: for a long time.
David Delene: But this is the power of object-oriented programming.
David Delene: Okay? And linear programming. We don't have
David Delene: concept of an object.
David Delene: But it's very powerful to mix your functions
David Delene: so that
David Delene: because you don't have to be so generic, then?
David Delene: Right. If if I have a function that has to operate on all types of data.
David Delene: boy, I gotta check. Is it positive? Because, you know, if I'm dividing by 0, you know, there's so many things you can't do.
David Delene: But it's powerful to mix and to be able to write functions. When you know something about the data you're operating on
David Delene: makes it easier to write them functions. If you know something about the data.
David Delene: you don't know anything about the data. It could be anything.
David Delene: You know. Your function only works on whole numbers. You gotta check
David Delene: and see if they're whole numbers.
David Delene: Okay, if you define an object that has a whole number
David Delene: and also some method to go, some function to go with it.
David Delene: then you can.
David Delene: It's more powerful.
David Delene: You need the period to call online. You need the period. Yes, I put the period in there.
David Delene: When you put the period.
David Delene: This is the method that is called upon on that object.
David Delene: I get that right.
David Delene: Maybe, James, you want to close the door so people walking by don't hear us.
David Delene: Just the one here.
David Delene: so functions attached to objects are called methods, so functions and methods.
David Delene: kind of mean the same thing.
David Delene: But the method
David Delene: is a function applied to an object
David Delene: where a function
David Delene: doesn't necessarily have to be applied to an object.
David Delene: Okay?
David Delene: But when a function works on an object and it's called a method.
David Delene: So I think of functions and methods the same.
David Delene: But technically, they're not
David Delene: okay. They basically do the same thing.
David Delene: but functions
David Delene: attached to objects are the methods.
David Delene: Okay?
David Delene: So
David Delene: an object oriented program. And you have objects and you have methods.
David Delene: You don't have variables and functions.
David Delene: Okay, it won't be clear to you. Be very confusing.
David Delene: But let's just go on
David Delene: and I try to just think about that as we go.
David Delene: For this.
David Delene: Okay, let's do a print.
David Delene: My string
David Delene: is super
David Delene: print my string.
David Delene: Upper
David Delene: went my
David Delene: string
David Delene: upper
David Delene: I super.
David Delene: Okay, Scott, and you notice, too, like, here, you see, my parenthes are high right in the ones that they close.
David Delene: So
David Delene: see, this one poses this parentheses, so it helps me make sure I have my
David Delene: witnesses matched up.
David Delene: And what did I get wrong?
David Delene: Oh, I oh.
David Delene: 2 P's.
David Delene: so you can have methods of pride upon methods.
David Delene: so is super false.
David Delene: So
David Delene: this is.
David Delene: prints it out
David Delene: and is super.
David Delene: That means, is it super
David Delene: case? It's all uppercase.
David Delene: and the answer is false.
David Delene: And then I change the string, using the upper method
David Delene: to make it
David Delene: or uppercase.
David Delene: And then
David Delene: I do, is it super?
David Delene: Okay?
David Delene: So you got the string? You applied upper function to it. And then you 2 sorry I'm using my functions and methods
David Delene: backwards
David Delene: or interchangeably. The method is applied.
David Delene: and then we nest the methods.
David Delene: So this becomes very powerful
David Delene: because we can. Nest
David Delene: methods.
David Delene: We use one method on top of another method.
David Delene: Okay, great keeping up red flags
David Delene: type in this
David Delene: type, the data
David Delene: but try to type everything and see if you can keep the
David Delene: So every built in function has online documentation.
David Delene: So
David Delene: instead of just googling stuff. You can actually use some online documentation.
David Delene: So help
David Delene: round.
David Delene: So. And the other thing is, sometimes.
David Delene: if you Google it.
David Delene: it'll give you this back.
David Delene: They give you the help of the function.
David Delene: For that
David Delene: help built in function and
David Delene: module built ins.
David Delene: and then it tells you round
David Delene: is the argument.
David Delene: and this is the digits
David Delene: known as a number. To give the precision into the decimal digits returns a value of an integer. If
David Delene: N. Digits is omitted, or none otherwise returns. The value
David Delene: end dates may be negative.
David Delene: so it kind of gives you a reminder of what this is.
David Delene: Jupiter Notebook says some ways to get help.
David Delene: I'll go over this briefly, because
David Delene: hopefully, just use help.
David Delene: One way is just type
David Delene: name
David Delene: equals
David Delene: what oops.
David Delene: and
David Delene: we forget
David Delene: the ended parentheses.
David Delene: So it says, syntax error on terminated string.
David Delene: Detected at this line.
David Delene: so it tells you.
David Delene: You know where the string is.
David Delene: you can have some other syntax. Errors like age
David Delene: equals equals 52
David Delene: syntax, invalid error.
David Delene: and valid syntax.
David Delene: So
David Delene: You can see that there's expected lines and gives you some information. Decode this where? And they put this with a carrot where you think the
David Delene: error occurred
David Delene: so rent times. Errors are errors that occur while the programs executed.
David Delene: Okay, when you execute the program.
David Delene: age equals 53 remain in equals, 100 minus
David Delene: let's see a I'm gonna spell this wrong.
David Delene: So this is a runtime error
David Delene: is not defined. It occurs when you run the program.
David Delene: syntax errors accord when reading the source code and runtime errors
David Delene: occur by trace and execution.
David Delene: So there's 2 types of errors, syntax errors
David Delene: and rent time errors.
David Delene: Okay? Maybe I can put this.
David Delene: You guys want to do some work.
David Delene: Put this into the chat.
David Delene: and I'll put this on
David Delene: some code.
David Delene: so
David Delene: alright. So there's the code
David Delene: and the questions are.
David Delene: explain in secret terms the order of operations in the following program.
David Delene: When does addition happen? When does attraction happen? When is each function called, etc.
David Delene: What is the final value of radiance?
David Delene: Okay, this is hard, like, almost everybody gets radiance wrong.
David Delene: So people on a chat can tell me what radiance is.
David Delene: And the idea is to look at the code, write it down.
David Delene: and give me a
David Delene: a value.
David Delene: so try not to execute the code.
David Delene: but
David Delene: I get another one.
David Delene: but put down like
David Delene: radiance.
David Delene: Oh, I got my cap locks on, at least give me the end value.
David Delene: Oh, yeah.
David Delene: radius equals. And then I didn't put the right answer in there.
David Delene: So the wrong answer is 2.1.
David Delene: So tell me what the right right answer is. And once you get the value of radians, put up your green frag.
David Delene: and it's best to go through and write down
David Delene: the order of operations run through this code.
David Delene: what happens
David Delene: and then raise your hand, and
David Delene: James and Chris, James and Sean can maybe help you.
David Delene: Yeah, I'm trying to.
David Delene: I'm seeing no green flags yet.
David Delene: I got 1. 0, I got a couple of green frags.
David Delene: Okay, I'll go back.
David Delene: See what your radiance values are. And
David Delene: you can get that right?
David Delene: Okay, can I make a call? Okay? No, I didn't.
David Delene: Both
David Delene: 87
David Delene: might need more time.
David Delene: The answer is 2.6.
David Delene: So I can go over in this
David Delene: show you the 7 steps and copy and paste them
David Delene: oops.
David Delene: I didn't. I'm gonna actually put them into the chat.
David Delene: so this is order operations.
David Delene: That goes through. So
David Delene: anybody have
David Delene: questions.
David Delene: radiance equals 1.0
David Delene: 1 point pi times radius. So
David Delene: you got to the maximum of everything in the function.
David Delene: So that's the maximum. You have 2 parameters, 2.1 2 point
David Delene: 6
David Delene: and
David Delene: yeah, 2.1 2.0 plus this value.
David Delene: And you have to do the minimum to get the minimum of them. 2 values.
David Delene: which is 0 point 6. So 2 point
David Delene: zeroed
David Delene: plus 0 point 6.
David Delene: So
David Delene: and
David Delene: I guess we could print that out and do that.
David Delene: there's some official documentation.
David Delene: Let's see if this still works
David Delene: got a link here.
David Delene: oops.
David Delene: Again, I just like using
David Delene: Google search or some AI type of search.
David Delene: and it probably indexes the documentation.
David Delene: sorry.
David Delene: not copying my website.
David Delene: Copy link
David Delene: copy link.
David Delene: I think
David Delene: I get so mad when things don't copy and paste. Right?
David Delene: okay, I'll do it this way.
David Delene: and
David Delene: let's see here, duplicate tab
David Delene: they might have built in functions
David Delene: and
David Delene: and open this in a new tab.
David Delene: Alright. Finally, I can pull this over.
David Delene: python. 3.12
David Delene: documentation. What's new? They got extensive documentation.
David Delene: I guess I'll show you this that they do. That's probably what the Google and other things do it. I wouldn't recommend reading it
David Delene: but you might want to read some of the
David Delene: documentation of
David Delene: built in functions. You could probably guess what Abs does for absolute value.
David Delene: Ben Bullion.
David Delene: Some of these functions, you probably know power pow.
David Delene: so you could probably guess some of the
David Delene: built in functions.
David Delene: some
David Delene: and stuff like that. So
David Delene: we have that
David Delene: key points
David Delene: use
David Delene: Oh, we didn't. Did we talk about comments?
David Delene: yes, the other thing for a code.
David Delene: You can always write some code like
David Delene: for a comment. You put a number sign
David Delene: So defining
David Delene: I can spell you fine and right
David Delene: about describing
David Delene: errors and
David Delene: methods.
David Delene: So
David Delene: if you have a number sign, you could put that as comments in your code.
David Delene: What you don't want to put in your comments is something like this is a print statement to output to the screen.
David Delene: Okay, we shouldn't define
David Delene: what the function does.
David Delene: Okay?
David Delene: Because you can always type help to find that information.
David Delene: So what you got to think of is the high level. What is going on in this in this code
David Delene: type of things to put in your comments. Not very simplistic things like.
David Delene: I'm defining a variable. No, I'm defining all my variables at the beginning of the code to be used in this program
David Delene: or all parameters that
David Delene: all
David Delene: of values or defaults in this code are defined here.
David Delene: Okay.
David Delene: so you tell it more than I'm just defining variables. I'm defining all my variables. They should go here
David Delene: in the code.
David Delene: other key points.
David Delene: use the help to get help on that.
David Delene: You can see functions.
David Delene: Oh, I think you can also
David Delene: see here there's another way.
David Delene: But I think of the second way to get help with the
David Delene: Hmm!
David Delene: I'm trying to think
David Delene: the tabs.
David Delene: Oh, okay, double Tabs tells you.
David Delene: Hmm.
David Delene: Gives you a whole lot of rest. You can use tabs.
David Delene: I think that completes stuff.
David Delene: I usually just look at the Google to get help.
David Delene: Every every function returns something. Python reports a syntax error.
David Delene: syntax areas get read by reading a source code, runtime error. Get generated when you run the code.
David Delene: Okay?
David Delene: Okay? So that's data types.
David Delene: the end of of
David Delene: of
David Delene: built in functions and help.
David Delene: Okay.
David Delene: so
David Delene: we can do
David Delene: Let's see if we can get to libraries. And maybe we get ahead with reading tabular data
David Delene: and stuff here today.
David Delene: so we can kind of get
David Delene: get ahead for tomorrow. But
David Delene: another 3 min break.
David Delene: Give us a
David Delene: a break here, and I will start setting up for libraries.
David Delene: Yeah, if people need power, there should be power underneath. There you get a day of Thursday.
David Delene: today's 19.th
David Delene: I
David Delene: 1,000.
David Delene: Yeah. But those are all better.
David Delene: You're
David Delene: the food. That's not as we adoption for them.
David Delene: And why did you say it didn't?
David Delene: Yeah, we didn't see it.
David Delene: Foundation
David Delene: that will.
David Delene: hey?
David Delene: Okay, already. Let's get through to
David Delene: our next module here, which is libraries.
David Delene: and I'll try to sit down. Little bit
David Delene: up here.
David Delene: questions, how can
David Delene: I use software that other people have written?
David Delene: Okay, this is most important.
David Delene: So you know, if you start working, you should be using software that other people have done.
David Delene: And how can I find out what that software does?
David Delene: So them are the questions
David Delene: objective, explain what software writers are and why programs create and use them.
David Delene: right programs that import and use modules from the Python Standard Library. So a couple of new terms there import
David Delene: when you want to use a library. I imported something and a module.
David Delene: Okay, anybody know what a module is for software.
David Delene: I showed you what a notebook is a file.
David Delene: So you guys all know what directories and files are.
David Delene: A module is a correction of files
David Delene: that work together.
David Delene: Okay, that's usually a software module.
David Delene: If I'm saying it right. MODU. LE. Module or modules.
David Delene: find and read documentation for standard libraries interactively.
David Delene: Online.
David Delene: So most
David Delene: power of a program. Language is in its margin is in its libraries.
David Delene: Okay? So we're all from different disciplines.
David Delene: And we'll probably all use different libraries.
David Delene: Okay.
David Delene: we're doing some
David Delene: visualizing fluid, dynamic fluid flow.
David Delene: And we have a module, a library
David Delene: of programs that would do that
David Delene: if we're prodding up
David Delene: sound and data for atmospheric science. There's a module that I have. There's a library module that will help you do that.
David Delene: So all these libraries are written.
David Delene: The same thing. That's why I digress here
David Delene: with AI.
David Delene: Okay, if you're doing a machine or
David Delene: artificial intelligence.
David Delene: there's 3 things you need.
David Delene: Okay.
David Delene: one is
David Delene: the software libraries.
David Delene: Okay? And
David Delene: if you go back to this, this is a foundation of mathematics. But they're incorporated into libraries.
David Delene: Okay, you can just call these libraries.
David Delene: Okay, they're already. They're all available in python.
David Delene: Okay? So all the AI type of stuff is there. You got to use it intelligently.
David Delene: But it's been coded. It's been there. So that's 1 thing you need the software, the libraries.
David Delene: The other thing is, you need
David Delene: usually some
David Delene: powerful computers.
David Delene: Okay, because you're using a lot of data.
David Delene: Okay, you want to chop to a lot of of data that's available. And therefore you need a computer, a more powerful computer with Gpus and stuff.
David Delene: Okay, in that case, that's just money.
David Delene: If you want a bigger computer, just get somewhere bigger money.
David Delene: Okay, you pay for that. You can spin up the Google and stuff when they do this. Now, for all the AI people that want to do these like large language models
David Delene: while their access is.
David Delene: they
David Delene: spin up these humongous infrastructures I can't even imagine.
David Delene: But you know they can take resources, for in.
David Delene: you know.
David Delene: you know, 10% of the computer resources on the planet, probably to run one of these large wrangle matters.
David Delene: They can take that and use that for that couple of months. So
David Delene: just need a whole bunch of computer resources.
David Delene: But the critical thing is, you need labeled data sets.
David Delene: That's the hard part. You need the training data.
David Delene: Okay? And everybody knows this. Now, this we're fighting over.
David Delene: Oh, you're training stuff on my data. Wait a second. Where's my cut in that?
David Delene: Okay? So the same thing in science.
David Delene: right?
David Delene: There's tons of people that run the convolution neural network on your image data
David Delene: to decide. If, oh, is this a dog or a cat.
David Delene: Well, someone has to go through and label.
David Delene: These are all images of dogs. These are all images of cat.
David Delene: That's that labeled data set.
David Delene: Okay, that's the hard thing to get.
David Delene: Once you get that.
David Delene: then someone can run it to a cold.
David Delene: Apply these things.
David Delene: But getting that labeled data set is the hard part.
David Delene: So that's why a hundred
David Delene: hire a whole bunch of undergraduates and graduate students create me a nice big label data set
David Delene: for this.
David Delene: So
David Delene: so that's the power of these libraries is we can all share and come up with that.
David Delene: Libraries are corrections of files. These correction of files are called modules.
David Delene: That contain functions for use by other programs.
David Delene: Make may contain also data values, numerical constants and other things.
David Delene: Library contents are supported, supposed to be rerated. But there's no way to enforce that. So you're supposed to
David Delene: kind of keep a module
David Delene: altogether.
David Delene: So.
David Delene: For example. You know.
David Delene: I have my airborne data process and analysis package. Well, I change it from aircraft to airborne.
David Delene: because I want to use uas
David Delene: and balloons and everything. However, now I started doing surface measurements like I showed at launch.
David Delene: well, it's not airborne anymore.
David Delene: So
David Delene: that module concept has become whatever I want to put in it.
David Delene: So there's no restrictions on the the scope of the library, but they should be rerated.
David Delene: But there's no way to enforce that.
David Delene: So.
David Delene: you know, do I create a new module that's not airborne and create one that's surface.
David Delene: I could. But that's work.
David Delene: So anyway, good libraries are rerated.
David Delene: Many libraries are in a python package index. So I want to put my Adpa
David Delene: program in
David Delene: I pi
David Delene: python package indexer, and then it's very easy to install with Pip. It's an installer.
David Delene: So I've been meaning to do that for 6 months, and I didn't
David Delene: decide to spend time on it this weekend, but you could do that, and then you can easily get all these libraries.
David Delene: So a lot of people do that. And that's
David Delene: what I'm working on with some of my colleagues, some of my former students. We're having a race to see who gets their project in the
David Delene: python modules 1st to import them. But it's very easy then, because anybody with python can then download the data
David Delene: or the the module
David Delene: so programs must import the library before using, just like the variables are defined before using. Okay.
David Delene: So you use import to do that.
David Delene: and you can import part of libraries if you want to. So let's go through and import our 1st library.
David Delene: Import math
David Delene: and Brent I
David Delene: I is
David Delene: math dot pi
David Delene: grant.
David Delene: Cosine, I
David Delene: is
David Delene: math dot cosine math dot pi
David Delene: hi
David Delene: so import math that imports the math library.
David Delene: So try to type that import math.
David Delene: We import the math library
David Delene: as part of the math library. There's a constant called Pi.
David Delene: since we don't all remember it. Our pi is 3 point (141) 592-6535,
David Delene: 5, 8, 9, 7, 9, 3
David Delene: And if you ever want, I mean, there's people that minimize pi to like
David Delene: hundreds of decimal places.
David Delene: Okay?
David Delene: And there's tricks of how they do this. And there's actually a competition. How you remember things.
David Delene: So you want to play games, you can become a
David Delene: person that minimizes all these numbers.
David Delene: and then so math dot pi.
David Delene: that will give you the value of pi.
David Delene: Remember now.
David Delene: we're importing a object. A math is an object that has both.
David Delene: Can have both. The vibrate can
David Delene: have both a numerical values
David Delene: and can have functions.
David Delene: So one of the functions is cosine.
David Delene: And this is really nice because you got pi, and what's the cosine of pi
David Delene: is minus one.
David Delene: Is that right? Remember your sines and cosines
David Delene: sign up high.
David Delene: You could probably put that in right.
David Delene: You just change the cosine to sine. So some of these things all make sense.
David Delene: Any red flags.
David Delene: Hold up your red flag. If you have
David Delene: anything
David Delene: to get help with this help. Math.
David Delene: Okay. Gives you a URL reference gives you the functions. So here's all the functions.
David Delene: I'll co-sign.
David Delene: Inverse of
David Delene: hyperbric cosine.
David Delene: ox sign
David Delene: or tangent tangents.
David Delene: cube worth of X.
David Delene: Okay.
David Delene: Keyword and functions.
David Delene: Oh, ut order. Hmm, binomial coefficient.
David Delene: Okay?
David Delene: Well, we won't read through all them. But they alphabetize. And you see, there's a whole long list
David Delene: of what they are.
David Delene: And
David Delene: you know you could probably figure out pow pow
David Delene: has given this
David Delene: extra power y gradients
David Delene: a lot of useful math functions.
David Delene: They give you data.
David Delene: Give you a es infinity, not a number. Pi and Tau.
David Delene: Okay, anybody is very good at math. Tell me how Pi and Tau are we rated?
David Delene: I think it's through the exponent, but I think all 3 of them are rated. Anyway.
David Delene: That gives you the help for the math functions.
David Delene: If you want, you can import
David Delene: specific parts of a function. So
David Delene: from math
David Delene: import.
David Delene: cosine and pi.
David Delene: When post oops.
David Delene: Cosine, I
David Delene: is
David Delene: cosine. I,
David Delene: okay, so
David Delene: this gets really confusing when you can do all kinds of different things
David Delene: when you import stuff, lot of fun, a lot of flexibility in what you can do.
David Delene: But it's from the library, and the parts that you want to import keeps your program smaller. If you don't import the whole library.
David Delene: Okay, you can also do aliases.
David Delene: If MATH. Is too long for you to type.
David Delene: heaven forbids we can import
David Delene: math as M
David Delene: and print cosine. I
David Delene: is
David Delene: M. Cosine, MI.
David Delene: Okay.
David Delene: so there's a few things like map out web
David Delene: that people know very well, and map about web is a little bit long.
David Delene: so it makes some sense.
David Delene: But you can use aliases in that sense.
David Delene: so like, I said, map hardware is typically imported as Mpl.
David Delene: okay.
David Delene: let's have you do some work.
David Delene: and I'll put this in. And people online can put it in the
David Delene: and the stuff. And you guys in in my chat, and you guys can
David Delene: see if you take down your frags
David Delene: and let's see if you can get this one.
David Delene: what function?
David Delene: So you could put it in your module.
David Delene: you know. Write down a raw one.
David Delene: What function?
David Delene: From the math module. Can
David Delene: you use to calculate a square root without using sqrt.
David Delene: okay.
David Delene: So
David Delene: how do you find the square root of a number
David Delene: using a math function
David Delene: without using sqrt.
David Delene: okay?
David Delene: And then explain why Sqrt exists when math has this?
David Delene: Okay?
David Delene: So everybody got that.
David Delene: Maybe I go up here.
David Delene: So
David Delene: write down your thing, put up your green arrows when you get
David Delene: what function and how you calculate the square root of a number.
David Delene: He's in a math library. So look through all the libraries that I sent you.
David Delene: and
David Delene: find that
David Delene: I'll see if anybody on mine is paying attention.
David Delene: I sent the question out to you.
David Delene: And
David Delene: oh, I did send it out now that's the questions
David Delene: in a
David Delene: stuff on my time.
David Delene: Put up your
David Delene: red flags if you want some help.
David Delene: What function from the Math library? Can you use to calculate its career work without using Sqrt.
David Delene: See some green crags and not seen any red flags.
David Delene: the greeting one.
David Delene: We wait, guys, while we await.
David Delene: Yeah.
David Delene: who wants to answer the question
David Delene: about someone in the middle here
David Delene: Dave's firing?
David Delene: no one wants to say it.
David Delene: Oh, somebody has the red one.
David Delene: What is it?
David Delene: Pow? Pow? Okay, so what's the command to use? Pow?
David Delene: Okay.
David Delene: yeah. And
David Delene: not being able to experience.
David Delene: Yeah, so it would be, Paul.
David Delene: and it's XY, so your variable X.
David Delene: So if I had x equals 9,
David Delene: I'll
David Delene: of 9. And then 0 point 5
David Delene: right?
David Delene: And I have to actually print
David Delene: how?
David Delene: 9.
David Delene: Okay? So square root of 9 is 3.
David Delene: And so it's raised to the power one half. So that just goes back to the function of the square root.
David Delene: Yes.
David Delene: a I star. That's what happened.
David Delene: Yeah, you can do that. So why does Sqrt then exist? If I can do so you can do sqrt.
David Delene: 9.0.
David Delene: Did I do that right?
David Delene: Well, it's not defined.
David Delene: Don't.
David Delene: I gotta do math dot dot right
David Delene: there you go. Sorry.
David Delene: So you got Sqrt.
David Delene: I'll keep overwriting. Someone has my file name again.
David Delene: Why do we have that? It's more for readability?
David Delene: Okay?
David Delene: So
David Delene: the overall auction programming in science and atmospheric science for people
David Delene: is readability
David Delene: understandable.
David Delene: We do science where people understand it and be able to read it.
David Delene: Okay.
David Delene: so there's different philosophies of how you can program.
David Delene: You can program for speed.
David Delene: make it execute very fast.
David Delene: not important to me. I don't care if it takes 10 min or 10 min and 30 seconds.
David Delene: You know
David Delene: what you want to do is be able to read the code.
David Delene: Okay.
David Delene: I've also argue about computers and don't get me started on this. But I don't care about computer security.
David Delene: It's usability of computers. I need to use the computer not have a secure computer.
David Delene: Okay?
David Delene: So people come back and say, we need to do this for security.
David Delene: I say, I don't care.
David Delene: Okay.
David Delene: because
David Delene: I'm not working for the Department of Defense Navy, where everybody is caring.
David Delene: He and
David Delene: my research
David Delene: is not
David Delene: there that I care if anybody comes and steals it.
David Delene: then you can say people will just break into your computers.
David Delene: I have everything backed up. I have redundancy.
David Delene: I rebuilt my entire system last week. I can back up everything you need backups.
David Delene: Please keep backups of all your data.
David Delene: Okay, one into Shawn. I think I've won this. And and James
David Delene: I've gone to reading my students entire Directory like a month before they graduate
David Delene: all their work.
David Delene: I told him. You have a backup, right?
David Delene: And luckily they said, Yeah, I backed it up last week.
David Delene: Alright good. This is a reason to do it.
David Delene: Okay, I didn't do it on purpose. But
David Delene: things happen.
David Delene: People will break into your computers. They will write your whole code.
David Delene: keep backups, and if you're going to keep backups, then I don't care about security
David Delene: is, I can always go back to do backups.
David Delene: Okay?
David Delene: So
David Delene: that's my philosophy. So people have different philosophies. When you write code, when you use computers.
David Delene: Okay?
David Delene: And when you're
David Delene: a student, you can
David Delene: follow me until you graduate, and then you can do what you want.
David Delene: So
David Delene: so there's different philosophies and how you write code and different people. So I like readability
David Delene: and usability that trumps everything else.
David Delene: They're like
David Delene: 10 different
David Delene: ways. You can optimize code, and they all go with and without them
David Delene: and
David Delene: stuff.
David Delene: So
David Delene: I keep trying to do that, readability is the most important. Okay,
David Delene: next question. Locate the right module.
David Delene: I want you to find a module.
David Delene: That
David Delene: where we have a number.
David Delene: let me make this raw.
David Delene: What is select the random vote character from
David Delene: base
David Delene: bases
David Delene: equals a, CTT,
David Delene: GCTT, GAC,
David Delene: these are DNA based sequences, I believe.
David Delene: But we want to come up with a random
David Delene: character from this string.
David Delene: So how do you find that out?
David Delene: Okay.
David Delene: we want to come up with.
David Delene: Do the following
David Delene: oops.
David Delene: I got a copy.
David Delene: you know, so right on your screen.
David Delene: which standard module would you use.
David Delene: or it could help you for this, which function
David Delene: would you use? Select? They can use
David Delene: help. You can search. You might just Google it.
David Delene: you know, Python, select random characters put into Google that probably help
David Delene: which function would you select
David Delene: from that module
David Delene: all the alternatives write a program that will use that function.
David Delene: So write a program to come up with
David Delene: a random variable for this.
David Delene: And oh, by the way, you could do this in 3 minds. Okay.
David Delene: so take down your green frags.
David Delene: See who gets the
David Delene: gets this solved first, st
David Delene: and I probably put this in
David Delene: and some people got questions.
David Delene: Let me put this in chat. Oops
David Delene: can't get this in the chat right?
David Delene: Oh, well.
David Delene: which modules, and then the base function is this
David Delene: so?
David Delene: basis equals
David Delene: a CTTG, CTTG, a, C.
David Delene: And we want a random character
David Delene: from this string. Okay.
David Delene: they got any questions.
David Delene: Yeah, you can know that this is just a random one, all of them.
David Delene: just random of each individual character element
David Delene: or the
David Delene: it's simple.
David Delene: Let's try it.
David Delene: Yeah, Google, search it.
David Delene: Python Random.
David Delene: you can. Just okay. You got the answer already. That's a pretty.
David Delene: So this is when you would start doing with a program. Right? You want to come up with something?
David Delene: So the idea here is, I'm teaching you
David Delene: not how to solve specific problems, but where to go for
David Delene: and learn how to write specific code.
David Delene: There's a lot of times we have to do like random stuff.
David Delene: Come up with a random number.
David Delene: Okay.
David Delene: so
David Delene: remember, the end result is not getting. The program is finding out what method it is
David Delene: that you go through and do this.
David Delene: Yes.
David Delene: first, st
David Delene: they're
David Delene: on our website. But you can just Google background, Google
David Delene: title like where you spread out. And also
David Delene: or I would just put in Python random random character
David Delene: and stuff. So
David Delene: way back, when I
David Delene: I taught a programming class.
David Delene: and one of my comments was a criticism of the professor. All he did was teach us how to Google.
David Delene: And the student was criticizing me. And I'm like, Well.
David Delene: great! You've earned the context of the class. What do you could.
David Delene: you know?
David Delene: And that was the point of the class. It wasn't teaching you to remember to cut the syntax and the actual
David Delene: cold
David Delene: of what it is.
David Delene: Because why, remember
David Delene: all these? Strenuous facts?
David Delene: Anybody remember the miracle rate of hexane
David Delene: are a chemist in here? What's the mercury rate of hexane
David Delene: that was on my freshman chemistry class.
David Delene: Anybody. We wrote that.
David Delene: Someone's a chemist.
David Delene: I remember at 69.
David Delene: Now, I gotta come up with the units on that marker. Wait.
David Delene: But
David Delene: why do we need to do that? You can Google Mercury of Hexane?
David Delene: Marcos is checking to see if I'm right.
David Delene: Go ahead and check and see?
David Delene: yeah, so.
David Delene: But
David Delene: you know, we want to just go and learn how to find these things.
David Delene: and that's why a.
David Delene: that's why ais and programming the Ais won't take away from the programmers.
David Delene: They already Google, everything they already do that
David Delene: system and admins they Google and find all kinds of solutions to everything.
David Delene: So it's known what to Google
David Delene: and what to use and how to use the assistance.
David Delene: Yeah.
David Delene: it is.
David Delene: I thought it was 69, Christopher Scott says, I'm wrong. It's 86,
David Delene: I think that's a top amu that's atomic mass units. I want. Mark. Your weight.
David Delene: Microwave is like grams per mole. Am I?
David Delene: Come on, I remember. Like 40 years ago.
David Delene: Oh, 30 years ago.
David Delene: Chemist?
David Delene: Yeah, we want to want random character.
David Delene: Yeah, just a different unit.
David Delene: Yes, atomic weight is just a different unit.
David Delene: So I I think I had mine in Grams per mole.
David Delene: Sorry I don't remember my freshman chemistry that well.
David Delene: so there's so much you need, you can look up and stuff.
David Delene: and you spend your time looking at.
David Delene: and that's how you bypass things working at a different
David Delene: field.
David Delene: we got any physicists astronomers in here? Yes.
David Delene: couple.
David Delene: there's someone from physics.
David Delene: So you know, Richard Fryman is.
David Delene: So when he was an undergraduate freshman.
David Delene: He
David Delene: took an upper level biology class, and he went to the library
David Delene: is looking at the
David Delene: and that structure of
David Delene: I don't like it.
David Delene: The human cells, or something human body or something something that all basic biologists have in their freshman year.
David Delene: But he didn't know it because he never took the class, and he just went to the library and looked it up.
David Delene: So that's how you can go and sidestep all these knowledge.
David Delene: That you kinda
David Delene: and get in the classes and what it is. If you need to jump into another field, just go look up
David Delene: the information.
David Delene: okay.
David Delene: anybody got red flags. Got green ones.
David Delene: okay. Solution. Anybody come up with random. Yes.
David Delene: So here's my solution from random
David Delene: import.
David Delene: random range
David Delene: and I
David Delene: random index. We want the index.
David Delene: We take the length of the basis. Remember, we had rent before
David Delene: and print
David Delene: and then we subscript
David Delene: the values
David Delene: alright. So I did it with T.
David Delene: So I import a random random range. That's what I'm using, getting a random index value here.
David Delene: and then I take the basis of what I have
David Delene: and put in that index value.
David Delene: and if I keep running it, I get TA
David Delene: he again.
David Delene: He, someone point out me that T is more prevalent.
David Delene: I got a lot of t's that comes up a lot of times. A
David Delene: comes up a lot.
David Delene: So
David Delene: how many you?
David Delene: I got a couple of them that came up?
David Delene: Yep, there's other ways to do this.
David Delene: you can also put them together. I put random index.
David Delene: You could put it more compactly
David Delene: to print it as one statement.
David Delene: and go back. I go back and
David Delene: hit the values to do that.
David Delene: this random sample function, someone online, point out random choice.
David Delene: There's different
David Delene: methods in random that you can use.
David Delene: Okay.
David Delene: here's another one
David Delene: that I give you part of the code.
David Delene: Some people like to do this in terms of
David Delene: like
David Delene: Oh, wait!
David Delene: Oh.
David Delene: gonna do this as a raw.
David Delene: So we want you to rearrange this code.
David Delene: And so we're gonna do a couple of these.
David Delene: not
David Delene: all the statements may be needed. Feel free to use and add intermediate variables.
David Delene: and stuff.
David Delene: And here's the code.
David Delene: and you've got to change the code. I'll put this in the chat
David Delene: or the people online.
David Delene: There. I get it. And I put it on the screen for the people here.
David Delene: so I get an error.
David Delene: you? So these underscores here?
David Delene: Okay.
David Delene: you got to put these lines in. But you got to add in, what do you need here?
David Delene: Okay.
David Delene: So wherever you see the underlines, you got to add cold.
David Delene: Okay.
Jim Cooley: Hey, David, can you scroll up so we can see that
Jim Cooley: question.
David Delene: Rearrange the following statement, so that the random DNA base is printed.
David Delene: and it's index in the string.
David Delene: Not all statements are needed.
David Delene: Hence, let's say, hint to this one.
David Delene: Oh, and then you gotta rearrange the code.
David Delene: Yeah.
David Delene: Hence. Stuff that you should always import your libraries at the beginning of your code.
David Delene: Rearrange to code print statements will always be at the end.
David Delene: And what what would the code be.
Jim Cooley: I'm not following this. So so the code that you have on line 21 there is
Jim Cooley: scram is scrambled and some lines we don't need, and we're supposed to reorder them and then discern
Jim Cooley: what code
Jim Cooley: we need, and then also fill in the blanks. Is that the task.
David Delene: Yes, you have it right? So the 1st part would be
David Delene: import math.
David Delene: import
David Delene: random.
David Delene: So these are always at the beginning a cold.
David Delene: So we we want to rearrange it so that
David Delene: you do the imports always first, st
David Delene: then usually base.
David Delene: And this way, I just
David Delene: so there's a couple of things you need to do.
David Delene: So what mine comes next.
David Delene: So of the next 2 lines. There they may be in long order or not.
David Delene: So
David Delene: this has an idea of trying to
David Delene: figure out
David Delene: what makes sense and how you do stuff is a
David Delene: you know, we usually don't do this
David Delene: to
David Delene: much. It's more of a academic exercise.
Jim Cooley: I I don't know, David. I I went to college. I swear I'm just not understanding the question here. So that a random DNA base is printed.
Jim Cooley: But what? What?
Jim Cooley: Well, help me out with this DNA,
Jim Cooley: when, when all of a sudden, are we talking about DNA?
Jim Cooley: Oh, can can you teach us more.
David Delene: Yeah. So the idea is, what do you put on this underscore?
David Delene: So
David Delene: you want to define something
David Delene: so linked is base linked up base is the
David Delene: idx
David Delene: would be added in for the length
David Delene: of the basis, for example.
David Delene: And then what what would be in how would you change this line.
David Delene: What did I do that wrong? I did that wrong.
David Delene: Sorry
David Delene: this one should be n basis.
David Delene: I can't even do it right when answers in front of me. So
David Delene: and then how would you?
David Delene: Because you have the random?
David Delene: What would go here?
David Delene: It doesn't matter, I mean somewhat depends on what you put in this last line, too? Right?
Jim Cooley: Hey, I I'm fine with being behind and lost, David, but maybe I'm not the only one. I am not following this this task.
Jim Cooley: and I don't understand what we're doing.
Jim Cooley: If if I am the only one, then I'm totally cool with just
David Delene: Does everybody else understand that someone can explain?
David Delene: No one wants to say
David Delene: yes.
David Delene: So this is the 1st time we did this.
David Delene: So we need to put in.
David Delene: How do you write a program?
David Delene: So if I want you to write a program.
David Delene: the statements so that the you want to get out of this program. A random DNA base is printed.
David Delene: So you want to print out the random base at the end here.
David Delene: So this needs to be the random base.
David Delene: You need to print that out.
David Delene: and
David Delene: you need to print out
David Delene: is indexed in the string.
David Delene: So you have to know what an index of the string is.
David Delene: and you have to print that out.
David Delene: So where is these underscores? Are
David Delene: you have to put in code.
David Delene: You have to put in variables
David Delene: to write the code. So I wrote
David Delene: most of the code for you.
David Delene: What are the last 2 lines
David Delene: of the code?
David Delene: We got questions in the back. Yeah, go ahead.
David Delene: You want me to come back
David Delene: right there.
David Delene: Bonus.
David Delene: You want to print both of them all at the same time. That's what I mean. So
David Delene: you want to use this line of code right here.
David Delene: Okay.
David Delene: say you.
David Delene: you have a print here.
David Delene: But where you see these underscores, these underlines.
David Delene: You want to put in your code.
David Delene: Yes.
David Delene: yeah. So you want to put in both the random DNA base.
David Delene: So that's the random base here
David Delene: and is indexed in the string.
David Delene: One print statement. So I think I saw it both on yours.
David Delene: But you need to combine it as one.
David Delene: Okay, that was the idea.
David Delene: So has anybody ever done this? Or, Oh, my God!
David Delene: Program across
David Delene: not too many programming classes? This will like be a
David Delene: academic exam like, instead of giving you here, write this whole code.
David Delene: it's add in
David Delene: part of the code.
David Delene: Okay.
David Delene: so you're writing 6 lines of code.
David Delene: So the idea is, when you start doing this, start at one line at a time.
David Delene: get the 1st lines to to work.
David Delene: And I gave you the 1st
David Delene: or lines.
David Delene: Yeah, so, my God, you got it right
David Delene: nice.
David Delene: right? Correct.
David Delene: central language.
David Delene: But we haven't yet.
David Delene: Oh.
David Delene: it's gonna be the same variables, right? N basis and n basis, but you assign the same variable here.
David Delene: You should have 2 different variables, because, Nbase, you may use an end base to as a variable to represent.
David Delene: So change one of the variables and the second one.
David Delene: Yeah.
David Delene: So
David Delene: the other
David Delene: programming tip
David Delene: is never, ever in your code
David Delene: use the same variable name
David Delene: to represent
David Delene: 2 different things
David Delene: in the same code.
David Delene: So you take a variable like, X,
David Delene: don't have it represent
David Delene: length and
David Delene: height.
David Delene: You know one part of the code, it would represent length. The other part. It would represent height.
David Delene: always use different variable names to represent different concepts.
David Delene: and this seems to be explicit. But when you get long cold
David Delene: it it
David Delene: could do that.
David Delene: Even loops like if you loop in with I's and J's and K's.
David Delene: If you habed
David Delene: different loops, use different variable names.
David Delene: So never use the same variable name to represent more than one thing in a code.
David Delene: And that's not not something that's enforceable.
David Delene: yeah, we're just piecing the code together.
David Delene: Okay, I'll give you my solution. Here.
David Delene: do idx here. And then the final one is print
David Delene: random base
David Delene: bases index.
David Delene: So I think you just need one
David Delene: value.
David Delene: Base seed index is 10.
David Delene: So just one. I think someone had like 3 of them for some
David Delene: of them.
David Delene: So the the index of this is 10
David Delene: of where you find a C. So someone asked before, because
David Delene: the values can be in different places.
David Delene: You can get P in multiple places. For example, right?
David Delene: He comes from 2 and 3 a
David Delene: values.
David Delene: So does that kind of make sense. Now
David Delene: what
David Delene: it is I was trying to ask you to do.
David Delene: This is hard to come up with this code when you get
David Delene: part of it.
David Delene: okay.
David Delene: I got a lot of questions. But maybe we could take a break if someone can answer
David Delene: if someone does this.
David Delene: So one of your graduate student friends
David Delene: comes to you
David Delene: and ask you this question. I'm trying to use random like you said you use.
David Delene: and I need some help on it.
David Delene: But
David Delene: when I'm using random, I get this math is not defined.
David Delene: What did they forget to do?
David Delene: Yeah, they forgot to import the library.
David Delene: Okay.
David Delene: you cannot get help on the library until you import it.
David Delene: Okay.
David Delene: you can import what areas is. You can do many other important stuff. But I go over the
David Delene: You should really read the
David Delene: Oh, I'll give you another one.
David Delene: So
David Delene: I'll do another one for math from math import log.
David Delene: And then let's take log of 0.
David Delene: And so the idea is.
David Delene: what type of area error is this?
David Delene: So what if I do log of 0?
David Delene: Will this be a syntax error
David Delene: or a runtime error?
David Delene: Okay? How many people say
David Delene: green is for syntax. Red is for
David Delene: rent time.
David Delene: green or red.
David Delene: okay.
David Delene: green or red red is runtime. Green is syntax.
David Delene: Okay? Anyway.
David Delene: some people update their
David Delene: thing
David Delene: right?
David Delene: math denome error.
David Delene: You get.
David Delene: So
David Delene: this is outside the domain of the function.
David Delene: it receives an inappropriate algorithm.
David Delene: this is a runtime error.
David Delene: You get it. I mean, the syntax of a code is right, but it's rent time.
David Delene: So it's outside of the domain which is only checked at run time.
David Delene: So key points
David Delene: most of the power of the language is in its libraries. And this is one of the biggest things with python. There's lots and lots of languages.
David Delene: Okay?
David Delene: programs. Most important languages before use help to get the context of the languages.
David Delene: You can shorten up the names area stem
David Delene: and you can import part of the languages, and you can do that. So
David Delene: we'll stop there, maybe take another with a quick break here.
David Delene: and then we'll go over at least one more module.
David Delene: Because we're in libraries.
David Delene: We'll get to reading some tabular data. That'd be a good
David Delene: thing that hit up at the end of the day here.
David Delene: To make sure we get through. That
David Delene: module is next, I believe.
David Delene: so we did. Built in functions. And
David Delene: let's see we did libraries.
David Delene: We'll read the tabular data.
David Delene: and we'll get some other stuff in terms of
David Delene: pandas data frames brought in
David Delene: for this
David Delene: and stuff. So let's take over the break 5 min.
David Delene: and we come back to one more
David Delene: list of reading data. So that's kind of the basis
David Delene: of python. Now we're getting into reading data and prodding it, which is a little more interesting part.
David Delene: What a break!
David Delene: 2 30 coffee.
David Delene: you know.
David Delene: and also the ideas
David Delene: nice. Oh, yeah, thanks
David Delene: so.
David Delene: or instead of something great.
David Delene: look at this real quick.
David Delene: Yeah.
David Delene: So I didn't figure how to handle this. But
David Delene: anyway, I'll be.
David Delene: Why are you?
David Delene: 4, th
David Delene: we'll have something else.
David Delene: Fantastic.
David Delene: maybe. Thank you.
David Delene: Himself. Dead.
David Delene: or is she?
David Delene: What's okay?
David Delene: And 1, 5, 8.
David Delene: What's 1 user here.
David Delene: Okay.
David Delene: 4 to 2,
David Delene: right?
David Delene: Okay.
David Delene: you know.
David Delene: So yeah
David Delene: in
David Delene: or something.
David Delene: also
David Delene: 30.
David Delene: So
David Delene: so
David Delene: opposite.
David Delene: Oh.
David Delene: bye, bye.
David Delene: right?
David Delene: Yeah.
David Delene: that's all
David Delene: you know doubting
David Delene: while
David Delene: so.
David Delene: and that one piece of healthy
David Delene: think I can.
David Delene: I don't even know
David Delene: and couldn't see how good
David Delene: every animal
David Delene: I mean, all Facebook
David Delene: always want to spend.
David Delene: Sort of all of that case.
David Delene: Go to farms.
David Delene: That's why I got people asking
David Delene: this one's all.
David Delene: However, it's better. I think the term dog. I don't understand.
David Delene: I was talking
David Delene: settled.
David Delene: Wasn't really.
David Delene: I think.
David Delene: yeah, that's right.
David Delene: but
David Delene: and
David Delene: so that we
David Delene: counselor.
David Delene: that's a possibility.
David Delene: There we go
David Delene: same.
David Delene: Okay?
David Delene: But if not, that's good.
David Delene: So it's the 1st one.
David Delene: But anyway, it's not clear.
David Delene: I think
David Delene: California.
David Delene: No, it's
David Delene: period. Yeah.
David Delene: I look at that
David Delene: kind of cool.
David Delene: Okay.
David Delene: yeah.
David Delene: pretty much
David Delene: that already.
David Delene: That's a lot of people.
David Delene: Yeah, I thought, you.
David Delene: you know.
David Delene: yeah.
David Delene: comes in here.
David Delene: They're not getting here.
David Delene: everybody.
David Delene: Yeah.
David Delene: better yourself.
David Delene: Microphones.
David Delene: That's I don't think
David Delene: the answer is more. I should make more.
David Delene: and you have.
David Delene: because they want
David Delene: don't want to thank you
David Delene: like geography, and
David Delene: probably not.
David Delene: I've been.
David Delene: Oh, wow! It's no way
David Delene: people register.
David Delene: Thanks, David.
David Delene: Not too bad.
David Delene: They all stop
David Delene: if I don't have to do one
David Delene: finding airplane?
David Delene: Yeah.
David Delene: or 530
David Delene: absolutely. Yeah.
David Delene: Yeah. I remember what I'm saying.
David Delene: my children, maybe something
David Delene: you guys please record
David Delene: letting me do something
David Delene: they shouldn't.
David Delene: I don't.
David Delene: I?
David Delene: Bye?
David Delene: By the way.
David Delene: yeah.
David Delene: perhaps
David Delene: happy with our model.
David Delene: I think
David Delene: it's interesting.
David Delene: yeah.
David Delene: So yeah.
David Delene: if I don't have to define that. Okay, let's get back. Everybody back online?
David Delene: Oh, a question for the vast problem.
David Delene: oh, sorry I didn't put the question for the last pop in there. Well, I'll forego that
David Delene: And I forgot the question for the last problem.
David Delene: I'll try to put them in there. Sorry I've been
David Delene: we're going to go on to reading data
David Delene: and get through this one before we quit today.
David Delene: And then, if you are not too bored and can survive another day.
David Delene: come tomorrow
David Delene: I start a new one up.
David Delene: Put in your name
David Delene: Rename.
David Delene: and I'm gonna do this.
David Delene: we didn't
David Delene: data.
David Delene: I'll put
David Delene: data frames
David Delene: mine. My initials. So change that to your initials.
David Delene: the date
David Delene: for that.
David Delene: Okay? And then I'm gonna remember to do the markup.
David Delene: Shift, M,
David Delene: and then I'll put in a number sign.
David Delene: and we'll put in the
David Delene: the name of this.
David Delene: So this is where we get
David Delene: into the meat
David Delene: of python.
David Delene: so
David Delene: try to get this in.
David Delene: We'll start here for reading that.
David Delene: So reading, tab your data, data frames. This is
David Delene: how can I read
David Delene: tabular data?
David Delene: and some sense. Just think of, how can I read data?
David Delene: Because in science all of our data should be tabular data.
David Delene: import the Panelist library. So
David Delene: use pandas, load data. A simple. Csv, so that's an acronym.
David Delene: a comma separated.
David Delene: What's V stand for
David Delene: variable. How much separate variables, although I like to use base separated variables.
David Delene: data sets.
David Delene: commas are more universal. Use.
David Delene: Get some basic information about panda data frames.
David Delene: pandas is widely used. Python library for statistics, particular traveler data
David Delene: about features from R. That's a statistical one.
David Delene: 2 dimensional tables whose columns have names
David Delene: and potentially have different data types.
David Delene: So it's nice to have different data types of variables so that you can have data variables that span different types.
David Delene: We're both panelists with Pd.
David Delene: Pd is the areas commonly used for panelists, libraries
David Delene: where we'd comma separated data into
David Delene: a data frame went. Read. Pd read, underscore Csv.
David Delene: and we'll get a data frame as return values.
David Delene: So let's start.
David Delene: Guess what's the 1st thing that
David Delene: to do as
David Delene: someone was saying this before.
David Delene: What's the 1st thing you do when you write a poll?
David Delene: Import the library, so let's import
David Delene: panness
David Delene: as Pd.
David Delene: so
David Delene: hopefully, everybody can get that. One great advantage of having Jupiterhub is. We're all running on the same platform, and I know you have pandas installed
David Delene: because well, I hope we do.
David Delene: We'll have to stop if we don't have these libraries.
David Delene: Oh, you do not
David Delene: use the data, hub and send me your information, Christian or install pandas.
David Delene: If you want quickly.
David Delene: If you don't have it, you can always install it.
David Delene: Either using pip
David Delene: install.
David Delene: If you're on your own system. So
David Delene: use Pip to install.
David Delene: So there's a program called Pep, that lets you install different libraries.
David Delene: and.
Jim Cooley: Came to.
David Delene: You have that everybody had this broken.
Jim Cooley: Download pandas.
David Delene: For me. It should work for you.
David Delene: I'll spell this out. Okay, now, this is gonna be.
David Delene: Let's see if this works. Now, this is going to be
David Delene: so
Jim Cooley: Hey! David!
David Delene: And if you don't know how to do it.
Jim Cooley: Did.
David Delene: This is one reason. Okay, I gotta see if this works.
David Delene: And I'm going to copy and paste this.
David Delene: And I think.
David Delene: I think I need to put in
David Delene: I gotta guess what this is. It's
David Delene: probably share.
David Delene: No.
David Delene: could not find. Let's see here.
David Delene: Oh, shared. Okay. It should be share.
David Delene: Oh, there we go. Okay. So
David Delene: this is one of the things I gotta keep changing because I have data on my
David Delene: one here.
David Delene: So everybody, we are going to read in the same data file.
David Delene: And this is one of the advantages of of doing this.
David Delene: and
David Delene: everybody's ready and everything under shared.
David Delene: What? I'm trying to see this Ga.
David Delene: right here. So these are all the ones.
David Delene: And if you
David Delene: we have G. Geo, we have all these data files, and everybody has these
David Delene: and let me go back
David Delene: and I double click on it
David Delene: if I double click on it. This shows you what
David Delene: the data files like.
David Delene: Okay.
David Delene: so it's 2. Let me get this. 2 rows goes across
David Delene: phones. Go down.
David Delene: Is that right?
David Delene: Okay,
David Delene: I'm going to use it that way. So you got 2 rows here and a bunch of columns?
David Delene: We got 2 countries, Australia and New Zealand. We're oceanic.
David Delene: And this is Gdp gross domestic product.
David Delene: I'm sorry this is not atmospheric science or engineering
David Delene: data, but this is per capita in 1,952.
David Delene: So gross domestic product from that country in different years.
David Delene: Okay?
David Delene: So it doesn't really matter what this data is. But.
David Delene: see, there's a deliminator here. It's comma deliminated. So each one of them goes across and then the rows go down.
David Delene: Okay.
David Delene: just want to show you the data that we're reading in.
David Delene: Okay.
David Delene: does everybody get that? Or you want me to show you more raw data?
David Delene: So typically everything.
David Delene: The easiest type of data to read
David Delene: is
David Delene: Ascii
David Delene: data.
David Delene: and it's eliminated by a variable, and in this case a comma
David Delene: I'm not sure
David Delene: if I can open this with
David Delene: let me see if I can open it. Oh, here we go. I can open it with an editor.
David Delene: and it gives you the actual data that's in there. Right?
David Delene: So this is one line of data.
David Delene: See, the commas are between the data.
David Delene: and we have a header ride and 2 other rides, one for Australia, one for New Zealand.
David Delene: This is what the raw data looks like.
David Delene: and it wraps around.
David Delene: So
David Delene: this is the type of data everything should be in
David Delene: some type of.
David Delene: And then the determinator
David Delene: between the variables
David Delene: is usually a comma
David Delene: and my data format. For historical reasons, we use spaces.
David Delene: Okay, but they could be anything. Coins, semicolons.
David Delene: But comma is the most useful. And then I think space is the second most use.
David Delene: And it's Ascii data, because you can go actually look at it.
David Delene: Okay, this stuff, right? Next, cdf, binary data, compressed data formats.
David Delene: other types.
David Delene: But you can't look at the data. So I like to be able to visualize and look at the data.
David Delene: Instead of just blindly reading it in.
David Delene: Okay.
David Delene: any red flags.
David Delene: any more questions.
David Delene: Alright, this is data you all should have. And
David Delene: we want to use
David Delene: okay, so we read it in with Pan this, and then we should be able to.
David Delene: We looked at the data. But the other thing is just printed out.
David Delene: Brent.
David Delene: data.
David Delene: Okay, so that's the way
David Delene: python prints out the data.
David Delene: This is all the data.
David Delene: Yes.
David Delene: okay. Did everybody
David Delene: not shared with you? Does everybody else read in the shared?
David Delene: But if you put in
David Delene: so you don't see this, if you put this in you? Don't you get an error?
David Delene: Wonder how that's possible?
David Delene: This doesn't have the sheriffin.
David Delene: I'm trying to think of how that's possible.
David Delene: Can you
David Delene: stop, start, stop, and start your oh, I think I know what happened, they added, to share after you started your server.
David Delene: So why don't you go back. I didn't show you guys how to do this.
David Delene: and please don't do this
David Delene: but for you.
David Delene: Go to hub, control panel
David Delene: and stop your server and restart it.
David Delene: and then we log back in
David Delene: to the Jupiter hub.
David Delene: because I think you're set up on the older system before they made that
David Delene: shared.
David Delene: So go to the. And that's how you stop and start your servers.
David Delene: Okay, maybe, Sean, you can help him
David Delene: to kind of
David Delene: the control panel should let you stop
David Delene: the
David Delene: Your version of
David Delene: the Jupiter hub.
David Delene: Okay, don't anybody else do this if you got this shared up?
David Delene: yeah. So
David Delene: because we're all running a a virtual machine. And you might have started yours.
David Delene: Before I had them add in this share.
David Delene: because they didn't have this set up right away.
David Delene: did he?
David Delene: Did it work for you? Then when?
David Delene: Yeah, okay.
David Delene: alright, and that's 1 of the reasons we're using this Jupiter hub. I don't have to give you guys all the files and the data and the biggest thing like
David Delene: I don't know why it takes so long for people to get their master's thesis done. I got my master's data in like February, and I
David Delene: was done with my thesis in July, so I didn't get my theater 6 months.
David Delene: Oh, not here. Sorry I was typing out for someone else. Do they do this import pandas as Pd.
David Delene: No, for my
David Delene: yeah, but not
David Delene: so you'll just have different activities.
David Delene: What else are you building?
David Delene: Oh, let's see. Try
David Delene: try doing this one here, and I'll type import
David Delene: and it's no, not that.
David Delene: Go back now.
David Delene: So make sure when you stop this
David Delene: everybody.
David Delene: and tomorrow.
David Delene: when you run this oops.
David Delene: Sorry.
David Delene: when you're over here and you're creating a new
David Delene: notebook. We have 2 options.
David Delene: Use the second one.
David Delene: and maybe people online.
David Delene: Make sure you're using the second python kinda 2,024.
David Delene: To make sure you get pandas.
David Delene: Okay?
David Delene: So maybe the people online
David Delene: make sure you write in a second notebook, if you can
David Delene: on how to do that.
David Delene: Okay, so you're good on that. Anybody else.
David Delene: Everybody. Because this is big
David Delene: getting your data.
David Delene: 90% of programming problems and issues are just importing your data.
David Delene: Okay?
David Delene: So importing your data,
David Delene: so it doesn't work. Okay, let's see here, you have
David Delene: See? Gotta be 5 ben
David Delene: something.
David Delene: Me go back here.
David Delene: They don't hear it because they will be
David Delene: here.
David Delene: believe there is.
David Delene: Okay.
David Delene: Let's see.
David Delene: Oh.
David Delene: B. As L attribute.
David Delene: And would you.
David Delene: as far as you
David Delene: don't actually be me? Yeah.
David Delene: Oh, it's a underscore. See, there's a dot here. It needs to be an underscore.
David Delene: So
David Delene: so one line of code can throw off everything. So this is an underscore.
David Delene: So if you put that as something different. So this is how you debug everything.
David Delene: So this is why so important to to check this out. And I made lots of mistakes already.
David Delene: so the columns in the data frame. So we're calling this a data frame.
David Delene: I don't know if I like that terminology. But that's what pandas uses.
David Delene: Observe variables and rows are the observe observations.
David Delene: Panis uses backslash to show wraparound rhines.
David Delene: So when you print this out, these are wraparound lines.
David Delene: So that means it wraps around the screen.
David Delene: So that means that this is one continuous line of code.
David Delene: Okay.
David Delene: so using descriptive variables helps so long names
David Delene: percent capital in the year and stuff.
David Delene: Found out, phone is you type the data? Wrong?
David Delene: Alright. So we got that, let's use index of the columns
David Delene: to show specific
David Delene: column values.
David Delene: Okay.
David Delene: go ahead and are 0 and one in this case, because we have 2 of them. You see the 0 and one
David Delene: all your roles.
David Delene: and what we want to do is index by country.
David Delene: Pass the names of the columns to see if he has a index column parameter to do this
David Delene: name. And David Columns tells us which regions that we want to get the data from
David Delene: this is New Zealand and Australia. So oceanic
David Delene: we can do this by
David Delene: okay, I will try to type this in
David Delene: data
David Delene: oceanic
David Delene: and I usually type
David Delene: PDRD s. Underscore. Csv.
David Delene: and then I gotta do slash
David Delene: share. So on my notes. It's it's data. So if I ever put data there, please correct me.
David Delene: GAP. Mine.
David Delene: and then I usually do gross domestic product. Sometimes I do product domestic.
David Delene: I've tripped them around.
David Delene: Oceanic, Csv.
David Delene: So now I'm going to do index column
David Delene: equals
David Delene: hey? Someone else got my name.
David Delene: And I'm gonna say, this is, gonna be indexed by country
David Delene: like that.
David Delene: Okay, so I'm just taking it by country
David Delene: and Brent
David Delene: data.
David Delene: So what I'm trying to do is, we're going to get the data
David Delene: with the column indexed by the country.
David Delene: So we have 2 countries.
David Delene: So we instead of doing zeros and ones, we index it by this country?
David Delene: So country, can be an identifier for the data.
David Delene: It makes a lot more sense to use country as opposed to 0 and ones.
David Delene: right?
David Delene: Hi.
David Delene: okay, people, put up your red flags when
David Delene: you mistyped this
David Delene: and someone can help you get the correct.
David Delene: because this is a long pipe in.
David Delene: And
David Delene: so
David Delene: the past
David Delene: of the data.
David Delene: is slash shared
David Delene: alright.
David Delene: So for the people online, that's the data we're using.
David Delene: make sure you get it right?
Jim Cooley: Hey, David, hey? I got a question about that.
David Delene: Oh, yes, go ahead!
Jim Cooley: So if we've already
Jim Cooley: named it data underscore Oceania.
Jim Cooley: could we? Then, when we're doing this indexing by country, could we then, instead of doing the the read Csv path.
Jim Cooley: could we not just
Jim Cooley: could we not just manipulate data, underscore Oceania.
David Delene: Yeah, is it on here? I'm
David Delene: do. I'm just looking to see. Do we have a data directory here?
David Delene: Oh, because I gotta go back up.
David Delene: I mean, does data work.
David Delene: I mean, you gotta be able to get to the data on the system.
David Delene: But I think he's saying, if you.
David Delene: since we already read it before
David Delene: now, instead of
David Delene: providing them, you can just
David Delene: oh, okay.
Jim Cooley: Okay, I mean, I I could be conflating this with with with our.
Jim Cooley: Where where we've called. We've pulled up the the Csv file.
Jim Cooley: and then we called it Data Underscore Oceana, and I would think that then you could then.
Jim Cooley: manipulate, you know, in our parlance, mutate the data underscore ocean, or thereafter.
David Delene: Yeah, I,
David Delene: yeah, I renamed this country because I was indexing for just a country.
David Delene: So this creates a new data frame.
David Delene: Yeah, he's asking if you so could you read it as
David Delene: data underscore
David Delene: Oceania instead of doing the Pd dot lead. Csv. That you have just said
David Delene: data underscore Oceania Comma Index Column country because you already read it once
David Delene: you just manipulated. Oh, oh, can you go back to this one?
David Delene: I'm not sure
David Delene: I
David Delene: I'm guessing. No.
David Delene: because I think you're rereading the data and differently
David Delene: May. Maybe there is a way to remanipulate the data frames.
David Delene: But I don't think it's like that.
David Delene: So sorry I don't honestly know, but
David Delene: you could probably do it. But I don't know how
David Delene: to manipulate, because you read in the data. Yes, you can change how
David Delene: the data frame is
David Delene: addressed.
David Delene: For
David Delene: and oh, by the way.
David Delene: I don't do this very much in my
David Delene: real life.
David Delene: I don't use pandas very much.
David Delene: We use other methods to read in the data.
David Delene: but this is a very nice way to do it for this type of data.
David Delene: We have a little bit more sophisticated way.
David Delene: But
David Delene: we got a walk before we run.
David Delene: So
David Delene: okay any red flags, no red flags. Okay.
David Delene: we can use the
David Delene: data oceanic info.
David Delene: So this is a method to depend. This
David Delene: module
David Delene: library
David Delene: so in full
David Delene: will tell us what's in there.
David Delene: and you'll see.
David Delene: what is the type of data? It's 64, foot.
David Delene: 64 bit
David Delene: floating point data. There's 2 entry Australia, New Zealand
David Delene: and then his years of data, 1952 to 2,007.
David Delene: So some old data
David Delene: go back up
David Delene: alright
David Delene: and
David Delene: sorry. I'm trying to keep.
David Delene: This is getting a little bit much now, because
David Delene: I can make a little bit smaller, so it's easier
David Delene: to keep more on a screen. We have a lot of
David Delene: stuff with all this data.
David Delene: So what's being displayed when you print this out it, this info is a data frame. There's 2 rows. Name Australia and New Zealand
David Delene: and 12 columns
David Delene: each of which has 2, 64 bit floating point values.
David Delene: We will talk rate about null values which are used to represent missing observations.
David Delene: So I talked about my airborne data process analysis package. One of the things we've done is we use
David Delene: missing data all the time, and it's a core concept.
David Delene: So if you have laboratory, you have a lot of measurements a lot of times. You don't have missing data.
David Delene: What
David Delene: what happens like this morning? I showed that my network was offline.
David Delene: So what happens in that period at 12 Zoo this morning, when I have no data.
David Delene: it's missing.
David Delene: It's not like I can make up that data.
David Delene: It's fundamentally missing data. And you have to incorporate that into a lot of data sets and use that.
David Delene: Okay? And we do this all the time. With our aircraft, we have
David Delene: like 5 different temperature probes. We got 5 different true air speed measurements.
David Delene: Okay.
David Delene: 2. Airsp primary is not working. We go to the backup. We go to the 3rd backup.
David Delene: We need 2 airspeed. So we have 5 different measurements of true air speed.
David Delene: None of them agree. Okay.
David Delene: they agree within within the uncertainty. But they're not all exactly the same.
David Delene: So we had calculations of which true airspeed is being used.
David Delene: And stuff. So things get complicated.
David Delene: This 208 Byte of data and memory that is used to represent this data.
David Delene: okay, what's being presented is data.
David Delene: not a method.
David Delene: Okay.
David Delene: so this is data.
David Delene: That's being presented.
David Delene: it's like math.
David Delene: Pi, it's like pie in math.
David Delene: This is data.
David Delene: Okay, although we use the method with the parentheses to acquire it. It actually is
David Delene: data.
David Delene: It's a member variable of the object.
David Delene: see, here, we can do another print
David Delene: print data.
David Delene: And we can look at columns.
David Delene: Okay?
David Delene: So now we look at the data that's represented by columns.
David Delene: And a data type is an object. Now.
David Delene: okay.
David Delene: because it's part of the data frame for patness.
David Delene: we can do other things called like transpose
David Delene: print data.
David Delene: And we do a T for transpose.
David Delene: And of course, I just had my spelling wrong?
David Delene: okay. So we transpose the data and look at the columns that are transposed.
David Delene: So we got the year the year
David Delene: the 2 countries go down. So got the 2 countries here, and then we got the Gpp. So this might be another way to look at the
David Delene: the data in this type of format.
David Delene: And if someone mentioned online, this is like a matrix, because this is a 2 by 2 data. But it's not
David Delene: generally a matrix
David Delene: in the sense that each one has 2 values in here.
David Delene: But basically like when we represent it like this, it's a matrix in the sense that you got countries on one side
David Delene: and
David Delene: the Gbp for the different years on the other. So this part here
David Delene: going down would be the matrix
David Delene: if you'd like to talk in terms of
David Delene: map plot. Not no map.
David Delene: Matlab.
David Delene: They use a lot of maintenance manipurations.
David Delene: but we like to label the data.
David Delene: And these data frames and data frames are more general than matrixes.
David Delene: So data frames are like matrices. But they're more general
David Delene: and they can contain
David Delene: parameters that I'm of different data types. Matrices are typically only have
David Delene: a single data type
David Delene: and
David Delene: hope that helps you. Christopher.
David Delene: okay, we can get some summary statistics.
David Delene: print data.
David Delene: describe.
David Delene: And I type my oceanic wrong again.
David Delene: So describe the data.
David Delene: Oh, yeah, let's look at this. You have
David Delene: some statistics of the data.
David Delene: Statistics is not particularly useful when you have date 2 data members.
David Delene: But we have a mean, we have a count
David Delene: standard deviation min. Max.
David Delene: and the 2550, 75 percentiles.
David Delene: So not very interesting when you have 2 of these.
David Delene: But if you had 10 or 20, you can get some statistics. But see, it's very easy.
David Delene: You know, it's a very high level
David Delene: language.
David Delene: I read in the data. I'm getting statistics on it
David Delene: with just a couple lines.
David Delene: So it depends what you want to do.
David Delene: Okay.
David Delene: okay, everybody's seen me do enough.
David Delene: Let's have you do something here.
David Delene: reading other data.
David Delene: so
David Delene: alright, let's see if you can do something from these examples.
David Delene: And here's the
David Delene: let me make this raw.
David Delene: So
David Delene: your example, is reading data.
David Delene: And then I give you this file here.
David Delene: It should be in the same directory. But it's a different file name.
David Delene: enter a variable
David Delene: called data Americas and display the summary statistics.
David Delene: Everybody's been watching, paying attention.
David Delene: Okay, take out your frags. I don't see any frags. A few people take down your green frags.
David Delene: And
David Delene: let me know
David Delene: when you get this done.
David Delene: So you want to read in the data?
David Delene: Using what we just did. But we're reading a different data file. Now.
David Delene: the data file is called
David Delene: data Americans.
David Delene: So
David Delene: I'll put this in the chat for people
David Delene: online.
David Delene: Okay, I got that to everybody.
David Delene: And we are reading.
David Delene: So here's our data file. We're going to read this data file here.
David Delene: hey?
David Delene: And I want the summary statistics.
David Delene: Okay, we have a few people getting done.
David Delene: See? Some people in the middle here frantically
David Delene: work in.
David Delene: Oh.
David Delene: oh.
David Delene: we're not mouse.
David Delene: Yeah. Sent my email.
David Delene: Okay.
David Delene: any red flags.
David Delene: no red flags.
David Delene: okay.
David Delene: they do
David Delene: what happened here.
David Delene: know what I did.
David Delene: Whatever. Let me.
David Delene: oops.
David Delene: that's not the right one.
David Delene: Oh, then I gotta put in my right data file.
David Delene: Okay, I got that.
David Delene: And then.
David Delene: okay.
David Delene: everybody get that. You just use the pan. This read Csv, again, change the index
David Delene: the country index
David Delene: and use. Describe to decide the statistics of the data.
David Delene: after you read the data.
David Delene: let's use.
David Delene: Okay, one more exercise and then maybe
David Delene: will be done.
David Delene: Let me put that on something else for you to do.
David Delene: Okay, you read the data file in
David Delene: use help
David Delene: data, America dot, add and help
David Delene: data. America dot tale
David Delene: to find out what these these 2 do. There's a head and tail.
David Delene: So what does this do?
David Delene: What method calls will display the 1st 3 columns of this
David Delene: data, what method call when you spray divasity calls.
David Delene: Okay, so use the help
David Delene: of head and tail.
David Delene: see what they do, and then
David Delene: find a solution.
David Delene: So take down your green frags and do this
David Delene: last one.
David Delene: What's the command
David Delene: to get the vast
David Delene: 3 in the 1st 3
David Delene: of values?
David Delene: Yeah.
David Delene: Christian.
David Delene: yeah, it's probably not waiting right at hand. So
David Delene: deal with all this country.
David Delene: Oh, yeah. Well, you don't have to pay
David Delene: right.
David Delene: I think. Scribe America.
David Delene: Atlanta.
David Delene: Oh, I think I've read it in differently.
David Delene: Did you use the
David Delene: but a previous one?
David Delene: Did you use this index country?
David Delene: Oh, no, no, you pass it before. That's fine. Yeah. So it's how you index
David Delene: the values.
David Delene: So that's
David Delene: and
David Delene: so a lot of this is trial and error.
David Delene: And the other thing is, you can't break anything.
David Delene: Very.
David Delene: So we try it. We ran it.
David Delene: No data there at the time.
David Delene: Okay, data, America is not defined. So you guys will talk
David Delene: we need data.
David Delene: Definitely.
David Delene: Yes. Did you put S on the end?
David Delene: Because it says.
David Delene: and the variables not divided?
David Delene: I'll go back up and copy and paste it out. I think it's probably again.
David Delene: this is that one
David Delene: data.
David Delene: Yeah. So
David Delene: because you know, you got data, America suspension.
David Delene: You didn't read his data. America.
David Delene: we were in the data, America. So usually, it's
David Delene: it's a thing with variables and keeping track of variables.
David Delene: So that's the tail.
David Delene: Yeah. So that's good. Yeah.
David Delene: so that's the 1st 3, and then the last 3. So that's the answer to the last 3.
David Delene: Yeah, it depends
David Delene: all yours. We didn't pay that
David Delene: all sales.
David Delene: Yeah.
David Delene: read, this data would be connects
David Delene: like this.
David Delene: did you include this
David Delene: index country?
David Delene: So yeah, you need to read it with index country to get the country index
David Delene: values.
David Delene: Yeah.
David Delene: okay, with the interest of time
David Delene: I'll go through and show you the
David Delene: answer for the heads to get the 1st 3 use heads, and then N equals 3,
David Delene: and
David Delene: and then likewise for the tail.
David Delene: N equals 3.
David Delene: Oh.
David Delene: oh, wait! Sorry!
David Delene: I'm getting ahead of myself.
David Delene: Heads, tails!
David Delene: There's a script, the data to transpose it.
David Delene: so this is actually transposing the data and
David Delene: ripping the data around.
David Delene: And you could put that together with frip and do the tail together.
David Delene: There's lots of different ways to flip this
David Delene: data and transpose it
David Delene: with the different data directories.
David Delene: So
David Delene: the idea here is to
David Delene: try to read in some simple files. Figure out what you're doing in
David Delene: plot up and look at the data.
David Delene: The whole idea is to look at the data you read in.
David Delene: because tomorrow we'll plot the data.
David Delene: Okay?
David Delene: And then, you know, the plots of the values.
David Delene: will not necessarily make sense on how you manipulate the data
David Delene: and just to
David Delene: for completeness. We're reading in data.
David Delene: If you wanted to.
David Delene: there is a panelist, 2 Csv.
David Delene: that would output the data.
David Delene: If you want to write data files out.
David Delene: We're just interested in reading them. But you can put out 2 Csv
David Delene: to output the data. You can look at help for that.
David Delene: I think that'll work
David Delene: this help
David Delene: on
David Delene: get in the data.
David Delene: Outported.
David Delene: So help on the data how to write that out
David Delene: and stuff. So
David Delene: with that, the key points are appendants, libraries to get basic statistics of the taboo data.
David Delene: Use the index column to specify that a column value should be used as the row header
David Delene: use data frames info to find out more information about the data frames.
David Delene: dataframes.com variables, stored information in data frames.
David Delene: And you can transpose the data. And you can describe the data.
David Delene: So this is one way to easily read in your data.
David Delene: And so with that, it's 4 o'clock, so we can quit
David Delene: and you could just leave your your stuff open. I mean your you don't have to shut it down. You can just close your web. Browsers.
David Delene: Come tomorrow
David Delene: at
David Delene: 9
David Delene: we'll go over
David Delene: the following stuff in terms of
David Delene: plot in the data.
David Delene: and this data frames some more with plotting
David Delene: and stuff. So we gotta do that. And it's some other modules
David Delene: to go over and up, update it in my little thing, what we're doing it for tomorrow. But
David Delene: what can spend a whole day
David Delene: on?
David Delene: that's reading tabular data. We're doing more about data frames plot in
David Delene: so before lunch, we have a couple heavy modules with a lot of data frames, a lot of broaden.
David Delene: Maybe we'll get to some less
David Delene: loops conditionals
David Delene: looping over data sets, writing functions.
David Delene: variable scope
David Delene: and program style. Wrap up, and I'll give you my little own
David Delene: wrap up of this. So
David Delene: all the interesting stuff will be in the morning right away about.
David Delene: we need more data frames, part in the data.
David Delene: and good job making it through the 1st day. And the Jimmy Johns has been ordered for tomorrow. So come tomorrow and you can do that.
David Delene: Okay?
David Delene: and I will try to stop.
David Delene: I think. Oh, and then, if everybody, I think we're just gonna lock this up. So yeah, take your laptops, but you could just leave your cups and frags there. I'm going to leave the frags here.
David Delene: and I'll just take some stuff home. But no one else is coming. No, but take your laptops, leave your frags and cups.
David Delene: and I think I'll leave the stuff over there, too, except for stuff to throw away.
David Delene: I'm going to stop my data share.
David Delene: Stop my recording and
David Delene: see you guys tomorrow.
Jim Cooley: Hey? Thanks, David, I appreciate it.
David Delene: Yes, let me stop this recording
David Delene: stop.