You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For best practices on creating virtual environments, please refer to the [RAP Community of Practice training resources](./docs/training_resources/python/virtual-environments/why-use-virtual-environments.md).
52
51
53
52
### Hosting
54
53
@@ -57,9 +56,6 @@ To host the website locally to view the live changes, run the command:
57
56
```bash
58
57
mkdocs serve
59
58
```
60
-
Open up http://127.0.0.1:8000/ in your browser, and you'll see the [RAP Community of Practice home page](https://nhsdigital.github.io/rap-community-of-practice/) being displayed with your updates applied.
61
-
62
-
Read more: [Getting Started with MkDocs](https://www.mkdocs.org/getting-started/#getting-started-with-mkdocs)
When creating different aggregations/groupings which are saved in different dataframes, you can then combine these aggregations into one table. For example, suppose you have calculated the totals for age and gender in different dataframes and you wish to append these results to the final output dataframe.
165
204
166
205
```py
206
+
# list the final output dataframe to store its aggregations
207
+
list_df = [df]
167
208
209
+
# append the calculated totals
210
+
list_df.append(calc_totals_df)
168
211
212
+
# concatenate into a single dataframe
213
+
output_df = pd.concat(list_df, axis=0)
169
214
```
170
215
171
216
### Creating derivations
172
217
173
218
To create a derivation based on the equivalent CASE WHEN SQL operation, there are several ways to do this in python:
As you were reading through this, did any ideas pop into your head about your own projects? Any values you keep having (or forgetting!) to change? Any bits of code you sometimes need to comment out? If so, you've got a prime candidate for using a config file! So give it a try - implement the above steps in your project and see what you think.
0 commit comments