1. Home
  2. Explore
  3. Computer Science
  4. Python for Data Analysis

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Python for Data Analysis

Transcript

Hey there, welcome to the next stage of your learning journey. Congratulations on completing your first course. You've learned how data professionals contribute to the success of an organization and the main tools and techniques they use on the job. Now, you'll learn how to use one of the most powerful tools available to data professionals, the Python programming language. Computer programming refers to the process of giving instructions to a computer to perform an action or set of actions.

You can use different programming languages to write these instructions. You might choose a specific language based on the project you're working on, or the problem you want to solve. The Python programming language is super useful for working with data. Data professionals use Python to analyze data in faster, more efficient, and more powerful ways because it optimizes every phase of the data workflow, from exploring, cleaning, and visualizing data, to building machine learning models. This course will give you a strong foundation in Python fundamentals, and prepare you for more advanced data work in your future career. If this is your first experience with the Python programming language welcome.

This course does not assume you have any prior knowledge of Python. We'll begin from the beginning, and work through each concept step by step. Take it one step at a time, and go at your own pace. As you develop your Python skills, you'll apply what you learn to gain valuable practice working with data. And if you have experience with Python, that's great too. I'll help you apply your knowledge in a new way, and demonstrate how to use Python for data analytics specifically.

Let me introduce myself, my name's Adrian, I work as a customer engineer at Google Cloud. This means that I work with our customers to understand the technologies they have at their disposal to solve data analytics needs. I first learned Python when I wanted to create an electronic journal. I got tired of buying a new physical one every year. I learned how to password protect it, and to this day, it's still one of my proudest moments of using Python. Throughout your career as a data professional, you'll have the opportunity to continually learn and grow. To me, that's one of the coolest aspects of the job. And learning Python is one of the most rewarding parts of that growth process. I'm still learning new ways to use Python all the time, both at work and for fun. Now, let's review what you will learn. We'll start with a general introduction to Python, and discuss why it's such a popular programming language among data professionals.

You'll learn fundamental coding concepts, such as variables and data types, and how they help store and organize your data. You'll also get a chance to start writing your own Python code. Next, you'll explore functions, or reusable chunks of code that let you perform specific tasks. Functions help you work with data quickly and efficiently. You'll also learn about conditional statements, which tell the computer how to make decisions based on your instructions.

Then, you'll discover the power of loops, which repeat a portion of code until a process is complete. You'll also learn how to work with strings, which are sequences of characters, such as letters and punctuation marks. After that, you'll explore data structures in Python, which are methods of storing and organizing data in a computer. You'll review the most useful structures for data professionals, such as lists, sets, dictionaries, and DataFrames.

Finally, you'll apply your Python skills in an end-of-course project that you can add to your professional portfolio. The end-of-course project features a unique dataset based on a workplace scenario. In future job interviews, you can share your project as a demonstration of your skills, and impress potential employers. Learning Python will take your data analysis skills to the next level. It'll also be a great addition to your resume. Knowing how to use Python is a key credential for data professionals, and will give you a big boost as a job candidate.

I'm here to help you every step of the way. And remember, you set the pace. Feel free to watch the videos as many times as you like, and review topics that are new to you. By the end of this course, you'll know how to use Python to explore and analyze data. Let's get started. Hi there! I can't wait to explore Python with you! During our journey together, you'll learn how to use the Python programming language to power your data analysis.

This course will give you a foundation of essential Python skills that you can continue to build on throughout this program and your career. We'll begin with an overview of Python's main features and capabilities, and discuss the basics of Python programming. You'll discover how Python can help you work with your data quickly and efficiently. Then, we'll consider Jupyter notebooks, an interactive environment for coding and data work. You'll learn about the useful functionality of Jupyter notebooks, and how to write Python code in the notebook environment. Python is an object-oriented programming language based on objects that contain data and useful code. Next, you'll explore the benefits of object-oriented programming for data

professionals, and become familiar with its basic concepts. After that, you'll discover variables, one of the building blocks of Python programming. You'll learn how variables help you store and label your data, and how to assign specific values to variables. We'll also review the conventions, or widely accepted rules, for naming variables. Learning these conventions will help you write code that is clear, precise, and consistent. Finally, we'll explore fundamental data types such as integers, floats, and strings. You'll learn how to convert and combine data types to organize your data. When you're ready, join me in the next video!

Python is a powerful coding language that has become one of the preferred tools of data professionals worldwide and for good reason. In this video, we'll explore what Python is and why it has become so popular. But first, let's discuss some basic elements of programming languages in general. Programming languages originated with the development of electronic computers. They were, and still are, the words and symbols that we use to write instructions for computers to follow.

Communicating with a computer ultimately relies on computer hardware. A transistor is the most fundamental component of the computer because it controls the flow of electricity through a circuit. A transistor can exist in two states: on or off, like a switch. When a transistor is on, electricity passes through it. When it's off, it blocks the electricity. This duality defines how computers operate. If you chain enough transistors together, each either on or off, you can create complex logic. So how does this relate to computer programming?

Well, because computers are just billions of transistors, or switches, they understand things only in binary terms. You may have encountered this concept before, binary. Binary is represented as ones and zeros. These numbers are just an easier way to refer to the on and off sequences of transistors when a computer receives instructions from a program. Computers are powerful, but they still need to be given instructions and they can only understand instructions that are given in binary. The engineers who first designed computers encountered this and discovered a problem: computers are great at understanding binary, humans are not. This problem is what gave rise to the first programming languages.

The very first programming languages were difficult to use, required lots of training, and often only worked on the specific machine that each was designed for. These types of languages are known as low-level languages. Over time, new coding languages developed to simplify and generalize programming instructions. The programming languages became easier to learn because they were designed with simpler rules and structures known as syntax. Modern programming languages use syntax that's much more familiar to humans. These languages are known as high-level languages and this brings us back to Python. Python is a high-level language that's versatile and easy to learn. Simply put, Python is friendly. In fact, some people might think that the name itself is scary, but the creator of Python didn't name it after a giant snake. He named it after a British comedy troupe, Monty Python, because he wanted it to be easy and approachable.

In addition to Python being versatile and easy to learn it's also powerful. This combination of qualities has made it a a favorite, not only of data professionals, but of scientists and web developers too. Part of what makes it so powerful is that it's open source and developers have created many libraries and tools to make many jobs requiring Python easier. A library is a reusable collection of code. For instance, you could hand code a function that takes two numbers, adds 'em together and returns the sum. But what if now you want to add three numbers or four? You can write a more complex function that lets you input any combination of numbers and it will return the sum. But summing is a super common task so you can save yourself a lot of time by just using a math library that contains a sum function. There are thousands of Python libraries that contain code for tasks as simple as

summing numbers and as complex as building a neural network for an artificial intelligence application. You'll learn more about libraries soon, and you'll learn about neural nets and AI and how they fit into the world of data analytics in a later course. This certificate program focuses on advanced data analytics so you'll learn to use Python as its most often applied in data analysis work. You'll also learn about NumPy, pandas, statsmodels, matplotlib, seaborn, scikit-learn, and more.

These are code libraries that are used every day by data professionals on the job. You'll explore these in detail later. The ease of learning, ease of use, versatility, and power of Python make it one of the most-used coding languages today. Because it's so widely used it has a large and active community of users who are willing to help and provide support which makes it a great coding language to discover and explore. As you move through this course and the entire certificate program, always remember that coding is simple and complex. In other words, each line of code represents a small, simple idea but together those lines of code can express very complex logic. Coding can be frustrating at times but also a lot of fun and very rewarding. You will practice coding a lot in this course so you can get better and better. Lastly, don't be afraid to make a mess. Experimenting is part of the process and practicing will help you quickly improve your coding skills.

Previously, you learned that Python is a high-level programming language. This means that Python uses more human-friendly syntax, and more closely resembles a spoken language. In fact, Python is simple enough that you can learn some of its basic concepts just by example. In this video, I'll demonstrate some of the fundamentals of Python. I'll introduce you to some new terms, but we won't take into account formal definitions and processes. We'll consider these things in more detail later.

For now, just take a moment to get familiar with the code and how it works. The first thing we'll do is print to the console. If we tell the computer to print "hello world," it will output "hello world" for us. In fact, the print function will output whatever we enter in its parentheses. Of course, Python is also capable of performing computations. If we divide the sum of five and four by three, we get three. In Python, we can also assign variables.

You can think of a variable like a container that you can name. A container's contents are known as its value. For example, here we create two new variables. The first variable is called "country," and we're assigning to it the value of "Brazil." The second variable is called "age." We'll assign it the value of 30. Now we can refer to the values "Brazil" and "30" by their variable names. When I give the "country" variable to the print function, it returns "Brazil."

Similarly, when I give the "age" variable to the print function, it returns "30." Python can also be used to evaluate statements. For example, I can check if 10 to the third is equal to 1,000. It is, so the computer returns "True." Notice that so far I've used the "plus" sign for addition, the forward slash for division, and two asterisks to indicate an exponent. Like in mathematics, these signs are known as operators. A lot of them are straightforward. However, some might not be so simple.

Take this last case for example. I used two equals signs to check the equivalence of two values. When used properly, the computer will return either True or False. What happens when I use one equals sign? I get a syntax error. You might have noticed from earlier examples that the single equals sign is reserved for assigning variables. Just like in spoken languages, Python has rules that govern its construction. You'll learn many of these rules in this course, but I won't discuss them in detail now. You won't easily learn a new spoken language by studying a big book of its rules. You're more likely to learn it by speaking it, hearing it, reading it, and writing it.

It's also a lot more fun that way. It's the same with Python. So, for now, don't worry about memorizing any rules. First, let's observe Python in action. As you might expect, if I make a false equivalency, like 10 x 3 = 40, the computer will return "False." I can even use a variable I defined previously, age, in a new statement. 10 x 3 does equal "age." You'll recall we assigned "age" a value of 30, so the computer returns "True." Python also lets me perform actions based on conditional logic.

Here, I tell the computer that if the value of my "age" variable is greater than or equal to 18, then it should print the word "adult." Otherwise, it should print the word "minor." The value stored in the "age" variable was 30, so the computer returns "adult." Another common task in Python is looping. Looping performs the same action to each element of something. Here's a simple loop. For each number in this list of one through five, we print the number. The computer outputs one, two, three, four, five. Here's another example. This time I'll create a list containing the numbers three, six, and nine and assign it to a variable named "my list." Now I'll loop over "my list" and for each number in the list the computer will print that number divided by three. And there you have it! It outputs one, two, and three.

Now let's return to the conditional statement we wrote. If "age" is greater than or equal to 18, print "adult," otherwise print "minor." What if we want to repeat that same action for many different age values? We can write a function! A function is a chunk of code that can be reused to perform the same task. We'll define this function and call it "is adult" and it will accept an argument called "age." By the way, an argument is information that you give a function in its parentheses.

Now, in the body of the function we'll use the same code we used for the conditional statement. Nothing happens when we run this code, but check out what happens when we call the function and give it an argument of 14. The computer returns the word "minor." Now we can perform this same evaluation as many times as we want, simply by using the "is adult" function we just created. And remember how I told you that libraries are part of what make Python such a useful and powerful language?

Python has its own library of built-in functions that perform common tasks. For example, here's a list of numbers. 20, 25, 10, and five. We'll assign this list to a variable named "new list." We can use the built-in Python function called "sorted" and enter "new list" as its argument. It returns our list with its values sorted from least to greatest. These are just a few simple examples of what Python can do. These simple processes can be stacked and layered and combined to create algorithms and programs that could possibly change the world. Python's power is bounded only by the limits of your imagination. Now that we've explored what Python is and what it can do, I'm excited for you to learn more about it! Recently, you've been investigating the power of Python. There are many environments programmers use when exploring all of

Python's capabilities, and one of the most popular is Jupyter Notebook. You've already encountered Jupyter Notebook. The examples that I presented to you previously were done in one. We'll use this platform to write code and perform analysis throughout the course. We'll also provide you with information about how to set up Jupyter Notebook on your own computer, but that's optional and not necessary to complete the Advanced Data Analytics program. Jupyter Notebook is an open-source web application for creating and sharing documents containing live code, mathematical formulas, visualizations, and text. Using a Jupyter Notebook lets you collaborate on data projects and integrate code. Plus, it puts all of your output in one document, which is very useful, especially when first learning about programming.

To illustrate why, take this example. In the computing world, most code is written in an environment similar to this. This is a terminal-based text editor. Notice that it's like a single page that's infinitely long. If I perform an operation or write a line of code, it executes immediately when I move to the next line, and I can only move forward. I can't return to an earlier line of code, insert my cursor there, and change or run it. A terminal-based text editor is a very useful environment for many, many situations, but it's not always the best or easiest to work with for data analytics projects.

Now, compare that to our notebook environment from before. Here, I can more easily modularize my code into cells to organize them in sections. Cells are the modular code input/output fields into which Jupiter notebooks are partitioned. I can move code around, add it, and delete it with the click of a mouse or the press of a button, and it's great for visualizations and presentations.

I can add comments, annotations, and explanations using markdown syntax. Markdown lets you write formatted text in a coding environment or plain text editor. For example, I can add titles and bullets, tables, and mathematical formulas. These are just a few of the many features of Jupyter Notebooks that make it a preferred platform among data professionals. As you move through this course, you'll create projects in Jupyter Notebooks to showcase your skills as a data professional.

You're well on your way now! In this video, you'll learn more about Python and what makes it both approachable and powerful as a coding language. You're going to learn about object-oriented programming. Specifically, we're going to discuss classes, methods, and attributes. What follows is a brief introduction to object-oriented programming. A more detailed discussion is beyond the scope of this course. You'll have the opportunity to further explore object-oriented programming in your future career as a data professional.

Object-oriented programming is a programming system that is based around objects, which can contain both data and useful code that manipulates that data. An object is an instance of a class. Think of it like a fundamental building block of Python. Lists, functions, strings, these are all objects. The main idea behind object-oriented programming is to have both data and the methods that manipulate it within objects, allowing for more organized, accessible, and reusable code. The most important concept in object-oriented programming is the class. A class is an object's data type that bundles data and functionality together. In other words, the reason why it's useful for an object to have a type or belong to a class is because it allows us to build a bunch of useful tools that can be packed directly into the object itself. This will make a lot more sense with an example.

When we put the words "hocus pocus" inside quotations and assign that to a variable called "magic," this variable becomes an instance of the string class. Because it belongs to the string class, it behaves in a certain way and has a lot of built-in functionality reserved for strings. We can swap the case of the characters by typing "magic.swapcase " with empty parentheses after it. We can replace some characters with new characters by typing "magic.replace" and entering the characters we want to replace and what we want to replace them with. And we can split the string into a list of two strings using ".split " and an empty pair of parentheses. These actions are known as methods. A method is a function that belongs to a class and typically performs an action or operation. They use parentheses. In our examples, each method acted on the value of our variable. It changed it in some way.

That's what I mean when I say that methods typically perform an action or operation. By the way, you don't have to memorize these methods. There aren't many people who know all of them. Most coding environments have ways to access a list of methods available to a given class. In Jupyter Notebook, we type a dot and then hit the tab key. Notice that we're attaching the method to its class instance using a dot. That is called dot notation, and it's how we access the methods and attributes that belong to an instance of a class. There are many different classes in Python.

You've encountered some of these already. The core classes of Python are: Integers, floats, strings, booleans, lists, dictionaries, tuples, sets, frozensets, functions, ranges, and none, which is a data type that returns an empty value. There are also many additional custom-defined classes that come with libraries and packages, and you can even make your own. Okay, the last thing we're going to discuss is attributes. Attributes are values associated with an object or class which are referenced

by name using dot notation. They don't use parentheses. Attributes are especially important for custom-built classes and more complex data structures, like dataframes. You'll learn more about these later, but here's an example. Suppose we have a dataframe called "planets" that contains a row for each planet and columns that represent planet name, its radius, and the number of moons it has. One attribute of this dataframe would be its shape. This dataframe is eight rows by three columns. Another attribute of the dataframe class is columns. Calling this attribute on the dataframe object returns an index object containing the column names of the dataframe.

Attributes allow you to access characteristics of a class, but they don't do anything to it or change it. Perhaps you're beginning to appreciate how object-oriented programming is an ideal structure for data analysis. By packaging data together with ways to manipulate it and learn about it, objects are the fundamental building blocks of Python and part of what makes it such a powerful tool for data professionals. In this video, we're going to focus on variables. Variables give meaning to code. Think about nouns in language. Nouns are used to identify people, places, or things in a sentence. Variables in Python are like nouns. Variables point to values. They're not the values themselves. If you have the expression X=3, X is the variable, and its stored value is 3. The 3 exists in a specific location in the computer's memory. The X points to that location.

Another way to think of a variable is like it's a container with a label on it. A container is a separate thing from whatever it contains, but if I ask you to pass me the ketchup, you'll know which bottle to pass me even if you can't see the ketchup inside it because the bottle is labeled. Variables can store values of any data type. A data type is an attribute that describes a piece of data based on its values, its programming language, or the operations it can perform. In Python, this includes strings, integers, floats, lists, dictionaries, and more. You've already encountered some of these in this course. We'll explore these data types throughout the program. When assigning a new variable, it's helpful to answer these questions before you code. What's the variable's name? What's the variable's type?

And what's the variable's starting value? These questions help you create variable names that remain meaningful and easy to reference again later. Naming variables is important because these names are reminders for yourself and others about what you are storing in the variable. Calling the data type also helps you understand what the data can and can't do. Next, consider how you will assign expressions, which can help make your code more concise. An assignment describes the process of storing a value inside a variable, and an expression is a combination of numbers, symbols, or other variables that produce a result when evaluated. Now, let's examine that in Python. We'll translate a variable algorithm into Python code.

Let's start with a list of the ages of the starting five players on a professional basketball team. We'll assign the list to a variable called "age list." Notice that we didn't call it, for example, X, because X doesn't tell us anything about the value it contains, and if we encountered an X later, we might not remember that it's a list of ages. One nice thing about Python is that the computer interprets the data type for us automatically when we assign a new variable.

This is called dynamic typing. Dynamic typing means variables can point to objects of any data type. Also, there are no default types for most new variables. So we need to assign, or initialize, before calling them. Let's return to our example. We'll find the maximum age of the basketball players by using Python's built-in "max" function and passing our age list to it as an argument. We'll assign the result to a new variable called "max age." When we call

the variable, the computer returns a value of 34. This is an integer. So the "max age" variable contains a value whose data type is "integer." Now suppose we want the "max age" variable to contain a string value. We can convert it to string by using the string function, represented by str, and reassigning the result back to the "max age" variable. Now our variable has a data type of string, which is indicated by the quotation marks in the output. You'll learn more about strings later.

For now, just remember that those quotation marks are unique to strings. We can also overwrite the contents of the variable entirely, if we want. For instance, we can store in it the text string, "ninety-nine." Now when we call the variable, the computer returns our new string. There are a couple of important things to note here. First, notice that when we converted "max age" from an integer to a string, we reassigned it back to itself. If we hadn't done this, and we had simply used the string function on the "max age" variable, the computer would have returned a string, but the contents of the variable would not have changed. Generally, when you want to modify the contents of a variable, you have to reassign it. The second important thing to be aware of is that the order that you run your cells in matters. For example, if I rerun the cell where I first assigned the "max age" variable,

and then call this variable in a new cell, you'll notice that its value has reverted back to the integer, 34. It's no longer the string, "ninety-nine." In these examples, the value contained in the "max age" variable changed every time we reassigned it. That's why it's dynamic. Variables are convenient because you can refer to them instead of the values they contain. So if we define a new variable that contains the minimum age in our list of ages, we can subtract the two variables to find the age difference of the oldest and youngest player.

There is so much we can do with variables in expressions in Python. The program asks a question, and the variable helps us capture the answer, based on input from a specific source. Just remember that if you want to modify the contents of a variable, you usually need to reassign it. It's also important to consider that the order you run the cells in matters when coding in Jupyter Notebook. Soon, we'll learn about variable-naming conventions and restrictions. I'll meet you there. Python has certain spelling or grammatical rules to follow just like any other language. In programming, we call these rules naming conventions and naming restrictions. If you completed the Google Data Analytics Certificate, you might remember that naming conventions are consistent guidelines that describe the content, creation date, and version of a file in its name. Naming restrictions are rules built into the syntax of the language itself that must be followed.

In Python, there are some important naming conventions to keep in mind. One of these is to avoid keywords. A Keyword is a special word that is reserved for a specific purpose and that can only be used for that purpose. You've already encountered some keywords, such as "for," "in," "if," and "else." There are others too, which you'll learn about soon. Keywords should never be used when naming variables. Thankfully, you don't have to worry about accidentally using a keyword.

First of all, keywords will appear in a special color in most coding environments. So a good rule to follow is that if you're naming a variable and the name changes color, don't use that name. And if you're thinking, "But I like colorful variable names," and you try to assign a value to a keyword anyway, the computer will say "Not so fast," and throw an error. Python will let you make spelling mistakes, but it won't let you use a keyword for a variable name.

By the way, "throw an error" is a common phrase that every coder knows only too well. It just means that the computer returns an error and your code doesn't successfully run. Also, some names are reserved for existing functions, for example, "print" and "STR." So you should also avoid using names of existing functions. To sum up, a big thing to keep in mind regarding variable naming conventions is that you don't want to use reserved keywords or functions. Precision is essential when programming.

This is why there are naming restrictions for variables. For instance, variables can only include letters, numbers, and underscores. This means you can't use spaces, tabs, or special characters, such as the dollar sign or ampersand. Another rule to keep in mind is that, while variable names can contain numbers, they must start with a letter or underscore. Also, Python is case-sensitive, which means capitalization matters. Lastly, variable names cannot include parentheses.

This is because parentheses have other uses in Python. Let's review some examples of effective and ineffective variable names. "any_a_variable" is a valid variable name. "any_a_variable_2" is also good. However, "1_is_a_number" would be invalid because variable names must start with a letter or underscore. "Apples_&_oranges" is also invalid because it uses the special character ampersand. You do have some flexibility when naming your variables, since these are references you create; these conventions and restrictions just help make them consistent and useful. Okay, now let's go back to parentheses to understand more about how these

function in Python. When doing calculations, the rules for parentheses follow the mathematical order of operations. For instance, if we input 2 times 3 plus 4 in parentheses, Python will read 3 plus 4 first because it's following the order of operations. This is equal to 14. But, 2 times 3 in parentheses, plus 4 equals 10. That's because the operation within parenthesis will always be completed first. By the way, if we don't use any parentheses, Python will follow the standard mathematical order of operations.

Naming conventions and restrictions for variables help maintain consistency and usefulness as you continue to use Python for a variety of activities. A key part of working with Python as a data analytics professional is being able to effectively name your variables to create meaningful code. Soon, we'll explore conversions and data types. Bye for now. Previously, you learned about variables and how to name them. You learned that variables point to values that are stored in the computer's memory. In other words, the variables are like containers, and the values they store are their contents. Now, you're going to learn more about the values that your variables can contain. As you've learned, texts written between quotes and Python is called a string. Programs need to manipulate data, which can come in a lot of different forms or types.

These data types include strings, integers, and floats. First, a string is a sequence of characters and punctuation that contains textual information. Strings are instantiated with single or double quotation marks or the string function. This is an immutable data type, which means the values can never be altered or updated. An integer is a data type used to represent whole numbers without fractions. And float data types represent numbers that contain decimals.

Most computers understand when you tell them to add two integers, or add two strings. But generally speaking, computers don't know how to work with different data types. If you try to mix different data types, it can sometimes throw an error. As always, the computer tells us the cause of the error. It's like a little clue to help you improve your programming skills. Read the errors carefully, understand what they're trying to tell you, and use that knowledge to fix the mistake. In this example, the last line of the error message says, "We've encountered something called a TypeError." Seven is being read as an integer and eight is being read as a string because of the quotation marks. No wonder we got an error. You can't add seven to a word.

As a data professional, you'll often need to aggregate a lot of data of different types. This will require converting the various types so they can be combined successfully. There's an effective method for doing this. But, first, it's important to know what you're working with. Python offers a helpful way to identify data types with the type function. You can use the type function to have the computer tell you the data type. For instance, the type function here tells us that A belongs to the str class, which is short for string. The number two belongs to the int class, or integer. And 2.5 belongs to the float class. As a reminder, a class is an object's data type. The class bundles data and functionality together.

Now let's find out how to combine these different data types. There are two ways to convert data in Python. First is implicit conversion. Implicit conversion automatically converts one data type to another without user involvement. Here's an example. An arithmetic operations involving both integers and floats, the interpreter works in the background and converts integers to floats. You don't have to specify anything in your code to do this.

However, if you want to convert numerical values to strings, you will need to do an explicit conversion. Explicit conversion is where users convert the data type of an object to a required data type. We use the predefined functions, int, float, and str. This is sometimes called typecasting, because the user casts or changes the data type. Let's use the str function inside the string we want to have interpreted as output. And now the output of this calculation will be stored as a string. Great work. You'll continue exploring data types and seeking solutions to errors throughout this program. Debugging or figuring out what's wrong when your code won't work is a really useful skill for any data professional.

Also, as a final tip, all of us in the profession, even experienced data professionals and code developers, search for answers online when we encounter an error. This is a common strategy and a huge time saver. Always look to the data community for answers and inspiration. We've come to the end of the first section of the Python course. You've developed a lot of new Python skills already. Well done. Along the way, you've discovered that Python is a powerful tool for data professionals and learned how Python can help you work with your data quickly and efficiently. We began with a general introduction to the Python programming language and explored how data professionals use Python to power the data analysis. Then we discussed Jupyter Notebooks.

You learned about the main features of Jupyter Notebooks and how to write Python code in the notebook environment. Next, you explored the benefits of object-oriented programming for data professionals and learned about its basic concepts. After that, we focused on working with variables. You learned how to assign specific values to variables and effectively store and label your data. We also reviewed the standard naming conventions for variables. You learned useful guidelines for making your code clear, precise, and consistent. Finally, we explored different data types in Python such as integers, floats, and strings. You learned how to convert and combine data types to organize your data.

Coming up, you have a graded assessment. To prepare, review the reading that lists all the new terms you've learned, and feel free to revisit videos, readings, and other resources that cover key concepts. Congratulations on your progress so far, and I'll meet you again soon. Welcome back. I'm excited to continue our learning journey together. I really enjoyed exploring the basics of Python programming with you. You learned that Python is a powerful tool for data professionals and lets you analyze data with speed, accuracy, and efficiency.

You now know how to use variables in data types to store and organize your data and have already started writing your own Python code and this course will continue to build on your foundation of Python knowledge. By the end of the course, you'll be able to write statements in Python code to perform multi-step operations on your data. You'll also learn how to write clean, readable code that can be easily understood and reused by other data professionals. Being able to collaborate with teammates is one of the most important skills for a data professional and writing clean code is a great way to collaborate with your teammates and help your team achieve its goals. Working with clean code helps your team work faster, communicate more effectively, and produce better results.

We'll start with functions, or reusable chunks of code, that let you perform specific tasks. Functions are like the verbs or action words of a programming language. You can call on a function at any time to help you perform useful actions on your data, such as sorting, classifying, summarizing, and much more. Then we'll discuss how to write clean code that can be easily understood by your teammates and collaborators. You'll learn about two important elements of writing clean code,

reusability and modularity. Both of these practices speed up project development and help data professionals focus on core business needs and avoid spending time doing rework. After that, we'll examine another key aspect of writing clean code commenting. Commenting is a useful practice, because it helps you consider your thought process while documenting your workflow for teammates. Using comments to describe the component parts of a problem helps you solve it in clear, simple steps.

Next, we'll discuss how to use operators to compare values. We'll review two types of operators, comparators and logical operators. Comparators such as greater than or less than, allow you to compare two values. Logical operators such as and, and or, let you connect multiple statements together and perform more complex comparisons. Data professionals use operators to analyze and make decisions about their data. Lastly, we'll consider conditional statements, which tell the computer how to make decisions based on your instructions. You'll learn how to write if else and else if statements. Data professionals use conditional statements to structure complex operations and to perform all kinds of practical tasks, such as binning data and organizing files. Conditional statements make your Python code more flexible and powerful. When you're ready, I'll meet you in the next video.

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent