Repository: ranaroussi/yfinance
Issue category: Bug Report

Issue:
0.2.42 and onwards fails to pull most recent trading days data for ASX stocks
### Describe bug

Pulling stock data using versions 0.2.42 and onwards fails to pull the last trading days data for ASX stocks. This could be related to timezones but the issue doesn't exist in 0.2.41. 

### Simple code that reproduces your problem

`stock_data_daily = yf.download('CSL.AX', period='1y', interval='1d')`

### Debug log

DEBUG    Entering download()
DEBUG:yfinance:Entering download()
DEBUG     Disabling multithreading because DEBUG logging enabled
DEBUG:yfinance: Disabling multithreading because DEBUG logging enabled
DEBUG     Entering history()
DEBUG:yfinance: Entering history()
DEBUG      Entering history()
DEBUG:yfinance:  Entering history()
DEBUG       CSL.AX: Yahoo GET parameters: {'range': '1y', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG:yfinance:   CSL.AX: Yahoo GET parameters: {'range': '1y', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG       Entering get()
DEBUG:yfinance:   Entering get()
DEBUG        url=https://query2.finance.yahoo.com/v8/finance/chart/CSL.AX
DEBUG:yfinance:    url=https://query2.finance.yahoo.com/v8/finance/chart/CSL.AX
DEBUG        params={'range': '1y', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG:yfinance:    params={'range': '1y', 'interval': '1d', 'includePrePost': False, 'events': 'div,splits,capitalGains'}
DEBUG        Entering _get_cookie_and_crumb()
DEBUG:yfinance:    Entering _get_cookie_and_crumb()
DEBUG         cookie_mode = 'basic'
DEBUG:yfinance:     cookie_mode = 'basic'
DEBUG         Entering _get_cookie_and_crumb_basic()
DEBUG:yfinance:     Entering _get_cookie_and_crumb_basic()
DEBUG          reusing cookie
DEBUG:yfinance:      reusing cookie
DEBUG          reusing crumb
DEBUG:yfinance:      reusing crumb
DEBUG         Exiting _get_cookie_and_crumb_basic()
DEBUG:yfinance:     Exiting _get_cookie_and_crumb_basic()
DEBUG        Exiting _get_cookie_and_crumb()
DEBUG:yfinance:    Exiting _get_cookie_and_crumb()
DEBUG        response code=200
DEBUG:yfinance:    response code=200
DEBUG       Exiting get()
DEBUG:yfinance:   Exiting get()
DEBUG       CSL.AX: yfinance received OHLC data: 2023-11-07 23:00:00 -> 2024-11-08 05:10:12
DEBUG:yfinance:   CSL.AX: yfinance received OHLC data: 2023-11-07 23:00:00 -> 2024-11-08 05:10:12
DEBUG       CSL.AX: OHLC after cleaning: 2023-11-08 10:00:00+11:00 -> 2024-11-08 16:10:12+11:00
DEBUG:yfinance:   CSL.AX: OHLC after cleaning: 2023-11-08 10:00:00+11:00 -> 2024-11-08 16:10:12+11:00
DEBUG       CSL.AX: OHLC after combining events: 2023-11-08 00:00:00+11:00 -> 2024-11-08 00:00:00+11:00
DEBUG:yfinance:   CSL.AX: OHLC after combining events: 2023-11-08 00:00:00+11:00 -> 2024-11-08 00:00:00+11:00
DEBUG       CSL.AX: yfinance returning OHLC: 2023-11-08 00:00:00+11:00 -> 2024-11-07 00:00:00+11:00
DEBUG:yfinance:   CSL.AX: yfinance returning OHLC: 2023-11-08 00:00:00+11:00 -> 2024-11-07 00:00:00+11:00
DEBUG      Exiting history()
DEBUG:yfinance:  Exiting history()
DEBUG     Exiting history()
DEBUG:yfinance: Exiting history()
DEBUG    Exiting download()
DEBUG:yfinance:Exiting download()

### Bad data proof

_No response_

### `yfinance` version

>= 0.2.42 

### Python version

_No response_

### Operating system

_No response_


Hints:

Patch:
diff --git a/yfinance/utils.py b/yfinance/utils.py
index 0968f9d1..ebc8b99a 100644
--- a/yfinance/utils.py
+++ b/yfinance/utils.py
@@ -613,7 +613,7 @@ def fix_Yahoo_returning_live_separate(quotes, interval, tz_exchange, repair=Fals
             # - exception is volume, *slightly* greater on final row (and matches website)
             if dt1.date() == dt2.date():
                 # Last two rows are on same day. Drop second-to-last row
-                quotes = quotes.drop(quotes.index[n - 2])
+                quotes = _pd.concat([quotes.iloc[:-2], quotes.iloc[-1:]])
         else:
             if interval == "1wk":
                 last_rows_same_interval = dt1.year == dt2.year and dt1.week == dt2.week


Test patch: