Python Forum
unexpected output - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: unexpected output (/thread-30519.html)



unexpected output - asyrafcc99 - Oct-24-2020

def compile_data():
with open("dict.pickle","rb") as f:
tickers = pickle.load(f)

main_df = pd.DataFrame()

for count,ticker in enumerate(tickers):
df = pd.read_csv(r'C:\Users\User\Desktop\StockProject\5 stocks/{}.csv'.format(ticker))
df.set_index('date', inplace=True)

df.rename(columns={'close':ticker}, inplace=True)
df.drop(['no','ticker','name','per','open','high','low','volume','o/i'],1, inplace=True)
if main_df.empty:
main_df = df
else:
main_df = main_df.join(df, how='outer')

print(main_df.head())
main_df.to_csv('lastcombine.csv')

compile_data()
.
.
.
can someone help me with this problem? im trying to combine all 5 stock of historical prices into one but the output was not what am expected it to be. the date and close price went crazy.