{"cells":[{"metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","trusted":true},"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nimport os\nprint(os.listdir(\"../input\"))\n\n# Any results you write to the current directory are saved as output.","execution_count":null,"outputs":[]},{"metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","trusted":true},"cell_type":"code","source":"df = pd.read_csv('../input/train.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"ca569da2cbaffa4d56b682697fbde0c7c747bb48"},"cell_type":"code","source":"y = df['Volume']\nX = df.drop(['Volume','Date'],axis=1)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"5c8d11e609f5c596d3ca2ffa49a0993cb58fe9f7"},"cell_type":"code","source":"X.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"d944eb9b294e97c31b4dae561545202092b3cfbf"},"cell_type":"code","source":"y.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"30fbe6aab2617868536cb921fc320203e6189b06"},"cell_type":"code","source":"from sklearn.linear_model import LinearRegression","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"bba3780a64ca153fff8f21806ecd204214fab619"},"cell_type":"code","source":"reg = LinearRegression()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"a45271e03fa34cf2a9f9d34b8fd97260fc49f7c2"},"cell_type":"code","source":"reg.fit(X,y)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"40a9f478dd2332e693d6f927be4c1c3ab9344710"},"cell_type":"code","source":"test = pd.read_csv('../input/test.csv')","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"3551eb98567e6dd94f5e17f88c66bfc84a384ab7"},"cell_type":"code","source":"testdf = test.drop(['Date'],axis=1)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"e8d277c0f1b8cb42bce63487bfe466bd92dd94c0"},"cell_type":"code","source":"testdf.head()","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"87cdf3a5a87d329bf038d10d7781affaf4e1ad9b"},"cell_type":"code","source":"prediction = reg.predict(testdf)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true,"_uuid":"dd958fc7d0be5853f1a17dfa6e5d8da5bef3e80a"},"cell_type":"code","source":"serial = test['Date']\ndata = {'Date': serial, 'Volume': prediction}\nsubmission = pd.DataFrame(data)\nsubmission.to_csv('Submission.csv', index=False)","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"display_name":"Python 3","language":"python","name":"python3"},"language_info":{"name":"python","version":"3.6.6","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"}},"nbformat":4,"nbformat_minor":1}