question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DOC: to_datetime works real differently on DataFrames vs other datatypes

See original GitHub issue

Location of the documentation

Documentation problem

The to_datetime method does something wildly different on strings or Series vs DataFrames. This caught me by surprise and I think it would help if the documentation reflected this more clearly.

Suggested fix for documentation

Something along the lines of:

For most datatypes given to the to_datetime method it creates datetime objects out of strings. If to_datetime is given a dataframe it does something quite different: it combines columns that contain year, month and day information into datetime objects.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
abatomunkuevcommented, Oct 13, 2021

@mzeitlin11 Hello! I have created a Pull Request 😃

1reaction
mzeitlin11commented, Jul 1, 2021

Thanks for reporting this @nielsbom - agreed further documentation would be helpful. There’s an outstanding pr to fix some issues (#42244), but don’t think it will completely handle what you mention.

Read more comments on GitHub >

github_iconTop Results From Across the Web

change multiple columns in pandas dataframe to datetime
I ran the code on my data frame (273771,), the to_datetime time was 1min13 sec vs the lookup was 59 sec. – smishra....
Read more >
pandas.to_datetime — pandas 1.5.2 documentation
This function converts a scalar, array-like, Series or DataFrame /dict-like to a ... Many input types are supported, and lead to different output...
Read more >
Pandas Convert Multiple Columns To DateTime Type
Let's see different ways to convert multiple columns from string, integer, and object to DataTime (date & time) type using pandas.to_datetime(),
Read more >
Basic Time Series Manipulation with Pandas | by Laura Fedoruk
As someone who works with time series data on almost a daily basis, I have found the pandas Python package to be extremely...
Read more >
DateTime in Pandas: A Simple Guide for Beginners (2022)
This tutorial will discuss different aspects of working with dates and times in pandas. After you finish this tutorial, you'll know the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found