title: How to change index frequency in a time series
body: <p>I am using the yfinance library to import data for a given stock. See code below:</p>
  
  <pre><code>import yfinance as yf
  from datetime import datetime as dt
  import pandas as pd
  
  # Naming Constants
  stock = "AAPL"
  start_date = "2014-01-01"
  end_date = "2018-01-01"
  
  # Importing all the data into a dataFrame
  stock_data = yf.download(stock, start=start_date, end=end_date)
  </code></pre>
  
  <p>When I call <code>print(stock_data.index)</code> I have the following:</p>
  
  <pre><code>DatetimeIndex(['2014-01-02', '2014-01-03', '2014-01-06', '2014-01-07', '2014-01-08', '2014-01-09', '2014-01-10', '2014-01-13', '2014-01-14', '2014-01-15',
                 ...
                 '2017-12-15', '2017-12-18', '2017-12-19', '2017-12-20', '2017-12-21', '2017-12-22', '2017-12-26', '2017-12-27', '2017-12-28', '2017-12-29'],
                dtype='datetime64[ns]', name='Date', length=1007, freq=None)
  </code></pre>
  
  <p>I wish to switch the frequency argument from None to daily since every Date refers to a trading day.</p>
  
  <p>When I say <code>stock_data.index.freq = 'B'</code> I get the following error:</p>
  
  <pre><code>ValueError: Inferred frequency None from passed values does not conform to passed frequency B
  </code></pre>
  
  <p>And if I put stock_data = stock_data.asfreq('B'), it will change the frequency but it will add certain lines that were not there originally and fills them with NA values.</p>
  
  <p>In other words, what is the offset ALIAS used for trading days?</p>
  
  <p>You can find the list of alias from the Pandas documentation here: <a href="https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases" rel="nofollow noreferrer">https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases</a></p>