Comments (4)
Thanks for the report! This is a duplicate of #58328
But, your analysis is correct and if you have an idea for a fix feel free to submit a PR!
from pandas.
Not sure if it is right, but my idea for the fix would be as below
- checking if the first element has 'May' in the date string
- if so then get the date format as usual. Suppose the date format we got is "%B-%d-%Y"
- then try converting all dates with "%B-%d-%Y" and "%b-%d-%Y" (replace capital B with small b) . If one of them doesn't work, continue with the other format.
@Aloqeely what do you think of this approach?
Edit:
step 3 could be like below
format = get_format(data[0]) # "%B-%d-%Y"
formats_to_try = [format, format.replace('%B', '%b')]
for fmt in formats_to_try:
try:
return pd.to_datetime(*same_args, format=fmt)
except ValueError:
continue
raise ValueError("Mixed date formats")
from pandas.
That would work, but 'May' is not the only month name where this happens, for example 'Mai' in French has the same problem.
Could you please discuss in the original issue and get input from pandas devs?
from pandas.
Sure closing this issue
from pandas.
Related Issues (20)
- BUG: AttributeError: 'Engine' object has no attribute 'cursor' HOT 5
- BUG: FutureWarning when following documentation HOT 1
- BUG: Column of dtype Categorical in DataFrame encounters error when taking a row that includes nan in the column HOT 2
- DOC: Searching DataFrame.eval( blocks me from the documentation HOT 2
- PERF: groupby is significantly slower for `DatetimeIndex` with timezone HOT 2
- Potential performance regression with "CLN: enforce deprecation of frequencies deprecated for offsets"
- PERF: 100% CPU utilization with matplotlib (macosx)
- BUG: `interval_range` ignores type of `start` (regression from pandas 2.2.2)
- Inconsistent "index"/"name" property referring to both rows and columns based on iloc selection HOT 2
- BUG: Invalid Stata file is generated if byteorder='big' is specified and strings are saved as strL type
- BUG: `Index.difference` is returning too many values HOT 1
- BUG: index `to_period` - `to_timestamp` round trip with `freq` argument fails specifically with `period-start` frequencies HOT 2
- BUG: `Series.combine_first` replaces `None` with `NaN` at index not provided by `other` HOT 3
- BUG: in agg function HOT 1
- BUG: Rounding timedelta to 3 decimal places does not work correctly and is unstable. HOT 2
- BUG: pd.read_sql() converts string "NA" to None HOT 1
- API: timestamp resolution inference - default to one unit (if possible) instead of being data-dependent?
- DOC: punctuation of titles in Titanic data HOT 1
- BUG: `unstack` with `sort=False` scrambles data HOT 3
- BUG: pandas.read_parquet fails to read parquet files with "file://" prefix on Windows HOT 2
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.