The course is part of this learning path
This course offers an introduction to data science and looks at what a data scientist does. It then moves on to data science in Python and, through a range of guided walkthroughs, shows you how to use Python and its features. You will learn how to set up Anaconda and Jupyter Notebook and learn, using real-world examples, how to write Python code in Jupyter, with useful tips within the context of data science.
The course also looks at object-oriented planning, as well as Python variables and Python functions, and finally, it takes a look at Python data types and functions.
- Understand data science and the role of data scientist
- Set up Anaconda and Jupyter notebooks
- Improve your knowledge of coding with Python
- Understand how to work with Python variables, functions, and data
This course is intended for:
- Individuals looking for an introduction to data science
- Those looking to enhance their knowledge of Python and its features
To get the most from this course, you should already have some knowledge of Python and programming languages in general.
So, what are some of the best bits of advice I can give you when it comes to coding in Jupyter? Well, first of all, the tab key. The tab key is very special, and you should use it as much as possible in reality. It tells you how everything works. When I hit a full stop next to an object, and then the tab key, what I get is a list of all the methods available to this object, so for example, pens can draw, they can write, they can do all these things. Strings can be capitalised, centred etc., and you get that list, and you can use the arrow keys to navigate up and down with it, a very useful thing to be able to do. And this will work with any objects that has any methods associated with it. If I want to know information about a function when I'm in the definition of that function and I have it written down, then what I can do is I can hit shift and tab, and what I get to there is a peak of something called the docstring. The docstring outlines how to use the function, so this tells me how it works, it prints the values to a stream or to a stream standard out by default, and it has some key word arguments to change its behaviour. So, shift and tab, try everything out for yourselves and go through this interactively. We can also use tab to complete things for us. If I was thinking, for example, I want to print something, and I can't be bothered to type out the rest of it, I hit tab, then I'll get some suggestions as to what I might want it to do there, so tab also does code completion for us.
A few more things, block commenting, so commenting out code basically means stopping it from executing. If you want to add comments to your code, then you would use the same sort of thing, and if you want to block comments, then control and forward slash will block comment out code for you, and in Python, the comment key is the hash key. So, an individual hash will stop something from evaluating, and you just do that in a normal fashion. If you hit control and forward slash, you will block the comment out, or if you're on a single line, you will just comment as well. That's everything I want to talk about in terms of keyboard shortcuts. We can use keyboard shortcuts for everything. If you want to, you can also use the toolbar at the top, which has all the functionality that keyboard shortcuts do. So, if I hit 'Run' here, then that's just essentially doing the same thing as control enter. Whenever I run this, and it's jumping to the next cell, if things start breaking and going wrong, then I'll probably ask you to 'Restart and run all (ph 02.27) cells'. What this means is, it wipes the memory of the current session, forgets everything that you've told it, and runs everything again, so if you've got some dodgy variables in memory, sometimes just refreshing everything and running these things again will fix all of your problems.
So, we've had a look at print. Print is something that we call a function. You have print, and we want to print 'hello world'. Now, how do we know we've got print? Thankfully, in Jupyter, built-in functions go green when you're using them, so this is something called a function. Functions are related to methods, but every method is a function. Not every function is a method though. They're related, but they aren't the same thing. So, the print function will work on any Python object, and it's not associated with any object in particular. It's something that whenever you call on it, it will come running and it will help you out. Now, every object can be printed, but not every object can be turned into upper case, for example. For that reason, upper is a method belonging to the string, because not everything can be turned into upper case, but strings can, whereas everything can be printed. Every object has some representation of itself that is able to be printed out, so the beauty of Jupyter is that if something happens in this last line of a cell that produces a new object, that object will be printed to the screen. I haven't printed this. If I had this in a block of code, that would run and then it would be forgotten about forever, because this is at the end of a cell, this is being output as an output from that cell, so I can get an idea of what it actually looks like. In reality, what I should be doing is I should be printing everything that I want to display out. So if I was being syntactically correct, I would print that out, and then we don't get this outputs thing there, and we also don't get the quotation marks on either side.
So, what print does, print's sole purpose is to display things to the screen, for a user or somewhere. It doesn't actually do anything. It puts things out into some place. The data doesn't really exist there, it's just being shown to you. So, this is quite an interesting statement, because I have a function, I have some brackets, and then I have something happening within those function brackets.
Delivering training and developing courseware for multiple aspects across Data Science curriculum, constantly updating and adapting to new trends and methods.