Repository: ranaroussi/yfinance

Issue:
Issues with Date field
This issue appeared in version 0.1.77. I did no other package or python version updates since then.

Following script used to work on the date field:
`df[df.Date > '2020-01-01']`

But I am now getting following error message: TypeError: '>' not supported between instances of 'Timestamp' and 'str'

When I solve that issue by converting the string to a date (pd.to_datetime), I am getting other issues like: ValueError: Tz-aware datetime.datetime cannot be converted to datetime64 unless utc=True

Somewhat further in my script, there is a pd.merge function based on the Date field received from yfinance. It gives now following error: Cannot compare between dtype('<M8[ns]') and dtype('0')

So I guess something has changed with how the dates are passed through. If yes, do you know how I can strip the received date from all these tz related stuff and just use it as a datetime64? I tried things like .dt.normalize() or .dt.date, but it always seems to give errors. 


Discussion:
Use `df.index`

Btw I can't reproduce your error message exactly so you're doing more than described.

For raw value try `df.index.values`
Thanks

I have a jupyter notebook where I run my script, and there I have no issue. But when I run the same script in the CLI, I get these error messages.

I will try to find a solution with your idea
Ok I should have read the changelog of 0.1.74, my bad.

To understand it better, I now get multiple rows per date when using yf.download(), is that how it should work now?
How can I manage to only get one row per date? 
It depends on your code. Hour/minute data obviously returns multiple rows per day.

If you think there's an error then you need to provide actual code we can run to reproduce.
For example 
`df = yf.download(['VWCE.F','SOLB.BR','AAPL'], period='1y', threads=False)`
`print(df['Close'])`

Before 0.1.75, I got 1 row per date. Now I get multiple rows (I understand that's because of the change with the timezones). 

What would be the method to get only 1 row per date? 
After some thought I can't decide if it's a bug or users fault. How do you use the results of `download()`?
After downloading, I create some extra columns to plot graphs on the data. As I used to get one row per date, it was easy. I wonder how other people use it as nobody seem to raise that issue. 

If it's not seen as a bug, I'll write some extra code to group by date. 
Hmm, so you deliberately ignore timezone. Ok - adding a `ignore_tz` argument is best and easy.
Yes indeed, thanks

Resolving patch:
diff --git a/yfinance/multi.py b/yfinance/multi.py
--- a/yfinance/multi.py
+++ b/yfinance/multi.py
@@ -29,7 +29,7 @@
 from . import shared
 
 
-def download(tickers, start=None, end=None, actions=False, threads=True,
+def download(tickers, start=None, end=None, actions=False, threads=True, ignore_tz=True, 
              group_by='column', auto_adjust=False, back_adjust=False, keepna=False,
              progress=True, period="max", show_errors=True, interval="1d", prepost=False,
              proxy=None, rounding=False, timeout=None, **kwargs):
@@ -63,6 +63,9 @@ def download(tickers, start=None, end=None, actions=False, threads=True,
             Download dividend + stock splits data. Default is False
         threads: bool / int
             How many threads to use for mass downloading. Default is True
+        ignore_tz: bool
+            When combining from different timezones, ignore that part of datetime.
+            Default is True
         proxy: str
             Optional. Proxy server URL scheme. Default is None
         rounding: bool
@@ -140,12 +143,17 @@ def download(tickers, start=None, end=None, actions=False, threads=True,
         ticker = tickers[0]
         return shared._DFS[shared._ISINS.get(ticker, ticker)]
 
+    if ignore_tz:
+        for tkr in shared._DFS.keys():
+            if (shared._DFS[tkr] is not None) and (shared._DFS[tkr].shape[0]>0):
+                shared._DFS[tkr].index = shared._DFS[tkr].index.tz_localize(None)
+
     try:
-        data = _pd.concat(shared._DFS.values(), axis=1,
+        data = _pd.concat(shared._DFS.values(), axis=1, sort=True,
                           keys=shared._DFS.keys())
     except Exception:
         _realign_dfs()
-        data = _pd.concat(shared._DFS.values(), axis=1,
+        data = _pd.concat(shared._DFS.values(), axis=1, sort=True,
                           keys=shared._DFS.keys())
 
     # switch names back to isins if applicable


Test patch: