Giter Site home page Giter Site logo

Comments (3)

Groni3000 avatar Groni3000 commented on September 26, 2024

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.1251

pandas : 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.

rhshadrach avatar rhshadrach commented on September 26, 2024

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.

ruimamaral avatar ruimamaral commented on September 26, 2024

take

from pandas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.