|
88 | 88 | <tbody> |
89 | 89 | <tr> |
90 | 90 | <td style="text-align:left;"> Gene_a </td> |
91 | | - <td style="text-align:right;"> 4.468014 </td> |
92 | | - <td style="text-align:right;"> 3.437752 </td> |
93 | | - <td style="text-align:right;"> 5.149918 </td> |
| 91 | + <td style="text-align:right;"> 3.376943 </td> |
| 92 | + <td style="text-align:right;"> 1.403601 </td> |
| 93 | + <td style="text-align:right;"> 4.453933 </td> |
94 | 94 | </tr> |
95 | 95 | <tr> |
96 | 96 | <td style="text-align:left;"> Gene_b </td> |
97 | | - <td style="text-align:right;"> 4.103818 </td> |
98 | | - <td style="text-align:right;"> 4.317566 </td> |
99 | | - <td style="text-align:right;"> 4.571179 </td> |
| 97 | + <td style="text-align:right;"> 3.954924 </td> |
| 98 | + <td style="text-align:right;"> 3.111149 </td> |
| 99 | + <td style="text-align:right;"> 4.236163 </td> |
100 | 100 | </tr> |
101 | 101 | <tr> |
102 | 102 | <td style="text-align:left;"> Gene_c </td> |
103 | | - <td style="text-align:right;"> 4.392184 </td> |
104 | | - <td style="text-align:right;"> 2.411998 </td> |
105 | | - <td style="text-align:right;"> 3.463501 </td> |
| 103 | + <td style="text-align:right;"> 2.474852 </td> |
| 104 | + <td style="text-align:right;"> 6.118265 </td> |
| 105 | + <td style="text-align:right;"> 3.487398 </td> |
106 | 106 | </tr> |
107 | 107 | <tr> |
108 | 108 | <td style="text-align:left;"> Gene_d </td> |
109 | | - <td style="text-align:right;"> 3.797285 </td> |
110 | | - <td style="text-align:right;"> 4.327807 </td> |
111 | | - <td style="text-align:right;"> 4.619082 </td> |
| 109 | + <td style="text-align:right;"> 3.789204 </td> |
| 110 | + <td style="text-align:right;"> 5.881517 </td> |
| 111 | + <td style="text-align:right;"> 3.576198 </td> |
112 | 112 | </tr> |
113 | 113 | <tr> |
114 | 114 | <td style="text-align:left;"> Gene_e </td> |
115 | | - <td style="text-align:right;"> 9.950121 </td> |
116 | | - <td style="text-align:right;"> 11.295234 </td> |
117 | | - <td style="text-align:right;"> 10.778082 </td> |
| 115 | + <td style="text-align:right;"> 9.677530 </td> |
| 116 | + <td style="text-align:right;"> 10.508473 </td> |
| 117 | + <td style="text-align:right;"> 10.675810 </td> |
118 | 118 | </tr> |
119 | 119 | <tr> |
120 | 120 | <td style="text-align:left;"> Gene_f </td> |
121 | | - <td style="text-align:right;"> 10.667297 </td> |
122 | | - <td style="text-align:right;"> 10.017559 </td> |
123 | | - <td style="text-align:right;"> 10.614511 </td> |
| 121 | + <td style="text-align:right;"> 8.859488 </td> |
| 122 | + <td style="text-align:right;"> 10.016861 </td> |
| 123 | + <td style="text-align:right;"> 9.449476 </td> |
124 | 124 | </tr> |
125 | 125 | <tr> |
126 | 126 | <td style="text-align:left;"> Gene_g </td> |
127 | | - <td style="text-align:right;"> 11.082942 </td> |
128 | | - <td style="text-align:right;"> 10.251958 </td> |
129 | | - <td style="text-align:right;"> 9.772934 </td> |
| 127 | + <td style="text-align:right;"> 8.579972 </td> |
| 128 | + <td style="text-align:right;"> 9.582080 </td> |
| 129 | + <td style="text-align:right;"> 10.846433 </td> |
130 | 130 | </tr> |
131 | 131 | <tr> |
132 | 132 | <td style="text-align:left;"> Gene_h </td> |
133 | | - <td style="text-align:right;"> 9.603787 </td> |
134 | | - <td style="text-align:right;"> 9.202378 </td> |
135 | | - <td style="text-align:right;"> 9.507146 </td> |
| 133 | + <td style="text-align:right;"> 9.727365 </td> |
| 134 | + <td style="text-align:right;"> 8.816762 </td> |
| 135 | + <td style="text-align:right;"> 8.779316 </td> |
136 | 136 | </tr> |
137 | 137 | </tbody> |
138 | 138 | </table> |
|
206 | 206 | ``` |
207 | 207 |
|
208 | 208 | --- |
209 | | -## Reading |
| 209 | +## Paths |
| 210 | + |
| 211 | +When you give a path to python it can either be relative or absolute. |
| 212 | + |
| 213 | + |
| 214 | + |
| 215 | + |
| 216 | +--- |
| 217 | +## Paths |
| 218 | + |
| 219 | +To use our map analogy: |
| 220 | + |
| 221 | +- Relative path are like directions i.e. take a left, go straight then take a right etc. The context of where you start is essential. |
| 222 | + |
| 223 | +- Absolute paths are like an address. They give the final location in absence of any other external information. |
| 224 | + |
| 225 | +Both have their benefits. |
| 226 | + |
| 227 | +--- |
| 228 | + |
| 229 | +## Paths in use |
| 230 | + |
| 231 | +The command we used before was using an absolute path. Typically they start with "/" to get to the top level of your computers file structure. |
| 232 | + |
| 233 | + |
| 234 | +``` python |
| 235 | +os.chdir("/Users/mattpaul/Downloads/Intro_To_Python-master/r_course/") |
| 236 | +``` |
| 237 | + |
| 238 | +Given that we started at: */Users/mattpaul*, we could have also used. This uses the knowledge that we are in that start position to find where we are going. |
| 239 | + |
| 240 | + |
| 241 | +``` python |
| 242 | +os.chdir("Downloads/Intro_To_Python-master/r_course/") |
| 243 | +``` |
| 244 | + |
| 245 | +--- |
| 246 | +## Back to Reading |
210 | 247 |
|
211 | 248 | There are many ways to read in data. Most of the time we are importing simple 2D tables, so we want to generate a NumPy array using the `genfromtxt()` function. |
212 | 249 |
|
213 | 250 | Here we are reading a csv file (Comma-Separated Values). This means each value in our file is separated by a comma. So when we read the file we will specify that the delimiter is a comma. |
214 | 251 |
|
| 252 | +We can use the relative path from our new working directory to find it. |
| 253 | + |
215 | 254 |
|
216 | 255 |
|
217 | 256 | ``` python |
|
509 | 548 |
|
510 | 549 | So far we have been working interactively with the console: asking it questions and getting answers back immediately. |
511 | 550 |
|
512 | | -When you want to run all your code, or if you want to start working on automation you can run a whole script instead. In this case we have all our code written out in a *.py document. |
| 551 | +When you want to run all your code, or if you want to start working on automation you can run a whole script instead. In this case we have all our code written out in a *.py document. This is good practice for matured analysis that you have finalized to ensure that you have everything properly documented. |
513 | 552 |
|
514 | 553 | Lets have a look at an example python script. |
515 | 554 |
|
|
616 | 655 | --- |
617 | 656 | ## An extra note |
618 | 657 |
|
619 | | -Keeping Your Code nice can be annoying. There exists many ways in which to store your code. Most of the time we are not writing scripts that are production level. Instead you will be doing an analysis of a data set and making decisions in an interactive manner. |
| 658 | +Keeping Your code nice can be annoying. There exists many ways in which to store your code. Most of the time we are not writing scripts that are production level. Instead you will be doing an analysis of a data set and making decisions in an interactive manner. |
620 | 659 |
|
621 | 660 | Notebooks give you a means to tie the code, the analysis decisions and the result of the code together into a single file. |
622 | 661 |
|
|
0 commit comments