- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Pandas program to convert a string of date into time
In this program, we will convert a date string like "24 August 2020" to 2020-08-24 00:00:00. We will use the to_datetime() function in pandas library to solve this task.
Step 1: Define a Pandas series containing date string. Step 2: Convert these date strings into date time format using the to_datetime format(). Step 3: Print the results.
import pandas as pd series = pd.Series(["24 August 2020", "25 December 2020 20:05"]) print("Series:
", series) datetime = pd.to_datetime(series) print("DateTime Format:
Series: 0 24 August 2020 1 25 December 2020 20:05 dtype: object DateTime Format: 0 2020-08-24 00:00:00 1 2020-12-25 20:05:00 dtype: datetime64[ns]
- Java Program to convert Date into milliseconds
- Java Program to convert a String to Date
- C# program to convert a list of characters into a string
- Python program to convert a list of characters into a string
- Java program to convert a list of characters into a string
- PHP program to convert a given timestamp into time ago
- Java Program to Convert String to Date
- How to convert date and time into int in Android sqlite?
- How to convert a String into a Date object using JDBC API?
- How to convert a date to a string using the universal time convention?
- Python Pandas - Convert string data into datetime type
- Java Program to Convert a String into the InputStream
- How to correctly convert a date format into a MySQL date?
- Convert string of time to time object in Java
- How to convert ISO 8601 string to Date/time object in Android?