Python Data Basics - Data Types
Free Python Data Basics learning material by Data Science Teacher Brandyn
Most techologies to a great deal to manage data types for us. Excel often doesn't care if its a string a number. And so we often never think about how import data types are.
In the Python coding language we need to be conscious of our data types because an object's data type is what let Python know what can be done with the object.
In Python the basic data types are integer, float, and strings. Although at a more complex level this can be DataFrame to ML models.
Either way its the data type that tells Python what can be done with a given object so in Python we need to always be aware of the data type.
Follow along with Data Science Teacher Brandyn and learn the basics of Python in this free independent educational material.
Python Data Basics - Data Types
We might have gotten used to excel handling data types issues for us of on fly. In Python we need to be more aware of data types as an objects data type is what let's Python know what can be done with a given object. There will be an import understanding we have about our data types incorrectly to connect blocks of code. Data Types are a simpe but import concept.
Python is a vast tool. But in essence Python allows us to interact with the computer just like using a computer mouse with our hand let's us interact with a computer Python is simply a different for of interacting. Python or code in general communicates with the computer in a more natural way for the computer and unlocks the ability to do so much more than can be done with a computer mouse.
Data types are foundational in Python and allow Python to interpret and understand what to do with a given object. The goes beyond the basics Python data types and includes the data types created by libraries such as a array in Numpy and Series or DataFrame in Pandas. These advanced Python data types give up access to the complete library of Numpy and Pandas.
Python Indexing is a little different from what your probably used to but still simple. Python indexing start at 0. So the 1st position is 0, the 2nd position is 1 and the 3rd is 2 etc. Python slicing also works from inclusive to exclusive. So in Python you go from this starting position up to but not including the ending position.
Python Data Types
In this free Python Data Types educational material. When interacting with a computer using a coding language like Python we need to pay attention to our data types. In Python, a data type is what lets Python know what can be done with a given variable or object and so if we are unaware of what the data type is it is very likely that we will use the variable incorrectly and get an error. Data Types are a very simple concept but are foundational to working with data in Python.
Python is like your computer mouse
Python at it's simplest level is just another way for us to interact with the computer like a mouse allows us interact with out computer but in a much more natural way for the computer. Like we open excel and then use its spreadsheet mainly by clicking the mouse, with Python, we import a library and work with this application by writing code in a certain pre-define syntax.
Python Advanced Data Types array, Series, DataFrame
In the next secton of this Python Data basics learning material we discuss advanced data types. As mentioned Data Types are what tell Python what can be done with a given object. This includes the data types generated by libraries. This advanced data types essentially gives us access to the functions available in the library. So calling the mean function from a Pandas DataFrame uses the Pandas version of mean, whereas calling the mean function on a Numpy array uses Numpy's version. Not likely going to make a difference with a simple function like the mean but an important concept to understand when working with libraries in Python.
Python Slicing and Indexing
In Python when we select a section of data from a collection of variables like a list or a tuple we call this slicing, sectioning out the data to get what you want. Python indexing is a little unique but very easy we just need to remember that we start at zero. So position number 1 is 0 and the 2nd position is 1. Slicing we need to remember it goes inclusive on the first digit and exclusive on the 2nd digit. So in Python slicing, we start from a number and then go up to but not including our endpoint.
Explore Data Types with free Python Code
In the coding section of this free data Python educational material we start of by covering the basics of colab and to work with a code and text cell. We cover integers and floats in Python and when integers and floats work differently. We head into how lists, tuples and dictionaries in Python works. We next introduce a Series and DataFrame in Pandas and how to build a DataFrame from a Python dictionary. This is a common workflow in Python and data science and DataFrames will be where we spend most of our time. This class introduces Pandas for beginners.