{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "d86a6212-a23b-49fa-970a-d424e98f24bc", "metadata": { "execution": { "iopub.execute_input": "2021-06-21T23:07:20.189726Z", "iopub.status.busy": "2021-06-21T23:07:20.189104Z", "iopub.status.idle": "2021-06-21T23:07:20.392172Z", "shell.execute_reply": "2021-06-21T23:07:20.392519Z" }, "papermill": { "duration": 0.22194, "end_time": "2021-06-21T23:07:20.392755", "exception": false, "start_time": "2021-06-21T23:07:20.170815", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "import os\n", "import pandas as pd\n", "from datetime import datetime" ] }, { "cell_type": "code", "execution_count": 2, "id": "0b98548d-5720-4454-b667-f67df9996502", "metadata": { "execution": { "iopub.execute_input": "2021-06-21T23:07:20.413329Z", "iopub.status.busy": "2021-06-21T23:07:20.411598Z", "iopub.status.idle": "2021-06-21T23:07:20.414477Z", "shell.execute_reply": "2021-06-21T23:07:20.414054Z" }, "papermill": { "duration": 0.015962, "end_time": "2021-06-21T23:07:20.414684", "exception": false, "start_time": "2021-06-21T23:07:20.398722", "status": "completed" }, "tags": [] }, "outputs": [], "source": [ "user = os.environ['NB_USER']" ] }, { "cell_type": "code", "execution_count": 3, "id": "f5df050b-fef8-4e66-a8e7-d3230dd566dc", "metadata": { "execution": { "iopub.execute_input": "2021-06-21T23:07:20.439424Z", "iopub.status.busy": "2021-06-21T23:07:20.438606Z", "iopub.status.idle": "2021-06-21T23:07:20.459831Z", "shell.execute_reply": "2021-06-21T23:07:20.459461Z" }, "papermill": { "duration": 0.040953, "end_time": "2021-06-21T23:07:20.460060", "exception": false, "start_time": "2021-06-21T23:07:20.419107", "status": "completed" }, "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "input-1.csv\n", " userid name lastupdated\n", "0 u1 user1 2021-06-21 23:07:20.439644\n", "1 u2 user2 2021-06-21 23:07:20.439644\n", "input-2.csv\n", " userid name lastupdated\n", "0 u3 user3 2021-06-21 23:07:20.449851\n", "1 u4 user4 2021-06-21 23:07:20.449851\n" ] } ], "source": [ "# Update input csv files\n", "files = ['input-1.csv', 'input-2.csv']\n", "\n", "n=0\n", "for file in files:\n", " n=n+1\n", " print(file)\n", " input = pd.read_csv(file, header=0)\n", " input['lastupdated'] = datetime.now()\n", " input.to_csv('output-'+str(n)+'.csv', index=False)\n", " print(input)" ] }, { "cell_type": "code", "execution_count": null, "id": "dfb1b899-a005-4531-9982-6a6a605b570b", "metadata": { "papermill": { "duration": 0.004127, "end_time": "2021-06-21T23:07:20.469738", "exception": false, "start_time": "2021-06-21T23:07:20.465611", "status": "completed" }, "tags": [] }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.6" }, "papermill": { "default_parameters": {}, "duration": 1.452803, "end_time": "2021-06-21T23:07:20.787069", "environment_variables": {}, "exception": null, "input_path": "/home/jovyan/work/pipelines/producer.ipynb", "output_path": "/home/jovyan/work/pipelines/producer.ipynb", "parameters": {}, "start_time": "2021-06-21T23:07:19.334266", "version": "2.3.3" } }, "nbformat": 4, "nbformat_minor": 5 }