#1871·yfinance

Inconsistent floating point values in history method

Author: melgazar9Created Feb 27, 2024Updated Sep 4, 2026

Describe bug

Not sure if this is an issue with yahoo-finance in general, the yfinance package here, or potentially even pandas. Floating point numbers 3+ decimals out are consistently returned differently on different time intervals and tickers.

Simple code that reproduces your problem

I tried this both with and without caching and on mac and ubuntu. It is more inconsistent on mac but also happens on ubuntu. Here's a reproducible example:

import yfinance as yf

t = yf.Ticker('AAPL')
for i in range(20):
    t.history(start='2020-01-02', interval='1d')

Debug log

N/A

Bad data proof

Screenshot 2024-02-26 at 6 58 40 PM Screenshot 2024-02-26 at 6 48 20 PM

yfinance version

0.2.37

Python version

3.10.12

Operating system

Mac M1 Chip and Ubuntu 22.04 LTS