The electrification of public transit systems represents a crucial strategy for advancing sustainable urban mobility. Thus, the development of efficient charging infrastructure and the optimization of fleet size emerge as major challenges for transit agencies. Switching from diesel buses to electric buses (Ebuses) will require increasing the fleet size to accommodate the limited range of Ebuses and the significant idle time required for charging. This study develops prediction models to estimate the required Ebus fleet size to maintain same transit route services for the case of overnight depot charging, using data from Ebuses operating in the City of Toronto. The analysis reveals that Ebuses equipped with diesel auxiliary heaters are less sensitive to temperature fluctuations compared to battery-heated buses. Thus, the required replacement factor, indicating the additional fleet needed to switch from diesel to Ebuses, varies depending on the heating system. Specifically, diesel-heated buses require a lower replacement factor (1.3) compared to battery-heated buses (1.4), with winter conditions exacerbating this disparity. Furthermore, the study employs vehicular, operational, route, and external variables to develop the prediction models. Additionally, SHAP analysis is utilized to interpret the machine learning models and evaluate the influence of the inputs on the required fleet size. The results show that the total distance traveled, and the average temperature are the primary factors affecting the fleet size for Ebuses using their batteries for heating, whereas the total distance traveled, and the average bus speed are the primary factors affecting the fleet size for Ebuses with diesel auxiliary heaters.