Python Tutorial: Visualizing Time Series Data in Python | Intro

preview_player
Показать описание

---
Welcome to the course! My name is Thomas Vincent, and I am currently the Head of Data Science at Getty Images. In this course, you will learn how to become an advanced user of time series visualization in the Python programming language.

We expect you are comfortable with the basics of Python as covered in Intro to
Python and Intermediate Python for Data Science courses on DataCamp.

Several datasets can be analyzed using the concept of time series analysis. Financial and weather data are best handled as time series, and the current explosion of Internet of Things data collected by sensors and other sources can also be analyzed as time series. Therefore, it is frequent to encounter time series in the field of Data Science. I personally have had the opportunity to work with time series data very often,

and I hope that through this course, I will be able to show you the power of time series visualization.

This course will provide practical knowledge on how to diagnoze and visualize time series data using Python. In the first chapter, we will show how to manipulate and clean time series data, and produce time series graphs in which personalized aesthetics and information is displayed. In the second chapter, we will take things further by describing how to extract and display summarized views of time series data, while the third chapter will introduce sophisticated methods to analyze time series. The fourth chapter will take a different turn and describe in detail how to handle datasets containing multiple time series. Finally, the course will end with a case study that will review the content of the first four chapters.

This course will heavily leverage the pandas library to process and clean time series data, so before we kick things off, let's do a quick recap of the pandas library. As shown in line 1, it is common practice to load the pandas library using the pd alias. We can then leverage the dot read_csv() function to import contents of the CSV file into a DataFrame.

Now that your file has been loaded into the DataFrame named df , you can leverage additional pandas methods to display information about df. The dot head method allows to display the first n rows of your DataFrame. Similarly, the dot tail method returns the last n rows of your DataFrame.

When analyzing data, it is also recommended to check the type of each column in your DataFrame, which will help you understand the type of data you are working with. For that, you can use the dot dtypes method to print out the data type of each column. This will inform you whether the columns contain integers, floats, strings etc... In this case, you can see that the df dataframe contains a datestamp column of the object type, and a co2 column of the float type.

When working with time series data in pandas, it is recommended that dates are formatted as a datetime64 type. Fortunately, even if your data comes in the form of a string, you can use the dot to_datetime() function to convert those to the appropriate datetime64 type. By default, if the dot to_datetime() function cannot parse the date-like object then it will raise an error. However, you can override this behavior by adding the argument errors='coerce', which will return a NaT timestamp when the object cannot be parsed.

Now it's your turn!

#DataCamp #PythonTutorial #Visualizing #TimeSeries #Data #Python
Рекомендации по теме
visit shbcf.ru