Comments (3)
Same problem here. Though I don't think manual using of dtype
and parse_dates
together can be considered as something that has "expected behaviour".
Btw, if you use
columns = {"Ticker": str, "Last Update Timestamp": pandas.StringDtype()}
There is no problem at all.
And one more thing: try to specify incorrect date_format like that:
df = pandas.read_csv(
csv,
usecols=list(columns.keys()),
dtype=columns,
parse_dates=["Last Update Timestamp"],
date_format="%Y/%m/%d %H:%M:%S",
)
Kind of magic xD. Definitely a bug. Seems like date format inferring or something like that... because if you set
df = pandas.read_csv(
csv,
usecols=list(columns.keys()),
dtype=columns,
parse_dates=["Last Update Timestamp"],
#date_format="%Y/%m/%d %H:%M:%S",
infer_datetime_format=True,
)
Still has a bug.
INSTALLED VERSIONS
INSTALLED VERSIONS ------------------ commit : f538741 python : 3.11.4.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.19045 machine : AMD64 processor : AMD64 Family 23 Model 113 Stepping 0, AuthenticAMD byteorder : little LC_ALL : None LANG : en_US.UTF-8 LOCALE : Russian_Ukraine.1251pandas : 2.2.0
numpy : 1.26.4
pytz : 2024.1
dateutil : 2.8.2
setuptools : 65.5.0
pip : 24.0
Cython : None
pytest : 8.0.1
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : None
IPython : None
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : None
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.8.3
numba : None
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 15.0.0
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
zstandard : None
tzdata : 2024.1
qtpy : None
pyqt5 : None
from pandas.
Thanks for the report and investigation, confirmed on main. Further investigations and PRs to fix are welcome!
Also, while they appear as integers, I'm seeing that the output in the OP are in fact strings.
from pandas.
take
from pandas.
Related Issues (20)
- ENH: Be able to set dtype before creating a new column HOT 4
- TST: Some Stata test datasets do not match the expected version
- Failing benchmarks - About 3000 asv benchmark tests fail out of 7545 HOT 8
- BUG: Error when exporting empty DataFrame with MultiIndex on both axes to xlsx file
- BUG: inconsisntent construction results between `pd.array` and `pd.Series` for dtype=str HOT 9
- BUG: Boxplot does not apply colors set by Matplotlib rcParams for certain plot elements HOT 2
- Potential regression induced by PR #57588 HOT 1
- Pandas Extension: Drop Duplicated Columns HOT 2
- BUILD: error: metadata-generation-failed; ninja: build stopped: subcommand failed. HOT 5
- BUG: Pytest Version >=8.1 HOT 2
- BUG: Circle CI deprecates images
- DOC: SQL-style join conditions HOT 10
- BUG: fillna() doesn't work with `value=None` without method specified, but method is deprecated HOT 6
- BUG: to_sql does not get the correct dialect HOT 5
- ENH: interleave_columns function HOT 3
- QST: How to solve pandas (2.2.0) "FutureWarning: Downcasting behavior in `replace` is deprecated" on a Series? HOT 12
- BUG: ValueError with loc[] = (Regression 2.1.0) HOT 3
- ENH: Assign for pandas Series HOT 4
- BUG: Convertion fails for columns with datetime64[ms] HOT 3
- COMPAT: Utilize `copy` keyword in `__array__` 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.