官术网_书友最值得收藏!

Summary

In this chapter we showed how you can work with time series in Pandas. We introduced two index types, the DatetimeIndex and the TimedeltaIndex and explored their building blocks in depth. Pandas comes with versatile helper functions that take much of the pain out of parsing dates of various formats or generating fixed frequency sequences. Resampling data can help get a more condensed picture of the data, or it can help align various datasets of different frequencies to one another. One of the explicit goals of Pandas is to make it easy to work with missing data, which is also relevant in the context of upsampling.

Finally, we showed how time series can be visualized. Since matplotlib and Pandas are natural companions, we discovered that we can reuse our previous knowledge about matplotlib for time series data as well.

In the next chapter, we will explore ways to load and store data in text files and databases.

Practice exercises

Exercise 1: Find one or two real-world examples for data sets, which could – in a sensible way – be assigned to the following groups:

  • Fixed frequency data
  • Variable frequency data
  • Data where frequency is usually measured in seconds
  • Data where frequency is measured in nanoseconds
  • Data, where a TimedeltaIndex would be preferable

Create various fixed frequency ranges:

  • Every minute between 1 AM and 2 AM on 2000-01-01
  • Every two hours for a whole week starting 2000-01-01
  • An entry for every Saturday and Sunday during the year 2000
  • An entry for every Monday of a month, if it was a business day, for the years 2000, 2001 and 2002
主站蜘蛛池模板: 郴州市| 宁陕县| 青州市| 繁峙县| 瓦房店市| 右玉县| 新晃| 嵊州市| 乳山市| 旬邑县| 林州市| 遵化市| 呈贡县| 涟水县| 黄龙县| 文成县| 富川| 湖口县| 大兴区| 菏泽市| 江安县| 马边| 蒙阴县| 临安市| 黔西县| 翁牛特旗| 阳山县| 定结县| 栾城县| 兰州市| 博罗县| 新乡市| 宁国市| 苗栗市| 托克逊县| 从化市| 沐川县| 淮滨县| 威远县| 类乌齐县| SHOW|