doyu commited on
Commit
571c2ab
·
1 Parent(s): b7a1682

add pandas usage

Browse files
Files changed (3) hide show
  1. README.md +23 -1
  2. nbs/00_project.ipynb +3 -1
  3. nbs/index.ipynb +42 -1
README.md CHANGED
@@ -27,4 +27,26 @@ pr
27
  pr.get()
28
  ```
29
 
30
- [['name', 'backlog item #', 'hours spent']]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  pr.get()
28
  ```
29
 
30
+ [['name', 'backlog item #', 'hours spent', 'date'],
31
+ ['Hiroshi Doyu', '25', '1', '2022/1/16'],
32
+ ['Michihito Mizutani', '28', '1', '2022/1/16']]
33
+
34
+ ``` python
35
+ import pandas as pd
36
+ ```
37
+
38
+ ``` python
39
+ df = pd.DataFrame(pr.get())
40
+ df.columns = df.iloc[0]
41
+ df = df[1:]
42
+ df['backlog item #'] = df['backlog item #'].astype(int)
43
+ df['hours spent'] = df['hours spent'].astype(int)
44
+ df.date = pd.to_datetime(df.date)
45
+ df.date = df.date.dt.strftime("%Y-%m-%d")
46
+ pr.put([df.columns.tolist()] + df.values.tolist())
47
+ pr.get()
48
+ ```
49
+
50
+ [['name', 'backlog item #', 'hours spent', 'date'],
51
+ ['Hiroshi Doyu', '25', '1', '2022/1/16'],
52
+ ['Michihito Mizutani', '28', '1', '2022/1/16']]
nbs/00_project.ipynb CHANGED
@@ -199,7 +199,9 @@
199
  {
200
  "data": {
201
  "text/plain": [
202
- "[['name', 'backlog item #', 'hours spent'], ['Hiroshi Doyu', '25', '1']]"
 
 
203
  ]
204
  },
205
  "execution_count": null,
 
199
  {
200
  "data": {
201
  "text/plain": [
202
+ "[['name', 'backlog item #', 'hours spent', 'date'],\n",
203
+ " ['Hiroshi Doyu', '25', '1', '2022/1/16'],\n",
204
+ " ['Michihito Mizutani', '28', '1', '2022/1/16']]"
205
  ]
206
  },
207
  "execution_count": null,
nbs/index.ipynb CHANGED
@@ -85,7 +85,9 @@
85
  {
86
  "data": {
87
  "text/plain": [
88
- "[['name', 'backlog item #', 'hours spent'], ['Hiroshi Doyu', '25', '1']]"
 
 
89
  ]
90
  },
91
  "execution_count": null,
@@ -96,6 +98,45 @@
96
  "source": [
97
  "pr.get()"
98
  ]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  }
100
  ],
101
  "metadata": {
 
85
  {
86
  "data": {
87
  "text/plain": [
88
+ "[['name', 'backlog item #', 'hours spent', 'date'],\n",
89
+ " ['Hiroshi Doyu', '25', '1', '2022/1/16'],\n",
90
+ " ['Michihito Mizutani', '28', '1', '2022/1/16']]"
91
  ]
92
  },
93
  "execution_count": null,
 
98
  "source": [
99
  "pr.get()"
100
  ]
101
+ },
102
+ {
103
+ "cell_type": "code",
104
+ "execution_count": null,
105
+ "metadata": {},
106
+ "outputs": [],
107
+ "source": [
108
+ "import pandas as pd"
109
+ ]
110
+ },
111
+ {
112
+ "cell_type": "code",
113
+ "execution_count": null,
114
+ "metadata": {},
115
+ "outputs": [
116
+ {
117
+ "data": {
118
+ "text/plain": [
119
+ "[['name', 'backlog item #', 'hours spent', 'date'],\n",
120
+ " ['Hiroshi Doyu', '25', '1', '2022/1/16'],\n",
121
+ " ['Michihito Mizutani', '28', '1', '2022/1/16']]"
122
+ ]
123
+ },
124
+ "execution_count": null,
125
+ "metadata": {},
126
+ "output_type": "execute_result"
127
+ }
128
+ ],
129
+ "source": [
130
+ "df = pd.DataFrame(pr.get())\n",
131
+ "df.columns = df.iloc[0]\n",
132
+ "df = df[1:]\n",
133
+ "df['backlog item #'] = df['backlog item #'].astype(int)\n",
134
+ "df['hours spent'] = df['hours spent'].astype(int)\n",
135
+ "df.date = pd.to_datetime(df.date)\n",
136
+ "df.date = df.date.dt.strftime(\"%Y-%m-%d\")\n",
137
+ "pr.put([df.columns.tolist()] + df.values.tolist())\n",
138
+ "pr.get()"
139
+ ]
140
  }
141
  ],
142
  "metadata": {