Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Python Data Analysis, Second Edition

You're reading from   Python Data Analysis, Second Edition Data manipulation and complex data analysis with Python

Arrow left icon
Product type Paperback
Published in Mar 2017
Publisher Packt
ISBN-13 9781787127487
Length 330 pages
Edition 2nd Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Ivan Idris Ivan Idris
Author Profile Icon Ivan Idris
Ivan Idris
Arrow right icon
View More author details
Toc

Table of Contents (22) Chapters Close

Python Data Analysis - Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface
1. Getting Started with Python Libraries FREE CHAPTER 2. NumPy Arrays 3. The Pandas Primer 4. Statistics and Linear Algebra 5. Retrieving, Processing, and Storing Data 6. Data Visualization 7. Signal Processing and Time Series 8. Working with Databases 9. Analyzing Textual Data and Social Media 10. Predictive Analytics and Machine Learning 11. Environments Outside the Python Ecosystem and Cloud Computing 12. Performance Tuning, Profiling, and Concurrency Key Concepts
Useful Functions Online Resources

Dealing with dates


Dates are complicated. Just think of the Y2K bug, the pending Year 2038 problem, and the confusion caused by time zones. It's a mess. We encounter dates naturally when dealing with the time-series data. Pandas can create date ranges, resample time-series data, and perform date arithmetic operations.

Create a range of dates starting from January 1 1900 and lasting 42 days, as follows:

print("Date range", pd.date_range('1/1/1900', periods=42, freq='D')) 

January has less than 42 days, so the end date falls in February, as you can check for yourself:

Date range <class 'pandas.tseries.index.DatetimeIndex'>
[1900-01-01, ..., 1900-02-11]
Length: 42, Freq: D, Timezone: None

The following table from the Pandas official documentation (refer to http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases) describes the frequencies used in Pandas:

Short code

Description

B

Business day frequency

C

Custom business day frequency (experimental...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images