File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -596,7 +596,7 @@ optimized_query = (df_full.lazy()
596596)
597597
598598print("Optimized query plan:")
599- print(optimized_query.describe_optimized_plan ())
599+ print(optimized_query.explain ())
600600```
601601
602602``` {code-cell} ipython3
@@ -728,8 +728,8 @@ def read_data_polars(ticker_list,
728728 """
729729 This function reads in closing price data from Yahoo
730730 for each tick in the ticker_list and returns a Polars DataFrame.
731+ Different indices may have different trading days, so we use joins to handle this.
731732 """
732- # Start with an empty list to collect DataFrames
733733 dataframes = []
734734
735735 for tick in ticker_list:
@@ -743,10 +743,12 @@ def read_data_polars(ticker_list,
743743 })
744744 dataframes.append(df)
745745
746- # Join all DataFrames on the Date column
746+ # Start with the first DataFrame
747747 result = dataframes[0]
748+
749+ # Join additional DataFrames, handling mismatched dates with full outer join
748750 for df in dataframes[1:]:
749- result = result.join(df, on='Date', how='outer' )
751+ result = result.join(df, on='Date', how='full', coalesce=True )
750752
751753 return result
752754
You can’t perform that action at this time.
0 commit comments