Skip to content

Commit

Permalink
refactor: csv read a csv file targs and reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasParenteau committed Oct 1, 2021
1 parent c86568f commit bd33206
Showing 1 changed file with 8 additions and 144 deletions.
152 changes: 8 additions & 144 deletions CSV/Read_a_csv_file.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,9 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "ae091609-882a-4242-a32f-7b355403969d",
"metadata": {
"execution": {
"iopub.execute_input": "2021-10-01T13:35:04.430020Z",
"iopub.status.busy": "2021-10-01T13:35:04.429592Z",
"iopub.status.idle": "2021-10-01T13:35:04.796637Z",
"shell.execute_reply": "2021-10-01T13:35:04.795839Z",
"shell.execute_reply.started": "2021-10-01T13:35:04.429951Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"import pandas"
Expand All @@ -72,17 +64,9 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "617d6182-dd9b-462e-ad64-26df5faf18ac",
"metadata": {
"execution": {
"iopub.execute_input": "2021-10-01T13:35:04.805323Z",
"iopub.status.busy": "2021-10-01T13:35:04.802913Z",
"iopub.status.idle": "2021-10-01T13:35:04.810551Z",
"shell.execute_reply": "2021-10-01T13:35:04.809891Z",
"shell.execute_reply.started": "2021-10-01T13:35:04.805280Z"
}
},
"metadata": {},
"outputs": [],
"source": [
"URL = \"YOUR_URL\""
Expand All @@ -106,16 +90,9 @@
},
{
"cell_type": "code",
"execution_count": 3,
"execution_count": null,
"id": "suited-adelaide",
"metadata": {
"execution": {
"iopub.execute_input": "2021-10-01T13:35:04.816397Z",
"iopub.status.busy": "2021-10-01T13:35:04.814386Z",
"iopub.status.idle": "2021-10-01T13:35:05.086589Z",
"shell.execute_reply": "2021-10-01T13:35:05.085939Z",
"shell.execute_reply.started": "2021-10-01T13:35:04.816361Z"
},
"papermill": {},
"tags": []
},
Expand All @@ -137,131 +114,18 @@
"id": "46f42343-1e53-4325-b708-bbbee1126a7a",
"metadata": {},
"source": [
"#"
"### Display result"
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": null,
"id": "dynamic-radius",
"metadata": {
"execution": {
"iopub.execute_input": "2021-10-01T13:35:05.087837Z",
"iopub.status.busy": "2021-10-01T13:35:05.087592Z",
"iopub.status.idle": "2021-10-01T13:35:05.106121Z",
"shell.execute_reply": "2021-10-01T13:35:05.105475Z",
"shell.execute_reply.started": "2021-10-01T13:35:05.087809Z"
},
"papermill": {},
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Date</th>\n",
" <th>Open</th>\n",
" <th>High</th>\n",
" <th>Low</th>\n",
" <th>Close</th>\n",
" <th>Adj Close</th>\n",
" <th>Volume</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>2000-08-30</td>\n",
" <td>273.899994</td>\n",
" <td>273.899994</td>\n",
" <td>273.899994</td>\n",
" <td>273.899994</td>\n",
" <td>273.899994</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>2000-08-31</td>\n",
" <td>274.799988</td>\n",
" <td>278.299988</td>\n",
" <td>274.799988</td>\n",
" <td>278.299988</td>\n",
" <td>278.299988</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>2000-09-01</td>\n",
" <td>277.000000</td>\n",
" <td>277.000000</td>\n",
" <td>277.000000</td>\n",
" <td>277.000000</td>\n",
" <td>277.000000</td>\n",
" <td>0.0</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>2000-09-04</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" <td>NaN</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>2000-09-05</td>\n",
" <td>275.799988</td>\n",
" <td>275.799988</td>\n",
" <td>275.799988</td>\n",
" <td>275.799988</td>\n",
" <td>275.799988</td>\n",
" <td>2.0</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Date Open High Low Close Adj Close \\\n",
"0 2000-08-30 273.899994 273.899994 273.899994 273.899994 273.899994 \n",
"1 2000-08-31 274.799988 278.299988 274.799988 278.299988 278.299988 \n",
"2 2000-09-01 277.000000 277.000000 277.000000 277.000000 277.000000 \n",
"3 2000-09-04 NaN NaN NaN NaN NaN \n",
"4 2000-09-05 275.799988 275.799988 275.799988 275.799988 275.799988 \n",
"\n",
" Volume \n",
"0 0.0 \n",
"1 0.0 \n",
"2 0.0 \n",
"3 NaN \n",
"4 2.0 "
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"df.head(5) #read the first 5 lines"
]
Expand Down

0 comments on commit bd33206

Please sign in to comment.