Python “datetime” in the easiest way (how to handle dates in data science with Python)

Python Data Analysis Basics (PDA2)

Python Financial Analysis | Home

When it comes to handling dates in Python, the most common way is using “datetime” objects. If you want to do financial analysis, for example, the day will come for sure when you have to specify dates of data like stock price. The most common format of date in financial analysis is the form like “2021–08–13”, or, in Python, it’s specified as “%Y-%d-%d”.

But it’s common, in data science, to save dates in the text form because CSV and other file formats don’t support data types other than text. So once you read a dataset written in CSV into a DataFrame, you have to convert the text (string) form of date into “datetime” objects.

List of articles

1. Python Financial Analysis

1 Read fundamental data from a CSV in Python
2 Handling table like data in Python with DataFrame
3 Make graphs of stock price in Python
4.1 Make custom market index — prerequisites
4.2 Make custom market index — make your own index
4.3 Make custom market index — market cap based index
5.1 Analyze COVID-19 Impacts by Sector in Python — compare weighted average prices
5.2 Analyze COVID-19 Impacts by Market Caps in Python — compare weighted average prices
5.3 Find companies that lost or gained from the COVID19 pandemic

2. Python Data Analysis Basics (easiest ways)

Python “datetime” in the easiest way (how to handle dates in data science with Python)
Python DataFrame slicing in the easiest way (How to find a company from 5000 companies)

Other Links

Python Financial Analysis | Home
Python Data Analysis | Home

--

--

sub-publication of “Python Financial Analysis”

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store