Comments (6)
I'm very skeptical of making pd.to_datetime more complicated (both as an API and the implementation).
pd.to_datetime(ser).dt.to_period("D")
is effectively a date dtype.
Alternately maybe we need to introduce a new pd.to_date
Side-note: I've been kicking around the idea of a pd.to.foo namespace to collect all of the to_foo functions, since the top-level namespace is pretty big. ATM to_offset and to_time are buried and could be included.
from pandas.
to_numeric
had a dtype_backend
keyword added in 2.0 IIRC. I wouldn't be opposed to adding that keyword to to_datetime
for symmetry but return pa.timestamp
types and not pa.date
types.
from pandas.
I wasnt aware of the keyword in to_numeric; I would have been -0.75 on that.
In to_datetime it has the added downside of complicating the return type (not just dtype). The base case to_datetime returns a DatetimeIndex. A keyword would change that to be a base class Index.
.convert_dtypes already works for the timestamp dtypes. One Obvious Way.
from pandas.
I also think dtype_backend
here is a partial solution that doesn't necessarily clarify how to accomplish the task the best way.
pd.to_datetime(ser).dt.to_period("D")
is effectively a date dtype.
That's in interesting idea but I think would be really tough to roundtrip and use effectively with our I/O
AFAIU the only way to specifically get a non-object date in this case is to ser.astype(pd.ArrowDtype(pa.date32()))
- is that correct?
from pandas.
AFAIU the only way to specifically get a non-object date in this case is to ser.astype(pd.ArrowDtype(pa.date32())) - is that correct?
Correct
from pandas.
.convert_dtypes already works for the timestamp dtypes. One Obvious Way.
This is a good point. to_numeric
with dtype_backend="pyarrow"
essentially astypes from nullable numpy types to arrow types which is covered by convert_dtypes
from pandas.
Related Issues (20)
- BUG: Errors when running pandas on development environment HOT 5
- different nan handling in to_json() vs to_dict() HOT 3
- BUG: Pandas Discrepancies in Handling Non-English Data During Memory Optimization
- ENH: sum() should default to numeric_only=True HOT 4
- BUG: OverflowError when JSON serializing a dataframe/series with PeriodArray variable HOT 2
- BUG: Series.plot(kind="pie") does not respect ylabel argument HOT 4
- BUG: qcut returns incorrect results HOT 4
- DISC: path to nullable-by-default integers and floats HOT 3
- BUG: register_dataframe_accessor causes "Untyped class decorator obscures type of class; ignoring decorator" HOT 1
- How do I read and write tabular data? HOT 2
- DEPR: ExcelFile.parse HOT 11
- PERF: Saving many datasets in a single group slows down with each new addition HOT 11
- DOC: Plotting Backend Documentation Incorrect HOT 6
- BUG: Incorrect behaviour when using `loc` on a resampled time index dataframe HOT 4
- BUG:Characters like '/' are being replaced by '_' when importing a CSV file into Python with pandas. HOT 5
- BUG: macOS ARM64 Binary wheels not published for v2.2.2 HOT 1
- BUG: `read_csv()` with `engine="pyarrow"` converts numeric string even when `dtype=str` is specified HOT 2
- BUG: When running the `setup.py` script, a `TypeError` occurs in the `shutil.rmtree()` function due to a generator being passed instead of a valid path. HOT 2
- BUG: `read_csv` breaks on NaNs for dtype=np.float16 HOT 2
- ENH: `FY5253Quarter` to support alternative week allocations HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pandas.