diff --git a/.gitmodules b/.gitmodules index 8cdea47c..0264869c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -33,4 +33,7 @@ url = git@github.com:carpentries-i18n/instructor-training.git [submodule "lc-open-refine"] path = lc-open-refine - url = git@github.com:swcarpentry-ja/lc-open-refine + url = git@github.com:swcarpentry-ja/lc-open-refine.git +[submodule "bioc-rnaseq"] + path = bioc-rnaseq + url = git@github.com:swcarpentry-ja/bioc-rnaseq.git diff --git a/bioc-rnaseq b/bioc-rnaseq new file mode 160000 index 00000000..1f9846f3 --- /dev/null +++ b/bioc-rnaseq @@ -0,0 +1 @@ +Subproject commit 1f9846f3b1febe3e5879dd7ae5b65ca962f07b34 diff --git a/po/.ancestors/.bioc-rnaseq.ja.po.ancestor b/po/.ancestors/.bioc-rnaseq.ja.po.ancestor new file mode 100644 index 00000000..475ac04d --- /dev/null +++ b/po/.ancestors/.bioc-rnaseq.ja.po.ancestor @@ -0,0 +1,992 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: i18n\n" +"Report-Msgid-Bugs-To: https://github.com/haiwen/seafile-docs/issues\n" +"POT-Creation-Date: 2021-08-10 23:13:53+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: bioc-rnaseq/CODE_OF_CONDUCT.md:1 +# Front Matter +msgid "---\n" +"layout: page\n" +"title: \"Contributor Code of Conduct\"\n" +"---" +msgstr "" + +#: bioc-rnaseq/CODE_OF_CONDUCT.md:5 +msgid "As contributors and maintainers of this project,\n" +"we pledge to follow the [Carpentry Code of Conduct][coc]." +msgstr "" + +#: bioc-rnaseq/CODE_OF_CONDUCT.md:8 +msgid "Instances of abusive, harassing, or otherwise unacceptable behavior\n" +"may be reported by following our [reporting guidelines][coc-reporting]." +msgstr "" + +#: bioc-rnaseq/CODE_OF_CONDUCT.md:11 +#: bioc-rnaseq/_extras/discuss.md:6 +#: bioc-rnaseq/_extras/figures.md:79 +#: bioc-rnaseq/_extras/guide.md:6 +#: bioc-rnaseq/bin/boilerplate/_episodes/01-introduction.md:14 +#: bioc-rnaseq/bin/boilerplate/_extras/discuss.md:6 +#: bioc-rnaseq/bin/boilerplate/_extras/figures.md:79 +#: bioc-rnaseq/bin/boilerplate/_extras/guide.md:6 +#: bioc-rnaseq/bin/boilerplate/index.md:17 +#: bioc-rnaseq/bin/boilerplate/reference.md:9 +#: bioc-rnaseq/bin/boilerplate/setup.md:7 +#: bioc-rnaseq/index.md:19 +#: bioc-rnaseq/reference.md:9 +#: bioc-rnaseq/setup.md:7 +msgid "{% include links.md %}" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:1 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:1 +# header +msgid "# Contributing" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:3 +msgid "[The Carpentries][c-site],\n" +"([Software Carpentry][swc-site],\n" +"[Data Carpentry][dc-site],\n" +"and [Library Carpentry][lc-site]) are open source projects,\n" +"and we welcome contributions of all kinds:\n" +"new lessons,\n" +"fixes to existing material,\n" +"bug reports,\n" +"and reviews of proposed changes are all welcome." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:13 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:10 +# header +msgid "## Contributor Agreement" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:15 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:12 +msgid "By contributing,\n" +"you agree that we may redistribute your work under [our license](LICENSE.md).\n" +"In exchange,\n" +"we will address your issues and/or assess your change proposal as promptly as we can,\n" +"and help you become a member of our community.\n" +"Everyone involved in [The Carpentries][c-site]\n" +"agrees to abide by our [code of conduct](CODE_OF_CONDUCT.md)." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:23 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:20 +# header +msgid "## How to Contribute" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:25 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:22 +msgid "The easiest way to get started is to file an issue\n" +"to tell us about a spelling mistake,\n" +"some awkward wording,\n" +"or a factual error.\n" +"This is a good way to introduce yourself\n" +"and to meet some of our community members." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:32 +# ordered list +msgid "1. If you have a [GitHub][github] account," +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:33 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:35 +msgid " or are willing to [create one][github-join],\n" +" but do not know how to use Git,\n" +" you can report problems or suggest improvements by [creating an issue][issues].\n" +" This allows us to assign the item to someone\n" +" and to respond to it in a threaded discussion." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:39 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:41 +# ordered list +msgid "3. If you are comfortable with Git," +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:40 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:42 +msgid " and would like to add or change material,\n" +" you can submit a pull request (PR).\n" +" Instructions for doing this are [included below](#using-github)." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:44 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:46 +# header +msgid "## Where to Contribute" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:46 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:48 +# ordered list +msgid "1. If you wish to change this lesson," +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:47 +msgid " please work in ,\n" +" which can be viewed at ." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:50 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:52 +# ordered list +msgid "2. If you wish to change the example lesson," +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:51 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:53 +msgid " please work in ,\n" +" which documents the format of our lessons\n" +" and can be viewed at ." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:55 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:57 +# ordered list +msgid "3. If you wish to change the template used for workshop websites," +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:56 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:58 +msgid " please work in .\n" +" The home page of that repository explains how to set up workshop websites,\n" +" while the extra pages in \n" +" provide more background on our design choices." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:61 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:63 +# ordered list +msgid "4. If you wish to change CSS style files, tools," +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:62 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:64 +msgid " or HTML boilerplate for lessons or workshops stored in `_includes` or `_layouts`,\n" +" please work in ." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:65 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:67 +# header +msgid "## What to Contribute" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:67 +msgid "This is a new lesson under active development.\n" +"We welcome contributions of any kind at this early stage of the process." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:70 +msgid "There are many ways to contribute,\n" +"from writing new exercises and improving existing ones,\n" +"through adding lesson content and visual aids,\n" +"to updating or filling in the documentation\n" +"and submitting [bug reports][issues]\n" +"about things that don't work, aren't clear, or are missing.\n" +"If you are looking for ideas, please see\n" +"[the 'Issues' tab][repo-issues]\n" +"for a list of issues associated with this repository,\n" +"or you may also look at the issues for [Data Carpentry][dc-issues],\n" +"[Software Carpentry][swc-issues], and [Library Carpentry][lc-issues] projects." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:82 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:79 +msgid "Comments on issues and reviews of pull requests are just as welcome:\n" +"we are smarter together than we are on our own.\n" +"Reviews from novices and newcomers are particularly valuable:\n" +"it's easy for people who have been using these lessons for a while\n" +"to forget how impenetrable some of this material can be,\n" +"so fresh eyes are always welcome." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:89 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:86 +# header +msgid "## What *Not* to Contribute" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:91 +msgid "We are not looking for exercises or other material that only run on one platform.\n" +"Our workshops typically contain a mixture of Windows, macOS, and Linux users;\n" +"in order to be usable,\n" +"our lessons must run equally well on all three." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:96 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:102 +# header +msgid "## Using GitHub" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:98 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:104 +msgid "If you choose to contribute via GitHub, you may want to look at\n" +"[How to Contribute to an Open Source Project on GitHub][how-contribute].\n" +"To manage changes, we follow [GitHub flow][github-flow].\n" +"Each lesson has two maintainers who review issues and pull requests or encourage others to do so.\n" +"The maintainers are community volunteers and have final say over what gets merged into the lesson.\n" +"To use the web interface for contributing to a lesson:" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:105 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:111 +# ordered list +msgid "1. Fork the originating repository to your GitHub profile." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:106 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:112 +# ordered list +msgid "2. Within your version of the forked repository, move to the `gh-pages` branch and" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:107 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:113 +msgid "create a new branch for each significant change being made.\n" +"3. Navigate to the file(s) you wish to change within the new branches and make revisions as required.\n" +"4. Commit all changed files within the appropriate branches.\n" +"5. Create individual pull requests from each of your changed branches\n" +"to the `gh-pages` branch within the originating repository.\n" +"6. If you receive feedback, make changes using your issue-specific branches of the forked\n" +"repository and the pull requests will update automatically.\n" +"7. Repeat as needed until all feedback has been addressed." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:116 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:122 +msgid "When starting work, please make sure your clone of the originating `gh-pages` branch is up-to-date\n" +"before creating your own revision-specific branch(es) from there.\n" +"Additionally, please only work from your newly-created branch(es) and *not*\n" +"your clone of the originating `gh-pages` branch.\n" +"Lastly, published copies of all the lessons are available in the `gh-pages` branch of the originating\n" +"repository for reference while revising." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:123 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:129 +# header +msgid "## Other Resources" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:125 +msgid "General discussion of [The Carpentries][c-site]\n" +"happens on the [discussion mailing list][discuss-list],\n" +"which everyone is welcome to join.\n" +"You can also [join the `bioconductor-teaching` Google Group][bioc-teaching]\n" +"to join discussion of this and other Bioconductor lessons in\n" +"The Carpentries Incubator." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:132 +msgid "[bioc-teaching]: https://groups.google.com/g/bioconductor-teaching\n" +"[dc-issues]: https://github.com/issues?q=user%3Adatacarpentry\n" +"[dc-lessons]: http://datacarpentry.org/lessons/\n" +"[dc-site]: http://datacarpentry.org/\n" +"[discuss-list]: http://lists.software-carpentry.org/listinfo/discuss\n" +"[github]: https://github.com\n" +"[github-flow]: https://guides.github.com/introduction/flow/\n" +"[github-join]: https://github.com/join\n" +"[how-contribute]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github\n" +"[issues]: https://guides.github.com/features/issues/\n" +"[swc-issues]: https://github.com/issues?q=user%3Aswcarpentry\n" +"[swc-lessons]: https://software-carpentry.org/lessons/\n" +"[swc-site]: https://software-carpentry.org/\n" +"[c-site]: https://carpentries.org/\n" +"[lc-site]: https://librarycarpentry.org/\n" +"[lc-issues]: https://github.com/issues?q=user%3Alibrarycarpentry\n" +"[repo-issues]: https://github.com/carpentries-incubator/bioc-rnaseq/issues" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:1 +# Front Matter +msgid "---\n" +"layout: page\n" +"title: \"Licenses\"\n" +"root: .\n" +"---" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:6 +# header +msgid "## Instructional Material" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:8 +msgid "All Software Carpentry, Data Carpentry, and Library Carpentry instructional material is\n" +"made available under the [Creative Commons Attribution\n" +"license][cc-by-human]. The following is a human-readable summary of\n" +"(and not a substitute for) the [full legal text of the CC BY 4.0\n" +"license][cc-by-legal]." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:14 +msgid "You are free:" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:16 +# unordered list +msgid "* to **Share**---copy and redistribute the material in any medium or format" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:17 +# unordered list +msgid "* to **Adapt**---remix, transform, and build upon the material" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:19 +msgid "for any purpose, even commercially." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:21 +msgid "The licensor cannot revoke these freedoms as long as you follow the\n" +"license terms." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:24 +msgid "Under the following terms:" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:26 +# unordered list +msgid "* **Attribution**---You must give appropriate credit (mentioning that" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:27 +msgid " your work is derived from work that is Copyright © Software\n" +" Carpentry and, where practical, linking to\n" +" http://software-carpentry.org/), provide a [link to the\n" +" license][cc-by-human], and indicate if changes were made. You may do\n" +" so in any reasonable manner, but not in any way that suggests the\n" +" licensor endorses you or your use." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:34 +msgid "**No additional restrictions**---You may not apply legal terms or\n" +"technological measures that legally restrict others from doing\n" +"anything the license permits. With the understanding that:" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:38 +msgid "Notices:" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:40 +# unordered list +msgid "* You do not have to comply with the license for elements of the" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:41 +msgid " material in the public domain or where your use is permitted by an\n" +" applicable exception or limitation.\n" +"* No warranties are given. The license may not give you all of the\n" +" permissions necessary for your intended use. For example, other\n" +" rights such as publicity, privacy, or moral rights may limit how you\n" +" use the material." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:48 +# header +msgid "## Software" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:50 +msgid "Except where otherwise noted, the example programs and other software\n" +"provided by Software Carpentry and Data Carpentry are made available under the\n" +"[OSI][osi]-approved\n" +"[MIT license][mit-license]." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:55 +msgid "Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:63 +msgid "The above copyright notice and this permission notice shall be\n" +"included in all copies or substantial portions of the Software." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:66 +msgid "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" +"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" +"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" +"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" +"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:74 +# header +msgid "## Trademark" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:76 +msgid "\"Software Carpentry\" and \"Data Carpentry\" and their respective logos\n" +"are registered trademarks of [Community Initiatives][CI]." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:79 +msgid "[cc-by-human]: https://creativecommons.org/licenses/by/4.0/\n" +"[cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode\n" +"[mit-license]: https://opensource.org/licenses/mit-license.html\n" +"[ci]: http://communityin.org/\n" +"[osi]: https://opensource.org" +msgstr "" + +#: bioc-rnaseq/README.md:1 +# header +msgid "# RNA-seq analysis with Bioconductor" +msgstr "" + +#: bioc-rnaseq/README.md:3 +#: bioc-rnaseq/bin/boilerplate/README.md:3 +msgid "[![Create a Slack Account with us](https://img.shields.io/badge/Create_Slack_Account-The_Carpentries-071159.svg)](https://swc-slack-invite.herokuapp.com/)" +msgstr "" + +#: bioc-rnaseq/README.md:6 +#: bioc-rnaseq/bin/boilerplate/README.md:7 +# header +msgid "## Contributing" +msgstr "" + +#: bioc-rnaseq/README.md:8 +#: bioc-rnaseq/bin/boilerplate/README.md:9 +msgid "We welcome all contributions to improve the lesson! Maintainers will do their best to help you if you have any\n" +"questions, concerns, or experience any difficulties along the way." +msgstr "" + +#: bioc-rnaseq/README.md:11 +#: bioc-rnaseq/bin/boilerplate/README.md:12 +msgid "We'd like to ask you to familiarize yourself with our [Contribution Guide](CONTRIBUTING.md) and have a look at\n" +"the [more detailed guidelines][lesson-example] on proper formatting, ways to render the lesson locally, and even\n" +"how to write new episodes." +msgstr "" + +#: bioc-rnaseq/README.md:15 +msgid "Please see the current list of [issues][FIXME] for ideas for contributing to this\n" +"repository. For making your contribution, we use the GitHub flow, which is\n" +"nicely explained in the chapter [Contributing to a Project](http://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project) in Pro Git\n" +"by Scott Chacon.\n" +"Look for the tag ![good_first_issue](https://img.shields.io/badge/-good%20first%20issue-gold.svg). This indicates that the maintainers will welcome a pull request fixing this issue." +msgstr "" + +#: bioc-rnaseq/README.md:22 +# header +msgid "## Useful links" +msgstr "" + +#: bioc-rnaseq/README.md:24 +# unordered list +msgid "* [ ] If you're going to be developing lesson material for the first time" +msgstr "" + +#: bioc-rnaseq/README.md:25 +msgid " according to our design principles,\n" +" consider reading the [Carpentries Curriculum Development Handbook][cdh]\n" +"* [ ] Consult the [Lesson Example][lesson-example] website to find out more about\n" +" working with the lesson template" +msgstr "" + +#: bioc-rnaseq/README.md:31 +#: bioc-rnaseq/bin/boilerplate/README.md:23 +# header +msgid "## Maintainer(s)" +msgstr "" + +#: bioc-rnaseq/README.md:33 +msgid "Current maintainers of this lesson are" +msgstr "" + +#: bioc-rnaseq/README.md:35 +# unordered list +msgid "* Charlotte Soneson" +msgstr "" + +#: bioc-rnaseq/README.md:36 +# unordered list +msgid "* Jenny Drnevich" +msgstr "" + +#: bioc-rnaseq/README.md:37 +# unordered list +msgid "* Laurent Gatto" +msgstr "" + +#: bioc-rnaseq/README.md:38 +# unordered list +msgid "* Robert Castelo" +msgstr "" + +#: bioc-rnaseq/README.md:41 +#: bioc-rnaseq/bin/boilerplate/README.md:32 +# header +msgid "## Authors" +msgstr "" + +#: bioc-rnaseq/README.md:43 +#: bioc-rnaseq/bin/boilerplate/README.md:34 +msgid "A list of contributors to the lesson can be found in [AUTHORS](AUTHORS)" +msgstr "" + +#: bioc-rnaseq/README.md:45 +#: bioc-rnaseq/bin/boilerplate/README.md:36 +# header +msgid "## Citation" +msgstr "" + +#: bioc-rnaseq/README.md:47 +#: bioc-rnaseq/bin/boilerplate/README.md:38 +msgid "To cite this lesson, please consult with [CITATION](CITATION)" +msgstr "" + +#: bioc-rnaseq/README.md:49 +msgid "[cdh]: https://cdh.carpentries.org\n" +"[community-lessons]: https://carpentries.org/community-lessons\n" +"[lesson-example]: https://carpentries.github.io/lesson-example" +msgstr "" + +#: bioc-rnaseq/_extras/about.md:1 +#: bioc-rnaseq/bin/boilerplate/_extras/about.md:1 +# Front Matter +msgid "---\n" +"title: About\n" +"---" +msgstr "" + +#: bioc-rnaseq/_extras/about.md:4 +#: bioc-rnaseq/bin/boilerplate/_extras/about.md:4 +msgid "{% include carpentries.html %}\n" +"{% include links.md %}" +msgstr "" + +#: bioc-rnaseq/_extras/discuss.md:1 +#: bioc-rnaseq/bin/boilerplate/_extras/discuss.md:1 +# Front Matter +msgid "---\n" +"title: Discussion\n" +"---" +msgstr "" + +#: bioc-rnaseq/_extras/discuss.md:4 +#: bioc-rnaseq/_extras/guide.md:4 +#: bioc-rnaseq/bin/boilerplate/_episodes/01-introduction.md:12 +#: bioc-rnaseq/bin/boilerplate/_extras/discuss.md:4 +#: bioc-rnaseq/bin/boilerplate/_extras/guide.md:4 +#: bioc-rnaseq/bin/boilerplate/reference.md:7 +#: bioc-rnaseq/bin/boilerplate/setup.md:4 +#: bioc-rnaseq/reference.md:7 +#: bioc-rnaseq/setup.md:4 +msgid "FIXME" +msgstr "" + +#: bioc-rnaseq/_extras/figures.md:1 +#: bioc-rnaseq/bin/boilerplate/_extras/figures.md:1 +# Front Matter +msgid "---\n" +"title: Figures\n" +"---" +msgstr "" + +#: bioc-rnaseq/_extras/figures.md:5 +#: bioc-rnaseq/bin/boilerplate/_extras/figures.md:5 +msgid "{% include base_path.html %}\n" +"{% include manual_episode_order.html %}" +msgstr "" + +#: bioc-rnaseq/_extras/figures.md:8 +#: bioc-rnaseq/bin/boilerplate/_extras/figures.md:8 +# inline html +msgid "" +msgstr "" + +#: bioc-rnaseq/_extras/figures.md:68 +#: bioc-rnaseq/bin/boilerplate/_extras/figures.md:68 +msgid "{% comment %} Create anchor for each one of the episodes. {% endcomment %}" +msgstr "" + +#: bioc-rnaseq/_extras/figures.md:70 +#: bioc-rnaseq/bin/boilerplate/_extras/figures.md:70 +msgid "{% for lesson_episode in lesson_episodes %}\n" +" {% if site.episode_order %}\n" +" {% assign episode = site.episodes | where: \"slug\", lesson_episode | first %}\n" +" {% else %}\n" +" {% assign episode = lesson_episode %}\n" +" {% endif %}\n" +"
\n" +"{% endfor %}" +msgstr "" + +#: bioc-rnaseq/_extras/guide.md:1 +#: bioc-rnaseq/bin/boilerplate/_extras/guide.md:1 +# Front Matter +msgid "---\n" +"title: \"Instructor Notes\"\n" +"---" +msgstr "" + +#: bioc-rnaseq/_includes/links.md:1 +msgid "{% include base_path.html %}\n" +"[cc-by-human]: https://creativecommons.org/licenses/by/4.0/\n" +"[cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode\n" +"[ci]: http://communityin.org/\n" +"[coc-reporting]: https://docs.carpentries.org/topic_folders/policies/incident-reporting.html\n" +"[coc]: https://docs.carpentries.org/topic_folders/policies/code-of-conduct.html\n" +"[concept-maps]: https://carpentries.github.io/instructor-training/05-memory/\n" +"[contrib-covenant]: https://contributor-covenant.org/\n" +"[contributing]: {{ repo_url }}/blob/{{ source_branch }}/CONTRIBUTING.md\n" +"[cran-checkpoint]: https://cran.r-project.org/package=checkpoint\n" +"[cran-knitr]: https://cran.r-project.org/package=knitr\n" +"[cran-stringr]: https://cran.r-project.org/package=stringr\n" +"[dc-lessons]: http://www.datacarpentry.org/lessons/\n" +"[email]: mailto:team@carpentries.org\n" +"[github-importer]: https://import.github.com/\n" +"[importer]: https://github.com/new/import\n" +"[jekyll-collection]: https://jekyllrb.com/docs/collections/\n" +"[jekyll-install]: https://jekyllrb.com/docs/installation/\n" +"[jekyll-windows]: http://jekyll-windows.juthilo.com/\n" +"[jekyll]: https://jekyllrb.com/\n" +"[jupyter]: https://jupyter.org/\n" +"[kramdown]: https://kramdown.gettalong.org/\n" +"[lc-lessons]: https://librarycarpentry.org/lessons/\n" +"[lesson-aio]: {{ relative_root_path }}{% link aio.md %}\n" +"[lesson-coc]: {{ relative_root_path }}{% link CODE_OF_CONDUCT.md %}\n" +"[lesson-example]: https://carpentries.github.io/lesson-example/\n" +"[lesson-license]: {{ relative_root_path }}{% link LICENSE.md %}\n" +"[lesson-mainpage]: {{ relative_root_path }}{% link index.md %}\n" +"[lesson-reference]: {{ relative_root_path }}{% link reference.md %}\n" +"[lesson-setup]: {{ relative_root_path }}{% link setup.md %}\n" +"[mit-license]: https://opensource.org/licenses/mit-license.html\n" +"[morea]: https://morea-framework.github.io/\n" +"[numfocus]: https://numfocus.org/\n" +"[osi]: https://opensource.org\n" +"[pandoc]: https://pandoc.org/\n" +"[paper-now]: https://github.com/PeerJ/paper-now\n" +"[python-gapminder]: https://swcarpentry.github.io/python-novice-gapminder/\n" +"[pyyaml]: https://pypi.org/project/PyYAML/\n" +"[r-markdown]: https://rmarkdown.rstudio.com/\n" +"[rstudio]: https://www.rstudio.com/\n" +"[ruby-install-guide]: https://www.ruby-lang.org/en/downloads/\n" +"[ruby-installer]: https://rubyinstaller.org/\n" +"[rubygems]: https://rubygems.org/pages/download/\n" +"[styles]: https://github.com/carpentries/styles/\n" +"[swc-lessons]: https://software-carpentry.org/lessons/\n" +"[swc-releases]: https://github.com/swcarpentry/swc-releases\n" +"[training]: https://carpentries.github.io/instructor-training/\n" +"[workshop-repo]: {{ site.workshop_repo }}\n" +"[yaml]: http://yaml.org/" +msgstr "" + +#: bioc-rnaseq/aio.md:1 +# Front Matter +msgid "---\n" +"permalink: /aio/index.html\n" +"---" +msgstr "" + +#: bioc-rnaseq/aio.md:5 +msgid "{% comment %}\n" +"As a maintainer, you don't need to edit this file.\n" +"If you notice that something doesn't work, please \n" +"open an issue: https://github.com/carpentries/styles/issues/new\n" +"{% endcomment %}" +msgstr "" + +#: bioc-rnaseq/aio.md:11 +msgid "{% include base_path.html %}" +msgstr "" + +#: bioc-rnaseq/aio.md:13 +msgid "{% include aio-script.md %}" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:3 +msgid "[The Carpentries][c-site] ([Software Carpentry][swc-site], [Data Carpentry][dc-site], and [Library Carpentry][lc-site]) are open source projects,\n" +"and we welcome contributions of all kinds:\n" +"new lessons,\n" +"fixes to existing material,\n" +"bug reports,\n" +"and reviews of proposed changes are all welcome." +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:29 +# ordered list +msgid "1. If you do not have a [GitHub][github] account," +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:30 +msgid " you can [send us comments by email][email].\n" +" However,\n" +" we will be able to respond more quickly if you use one of the other methods described below." +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:34 +# ordered list +msgid "2. If you have a [GitHub][github] account," +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:49 +msgid " please work in ,\n" +" which can be viewed at ." +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:69 +msgid "There are many ways to contribute,\n" +"from writing new exercises and improving existing ones\n" +"to updating or filling in the documentation\n" +"and submitting [bug reports][issues]\n" +"about things that don't work, aren't clear, or are missing.\n" +"If you are looking for ideas, please see the 'Issues' tab for\n" +"a list of issues associated with this repository,\n" +"or you may also look at the issues for [Data Carpentry][dc-issues], \n" +"[Software Carpentry][swc-issues], and [Library Carpentry][lc-issues] projects." +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:88 +msgid "Our lessons already contain more material than we can cover in a typical workshop,\n" +"so we are usually *not* looking for more concepts or tools to add to them.\n" +"As a rule,\n" +"if you want to introduce a new idea,\n" +"you must (a) estimate how long it will take to teach\n" +"and (b) explain what you would take out to make room for it.\n" +"The first encourages contributors to be honest about requirements;\n" +"the second, to think hard about priorities." +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:97 +msgid "We are also not looking for exercises or other material that only run on one platform.\n" +"Our workshops typically contain a mixture of Windows, macOS, and Linux users;\n" +"in order to be usable,\n" +"our lessons must run equally well on all three." +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:131 +msgid "General discussion of [Software Carpentry][swc-site] and [Data Carpentry][dc-site]\n" +"happens on the [discussion mailing list][discuss-list],\n" +"which everyone is welcome to join.\n" +"You can also [reach us by email][email]." +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:136 +msgid "[email]: mailto:admin@software-carpentry.org\n" +"[dc-issues]: https://github.com/issues?q=user%3Adatacarpentry\n" +"[dc-lessons]: http://datacarpentry.org/lessons/\n" +"[dc-site]: http://datacarpentry.org/\n" +"[discuss-list]: http://lists.software-carpentry.org/listinfo/discuss\n" +"[github]: https://github.com\n" +"[github-flow]: https://guides.github.com/introduction/flow/\n" +"[github-join]: https://github.com/join\n" +"[how-contribute]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github\n" +"[issues]: https://guides.github.com/features/issues/\n" +"[swc-issues]: https://github.com/issues?q=user%3Aswcarpentry\n" +"[swc-lessons]: https://software-carpentry.org/lessons/\n" +"[swc-site]: https://software-carpentry.org/\n" +"[c-site]: https://carpentries.org/\n" +"[lc-site]: https://librarycarpentry.org/\n" +"[lc-issues]: https://github.com/issues?q=user%3Alibrarycarpentry" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/README.md:1 +# header +msgid "# FIXME Lesson title" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/README.md:5 +msgid "This repository generates the corresponding lesson website from [The Carpentries](https://carpentries.org/) repertoire of lessons. " +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/README.md:16 +msgid "Please see the current list of [issues][FIXME] for ideas for contributing to this\n" +"repository. For making your contribution, we use the GitHub flow, which is\n" +"nicely explained in the chapter [Contributing to a Project](http://git-scm.com/book/en/v2/GitHub-Contributing-to-a-Project) in Pro Git\n" +"by Scott Chacon.\n" +"Look for the tag ![good_first_issue](https://img.shields.io/badge/-good%20first%20issue-gold.svg). This indicates that the maintainers will welcome a pull request fixing this issue. " +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/README.md:25 +msgid "Current maintainers of this lesson are " +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/README.md:27 +#: bioc-rnaseq/bin/boilerplate/README.md:28 +#: bioc-rnaseq/bin/boilerplate/README.md:29 +# unordered list +msgid "* FIXME" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/README.md:40 +msgid "[lesson-example]: https://carpentries.github.io/lesson-example" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/_episodes/01-introduction.md:1 +# Front Matter +msgid "---\n" +"title: \"Introduction\"\n" +"teaching: 0\n" +"exercises: 0\n" +"questions:\n" +"- \"Key question (FIXME)\"\n" +"objectives:\n" +"- \"First learning objective. (FIXME)\"\n" +"keypoints:\n" +"- \"First key point. Brief Answer to questions. (FIXME)\"\n" +"---" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/index.md:1 +#: bioc-rnaseq/index.md:1 +# Front Matter +msgid "---\n" +"layout: lesson\n" +"root: . # Is the only page that doesn't follow the pattern /:path/index.html\n" +"permalink: index.html # Is the only page that doesn't follow the pattern /:path/index.html\n" +"---" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/index.md:6 +msgid "FIXME: home page introduction" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/index.md:8 +#: bioc-rnaseq/index.md:8 +msgid "" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/index.md:10 +#: bioc-rnaseq/index.md:10 +msgid "{% comment %} This is a comment in Liquid {% endcomment %}" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/index.md:12 +#: bioc-rnaseq/index.md:12 +# blockquote, which can be cascaded +msgid "> ## Prerequisites" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/index.md:13 +msgid ">\n" +"> FIXME" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/index.md:15 +#: bioc-rnaseq/index.md:17 +# SC/DC Template label +msgid "{: .prereq}" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/reference.md:1 +#: bioc-rnaseq/reference.md:1 +# Front Matter +msgid "---\n" +"layout: reference\n" +"---" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/reference.md:5 +#: bioc-rnaseq/reference.md:5 +# header +msgid "## Glossary" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/setup.md:1 +#: bioc-rnaseq/setup.md:1 +# Front Matter +msgid "---\n" +"title: Setup\n" +"---" +msgstr "" + +#: bioc-rnaseq/index.md:6 +msgid "FIXME: This lesson introduces the learner to RNA-seq analysis with [Bioconductor](https://bioconductor.org/). " +msgstr "" + +#: bioc-rnaseq/index.md:13 +msgid ">\n" +"> - Familiarity with R, for example corresponding to the ['Introduction to R'](https://carpentries-incubator.github.io/bioc-intro/) module.\n" +"> - Familiarity with statistical hypothesis testing (e.g., t-tests) and p-values.\n" +"> - Familiarity with the biological basics of gene expression and RNA sequencing." +msgstr "" + diff --git a/po/.ancestors/.python-ecology-lesson.ja.po.ancestor b/po/.ancestors/.python-ecology-lesson.ja.po.ancestor new file mode 100644 index 00000000..95f0fb3c --- /dev/null +++ b/po/.ancestors/.python-ecology-lesson.ja.po.ancestor @@ -0,0 +1,9468 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +msgid "" +msgstr "" +"Project-Id-Version: i18n\n" +"Report-Msgid-Bugs-To: https://github.com/haiwen/seafile-docs/issues\n" +"POT-Creation-Date: 2021-08-10 23:44:51+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: python-ecology-lesson/CODE_OF_CONDUCT.md:1 +# Front Matter +msgid "---\n" +"layout: page\n" +"title: \"Contributor Code of Conduct\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/CODE_OF_CONDUCT.md:6 +msgid "As contributors and maintainers of this project,\n" +"we pledge to follow the [Carpentry Code of Conduct][coc]." +msgstr "" + +#: python-ecology-lesson/CODE_OF_CONDUCT.md:9 +msgid "Instances of abusive, harassing, or otherwise unacceptable behavior\n" +"may be reported by following our [reporting guidelines][coc-reporting]." +msgstr "" + +#: python-ecology-lesson/CODE_OF_CONDUCT.md:12 +#: python-ecology-lesson/_episodes/00-before-we-start.md:257 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:481 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:541 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:376 +#: python-ecology-lesson/_episodes/05-merging-data.md:424 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:695 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:596 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:375 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:161 +#: python-ecology-lesson/_extras/figures.md:68 +#: python-ecology-lesson/_extras/guide.md:745 +#: python-ecology-lesson/index.md:38 +msgid "{% include links.md %}" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:1 +# header +msgid "# Contributing" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:3 +msgid "[The Carpentries][c-site] ([Software Carpentry][swc-site], [Data Carpentry][dc-site], and [Library Carpentry][lc-site]) are open source projects,\n" +"and we welcome contributions of all kinds:\n" +"new lessons,\n" +"fixes to existing material,\n" +"bug reports,\n" +"and reviews of proposed changes are all welcome." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:10 +# header +msgid "## Contributor Agreement" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:12 +msgid "By contributing,\n" +"you agree that we may redistribute your work under [our license](LICENSE.md).\n" +"In exchange,\n" +"we will address your issues and/or assess your change proposal as promptly as we can,\n" +"and help you become a member of our community.\n" +"Everyone involved in [The Carpentries][c-site]\n" +"agrees to abide by our [code of conduct](CODE_OF_CONDUCT.md)." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:20 +# header +msgid "## How to Contribute" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:22 +msgid "The easiest way to get started is to file an issue\n" +"to tell us about a spelling mistake,\n" +"some awkward wording,\n" +"or a factual error.\n" +"This is a good way to introduce yourself\n" +"and to meet some of our community members." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:29 +# ordered list +msgid "1. If you do not have a [GitHub][github] account," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:30 +msgid " you can [send us comments by email][email].\n" +" However,\n" +" we will be able to respond more quickly if you use one of the other methods described below." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:34 +# ordered list +msgid "2. If you have a [GitHub][github] account," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:35 +msgid " or are willing to [create one][github-join],\n" +" but do not know how to use Git,\n" +" you can report problems or suggest improvements by [creating an issue][issues].\n" +" This allows us to assign the item to someone\n" +" and to respond to it in a threaded discussion." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:41 +# ordered list +msgid "3. If you are comfortable with Git," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:42 +msgid " and would like to add or change material,\n" +" you can submit a pull request (PR).\n" +" Instructions for doing this are [included below](#using-github)." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:46 +# header +msgid "## Where to Contribute" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:48 +# ordered list +msgid "1. If you wish to change this lesson," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:49 +msgid " please work in ,\n" +" which can be viewed at ." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:52 +# ordered list +msgid "2. If you wish to change the example lesson," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:53 +msgid " please work in ,\n" +" which documents the format of our lessons\n" +" and can be viewed at ." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:57 +# ordered list +msgid "3. If you wish to change the template used for workshop websites," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:58 +msgid " please work in .\n" +" The home page of that repository explains how to set up workshop websites,\n" +" while the extra pages in \n" +" provide more background on our design choices." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:63 +# ordered list +msgid "4. If you wish to change CSS style files, tools," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:64 +msgid " or HTML boilerplate for lessons or workshops stored in `_includes` or `_layouts`,\n" +" please work in ." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:67 +# header +msgid "## What to Contribute" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:69 +msgid "There are many ways to contribute,\n" +"from writing new exercises and improving existing ones\n" +"to updating or filling in the documentation\n" +"and submitting [bug reports][issues]\n" +"about things that don't work, aren't clear, or are missing.\n" +"If you are looking for ideas, please see the 'Issues' tab for\n" +"a list of issues associated with this repository,\n" +"or you may also look at the issues for [Data Carpentry][dc-issues],\n" +"[Software Carpentry][swc-issues], and [Library Carpentry][lc-issues] projects." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:79 +msgid "Comments on issues and reviews of pull requests are just as welcome:\n" +"we are smarter together than we are on our own.\n" +"Reviews from novices and newcomers are particularly valuable:\n" +"it's easy for people who have been using these lessons for a while\n" +"to forget how impenetrable some of this material can be,\n" +"so fresh eyes are always welcome." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:86 +# header +msgid "## What *Not* to Contribute" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:88 +msgid "Our lessons already contain more material than we can cover in a typical workshop,\n" +"so we are usually *not* looking for more concepts or tools to add to them.\n" +"As a rule,\n" +"if you want to introduce a new idea,\n" +"you must (a) estimate how long it will take to teach\n" +"and (b) explain what you would take out to make room for it.\n" +"The first encourages contributors to be honest about requirements;\n" +"the second, to think hard about priorities." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:97 +msgid "We are also not looking for exercises or other material that only run on one platform.\n" +"Our workshops typically contain a mixture of Windows, macOS, and Linux users;\n" +"in order to be usable,\n" +"our lessons must run equally well on all three." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:102 +# header +msgid "## Using GitHub" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:104 +msgid "If you choose to contribute via GitHub, you may want to look at\n" +"[How to Contribute to an Open Source Project on GitHub][how-contribute].\n" +"To manage changes, we follow [GitHub flow][github-flow].\n" +"Each lesson has two maintainers who review issues and pull requests or encourage others to do so.\n" +"The maintainers are community volunteers and have final say over what gets merged into the lesson.\n" +"To use the web interface for contributing to a lesson:" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:111 +# ordered list +msgid "1. Fork the originating repository to your GitHub profile." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:112 +# ordered list +msgid "2. Within your version of the forked repository, move to the `gh-pages` branch and" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:113 +msgid "create a new branch for each significant change being made.\n" +"3. Navigate to the file(s) you wish to change within the new branches and make revisions as required.\n" +"4. Commit all changed files within the appropriate branches.\n" +"5. Create individual pull requests from each of your changed branches\n" +"to the `gh-pages` branch within the originating repository.\n" +"6. If you receive feedback, make changes using your issue-specific branches of the forked\n" +"repository and the pull requests will update automatically.\n" +"7. Repeat as needed until all feedback has been addressed." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:122 +msgid "When starting work, please make sure your clone of the originating `gh-pages` branch is up-to-date\n" +"before creating your own revision-specific branch(es) from there.\n" +"Additionally, please only work from your newly-created branch(es) and *not*\n" +"your clone of the originating `gh-pages` branch.\n" +"Lastly, published copies of all the lessons are available in the `gh-pages` branch of the originating\n" +"repository for reference while revising." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:129 +# header +msgid "## Other Resources" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:131 +msgid "General discussion of [Software Carpentry][swc-site] and [Data Carpentry][dc-site]\n" +"happens on the [discussion mailing list][discuss-list],\n" +"which everyone is welcome to join.\n" +"You can also [reach us by email][email]." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:136 +msgid "[email]: mailto:admin@software-carpentry.org\n" +"[dc-issues]: https://github.com/issues?q=user%3Adatacarpentry\n" +"[dc-lessons]: http://datacarpentry.org/lessons/\n" +"[dc-site]: http://datacarpentry.org/\n" +"[discuss-list]: http://lists.software-carpentry.org/listinfo/discuss\n" +"[github]: https://github.com\n" +"[github-flow]: https://guides.github.com/introduction/flow/\n" +"[github-join]: https://github.com/join\n" +"[how-contribute]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github\n" +"[issues]: https://guides.github.com/features/issues/\n" +"[swc-issues]: https://github.com/issues?q=user%3Aswcarpentry\n" +"[swc-lessons]: https://software-carpentry.org/lessons/\n" +"[swc-site]: https://software-carpentry.org/\n" +"[c-site]: https://carpentries.org/\n" +"[lc-site]: https://librarycarpentry.org/\n" +"[lc-issues]: https://github.com/issues?q=user%3Alibrarycarpentry" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:1 +# Front Matter +msgid "---\n" +"layout: page\n" +"title: \"Licenses\"\n" +"root: .\n" +"---" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:6 +# header +msgid "## Instructional Material" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:8 +msgid "All Software Carpentry, Data Carpentry, and Library Carpentry instructional material is\n" +"made available under the [Creative Commons Attribution\n" +"license][cc-by-human]. The following is a human-readable summary of\n" +"(and not a substitute for) the [full legal text of the CC BY 4.0\n" +"license][cc-by-legal]." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:14 +msgid "You are free:" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:16 +# unordered list +msgid "* to **Share**---copy and redistribute the material in any medium or format" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:17 +# unordered list +msgid "* to **Adapt**---remix, transform, and build upon the material" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:19 +msgid "for any purpose, even commercially." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:21 +msgid "The licensor cannot revoke these freedoms as long as you follow the\n" +"license terms." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:24 +msgid "Under the following terms:" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:26 +# unordered list +msgid "* **Attribution**---You must give appropriate credit (mentioning that" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:27 +msgid " your work is derived from work that is Copyright © Software\n" +" Carpentry and, where practical, linking to\n" +" http://software-carpentry.org/), provide a [link to the\n" +" license][cc-by-human], and indicate if changes were made. You may do\n" +" so in any reasonable manner, but not in any way that suggests the\n" +" licensor endorses you or your use." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:34 +msgid "**No additional restrictions**---You may not apply legal terms or\n" +"technological measures that legally restrict others from doing\n" +"anything the license permits. With the understanding that:" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:38 +msgid "Notices:" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:40 +# unordered list +msgid "* You do not have to comply with the license for elements of the" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:41 +msgid " material in the public domain or where your use is permitted by an\n" +" applicable exception or limitation.\n" +"* No warranties are given. The license may not give you all of the\n" +" permissions necessary for your intended use. For example, other\n" +" rights such as publicity, privacy, or moral rights may limit how you\n" +" use the material." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:48 +# header +msgid "## Software" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:50 +msgid "Except where otherwise noted, the example programs and other software\n" +"provided by Software Carpentry and Data Carpentry are made available under the\n" +"[OSI][osi]-approved\n" +"[MIT license][mit-license]." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:55 +msgid "Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:63 +msgid "The above copyright notice and this permission notice shall be\n" +"included in all copies or substantial portions of the Software." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:66 +msgid "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" +"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" +"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" +"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" +"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:74 +# header +msgid "## Trademark" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:76 +msgid "\"Software Carpentry\" and \"Data Carpentry\" and their respective logos\n" +"are registered trademarks of [Community Initiatives][CI]." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:79 +msgid "[cc-by-human]: https://creativecommons.org/licenses/by/4.0/\n" +"[cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode\n" +"[mit-license]: https://opensource.org/licenses/mit-license.html\n" +"[ci]: http://communityin.org/\n" +"[osi]: https://opensource.org" +msgstr "" + +#: python-ecology-lesson/README.md:1 +msgid "[![Create a Slack Account with us](https://img.shields.io/badge/Create_Slack_Account-The_Carpentries-071159.svg)](https://swc-slack-invite.herokuapp.com/)\n" +"[![Slack Status](https://img.shields.io/badge/Slack_Channel-dc--ecology--py-E01563.svg)](https://swcarpentry.slack.com/messages/C9X44HCDS)" +msgstr "" + +#: python-ecology-lesson/README.md:5 +# header +msgid "## Data Carpentry Python Lessons with Ecological Data" +msgstr "" + +#: python-ecology-lesson/README.md:7 +msgid "This repository contains the Data Carpentry Python material based on ecological\n" +"data. Please see our [contribution guidelines](CONTRIBUTING.md) for information\n" +"on how to contribute updates, bug fixes, or other corrections." +msgstr "" + +#: python-ecology-lesson/README.md:11 +# header +msgid "### Maintainers" +msgstr "" + +#: python-ecology-lesson/README.md:13 +# unordered list +msgid "- April Wright ([@wrightaprilm](https://github.com/wrightaprilm))" +msgstr "" + +#: python-ecology-lesson/README.md:14 +# unordered list +msgid "- Tania Allard ([@trallard](https://github.com/trallard))" +msgstr "" + +#: python-ecology-lesson/README.md:15 +# unordered list +msgid "- Maxim Belkin ([@maxim-belkin](https://github.com/maxim-belkin))" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:1 +# Front Matter +msgid "---\n" +"title: Before we start\n" +"teaching: 30\n" +"exercises: 0\n" +"questions:\n" +" - \"What is Python and why should I learn it?\"\n" +"objectives:\n" +" - \"Describe the purpose of the editor, console, help, variable explorer and file explorer panes in\n" +" Spyder.\"\n" +" - \"Organize files and directories for a set of analyses as a Python project, and understand the\n" +" purpose of the working directory.\"\n" +" - \"Know where to find help.\"\n" +" - \"Demonstrate how to provide sufficient information for troubleshooting with the Python user\n" +" community.\"\n" +"keypoints:\n" +" - \"Python is an open source and platform independent programming language.\"\n" +" - \"SciPy ecosystem for Python provides the tools necessary for scientific computing.\"\n" +" - \"Jupyter Notebook and the Spyder IDE are great tools to code in and interact with Python. With\n" +" the large Python community it is easy to find help in the internet.\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:22 +msgid "
\n" +"## What is Python?\n" +"Python is a general purpose programming language that supports rapid development of data analytics\n" +"applications. The word \"Python\" is used to refer to both, the programming language and the tool\n" +"that executes the scripts written in Python language." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:28 +msgid "Its main advantages are:" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:30 +# unordered list +msgid "* Free" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:31 +# unordered list +msgid "* Open-source" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:32 +# unordered list +msgid "* Available on all major platforms (macOS, Linux, Windows)" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:33 +# unordered list +msgid "* Supported by Python Software Foundation" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:34 +# unordered list +msgid "* Supports multiple programming paradigms" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:35 +# unordered list +msgid "* Has large community" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:36 +# unordered list +msgid "* Rich ecosystem of third-party packages" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:38 +msgid "*So, why do you need Python for data analysis?*" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:40 +# unordered list +msgid "- **Easy to learn:**" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:41 +msgid "Python is easier to learn than other programming languages. This is important because lower barriers\n" +"mean it is easier for new members of the community to get up to speed." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:44 +# unordered list +msgid "- **Reproducibility:**" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:45 +msgid "Reproducibility is the ability to obtain the same results using the same dataset(s) and analysis." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:47 +msgid "Data analysis written as a Python script can be reproduced on any platform. Moreover, if you\n" +"collect more or correct existing data, you can quickly and easily re-run your analysis!" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:50 +msgid "An increasing number of journals and funding agencies expect analyses to be reproducible,\n" +"so knowing Python will give you an edge with these requirements." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:53 +# unordered list +msgid "- **Versatility:**" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:54 +msgid "Python is a versatile language that integrates with many existing applications to enable something\n" +"completely amazing. For example, one can use Python to generate manuscripts, so that if you need to\n" +"update your data, analysis procedure, or change something else, you can quickly regenerate all the\n" +"figures and your manuscript will be updated automatically." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:59 +msgid "Python can read text files, connect to databases, and many other data formats, on your computer or\n" +"on the web." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:62 +# unordered list +msgid "- **Interdisciplinary and extensible:**" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:63 +msgid "Python provides a framework that allows anyone to combine approaches from different research\n" +"(but not only) disciplines to best suit your analysis needs." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:66 +# unordered list +msgid "- **Python has a large and welcoming community:**" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:67 +msgid "Thousands of people use Python daily. Many of them are willing to help you through mailing lists and\n" +"websites, such as [Stack Overflow][stack-overflow] and [Anaconda community\n" +"portal][anaconda-community]." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:71 +# unordered list +msgid "- **Free and Open-Source Software (FOSS)... and Cross-Platform:**" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:72 +msgid "We know we have already said that but it is worth repeating." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:74 +msgid "
\n" +"## Knowing your way around Anaconda\n" +"[Anaconda][anaconda] distribution of Python includes a lot of its popular packages,\n" +"such as the IPython console, Jupyter Notebook, and Spyder IDE.\n" +"Have a quick look around the Anaconda Navigator. You can launch programs from the Navigator or use the command line." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:80 +msgid "The [Jupyter Notebook](https://jupyter.org) is an open-source web application that allows you to create\n" +"and share documents that allow one to easilty create documents that combine code, graphs, and narrative text.\n" +"[Spyder][spyder-ide] is an **Integrated Development Environment** that\n" +"allows one to write Python scripts and interact with the Python software from within a single interface." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:85 +msgid "Anaconda also comes with a package manager called [conda](https://conda.io/docs/),\n" +"which makes it easy to install and update additional packages." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:88 +msgid "
\n" +"## Research Project: Best Practices\n" +"It is a good idea to keep a set of related data, analyses, and text in a single folder.\n" +"All scripts and text files within this folder can then use relative paths to the data files.\n" +"Working this way makes it a lot easier to move around your project and share it with others." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:95 +# header +msgid "### Organizing your working directory" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:96 +msgid "Using a consistent folder structure across your projects will help you keep things organized,\n" +"and will also make it easy to find/file things in the future. This can be especially helpful\n" +"when you have multiple projects. In general, you may wish to create separate directories for\n" +"your scripts, data, and documents." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:101 +# unordered list +msgid "- **`data/`**: Use this folder to store your raw data. For the sake of transparency and provenance," +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:102 +msgid "you should always keep a copy of your **raw data**. If you need to cleanup data, do it\n" +"programmatically (_i.e._ with scripts) and make sure to separate cleaned up data from the raw data.\n" +"For example, you can store raw data in files `./data/raw/` and clean data in `./data/clean/`." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:106 +# unordered list +msgid "- **`documents/`**: Use this folder to store outlines, drafts, and other text." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:108 +# unordered list +msgid "- **`scripts/`**: Use this folder to store your (Python) scripts for data cleaning, analysis, and" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:109 +msgid "plotting that you use in this particular project." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:111 +msgid "You may need to create additional directories depending on your project needs, but these should form\n" +"the backbone of your project's directory. For this workshop, we will need a `data/` folder to store\n" +"our raw data, and we will later create a `data_output/` folder when we learn how to export data as\n" +"CSV files." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:117 +# header +msgid "## What is Programming and Coding?" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:119 +msgid "Programming is the process of writing _\"programs\"_ that a computer can execute and produce some\n" +"(useful) output.\n" +"Programming is a multi-step process that involves the following steps:" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:123 +# ordered list +msgid "1. Identifying the aspects of the real-world problem that can be solved computationally" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:124 +# ordered list +msgid "2. Identifying (the best) computational solution" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:125 +# ordered list +msgid "3. Implementing the solution in a specific computer language" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:126 +# ordered list +msgid "4. Testing, validating, and adjusting implemented solution." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:128 +msgid "While _\"Programming\"_ refers to all of the above steps,\n" +"_\"Coding\"_ refers to step 3 only: _\"Implementing the solution in a specific computer language\"_." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:131 +# header +msgid "#### If you are working with Jupyter notebook:" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:133 +msgid "You can type Python code into a code cell and then execute the code by pressing\n" +"Shift+Return.\n" +"Output will be printed directly under the input cell.\n" +"You can recognise a code cell by the `In[ ]:` at the beginning of the cell and output by `Out[ ]:`.\n" +"Pressing the __+__ button in the menu bar will add a new cell.\n" +"All your commands as well as any output will be saved with the notebook." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:140 +# header +msgid "#### If you are working with Spyder:" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:142 +msgid "You can either use the console or use script files (plain text files that contain your code). The\n" +"console pane (in Spyder, the bottom right panel) is the place where commands written in the Python\n" +"language can be typed and executed immediately by the computer. It is also where the results will be\n" +"shown. You can execute commands directly in the console by pressing Return, but they\n" +"will be \"lost\" when you close the session. Spyder uses the [IPython](http://ipython.org) console by\n" +"default." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:149 +msgid "Since we want our code and workflow to be reproducible, it is better to type the commands in\n" +"the script editor, and save them as a script. This way, there is a complete record of what we did,\n" +"and anyone (including our future selves!) can easily reproduce the results on their computer." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:153 +msgid "Spyder allows you to execute commands directly from the script editor by using the run buttons on\n" +"top. To run the entire script click _Run file_ or press F5, to run the current line\n" +"click _Run selection or current line_ or press F9, other run buttons allow to run script\n" +"cells or go into debug mode. When using F9, the command on the current line in the script\n" +"(indicated by the cursor) or all of the commands in the currently selected text will be sent to the\n" +"console and executed." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:160 +msgid "At some point in your analysis you may want to check the content of a variable or the structure of\n" +"an object, without necessarily keeping a record of it in your script. You can type these commands\n" +"and execute them directly in the console. Spyder provides the\n" +"Ctrl+Shift+E and Ctrl+Shift+I\n" +"shortcuts to allow you to jump between the script and the console panes." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:166 +msgid "If Python is ready to accept commands, the IPython console shows an `In [..]:` prompt with the\n" +"current console line number in `[]`. If it receives a command (by typing, copy-pasting or sent from\n" +"the script editor), Python will execute it, display the results in the `Out [..]:` cell, and come\n" +"back with a new `In [..]:` prompt waiting for new commands." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:171 +msgid "If Python is still waiting for you to enter more data because it isn’t complete yet, the console\n" +"will show a `...:` prompt. It means that you haven’t finished entering a complete command. This can\n" +"be because you have not typed a closing parenthesis (`)`, `]`, or `}`) or quotation mark. When this\n" +"happens, and you thought you finished typing your command, click inside the console window and press\n" +"Esc; this will cancel the incomplete command and return you to the `In [..]:` prompt." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:177 +# header +msgid "## How to learn more after the workshop?" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:179 +msgid "The material we cover during this workshop will give you an initial taste of how you can use Python\n" +"to analyze data for your own research. However, you will need to learn more to do advanced\n" +"operations such as cleaning your dataset, using statistical methods, or creating beautiful graphics.\n" +"The best way to become proficient and efficient at python, as with any other tool, is to use it to\n" +"address your actual research questions. As a beginner, it can feel daunting to have to write a\n" +"script from scratch, and given that many people make their code available online, modifying existing\n" +"code to suit your purpose might make it easier for you to get started." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:187 +# header +msgid "## Seeking help" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:189 +# unordered list +msgid "* check under the _Help_ menu" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:190 +# unordered list +msgid "* type `help()`" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:191 +# unordered list +msgid "* type `?object` or `help(object)` to get information about an object" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:192 +# unordered list +msgid "* [Python documentation][python-docs]" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:194 +msgid "Finally, a generic Google or internet search \"Python task\" will often either send you to the\n" +"appropriate module documentation or a helpful forum where someone else has already asked your\n" +"question." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:198 +msgid "I am stuck... I get an error message that I don’t understand.\n" +"Start by googling the error message. However, this doesn’t always work very well, because often,\n" +"package developers rely on the error catching provided by python. You end up with general error\n" +"messages that might not be very helpful to diagnose a problem (e.g. \"subscript out of bounds\"). If\n" +"the message is very generic, you might also include the name of the function or package you’re using\n" +"in your query." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:205 +msgid "However, you should check Stack Overflow. Search using the `python` tag. Most questions have already\n" +"been answered, but the challenge is to use the right words in the search to find the answers:\n" +"" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:209 +# header +msgid "### Asking for help" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:211 +msgid "The key to receiving help from someone is for them to rapidly grasp your problem. You should make it\n" +"as easy as possible to pinpoint where the issue might be." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:214 +msgid "Try to use the correct words to describe your problem. For instance, a package is not the same thing\n" +"as a library. Most people will understand what you meant, but others have really strong feelings\n" +"about the difference in meaning. The key point is that it can make things confusing for people\n" +"trying to help you. Be as precise as possible when describing your problem." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:219 +msgid "If possible, try to reduce what doesn’t work to a simple reproducible example. If you can reproduce\n" +"the problem using a very small data frame instead of your 50,000 rows and 10,000 columns one,\n" +"provide the small one with the description of your problem. When appropriate, try to generalize what\n" +"you are doing so even people who are not in your field can understand the question. For instance,\n" +"instead of using a subset of your real dataset, create a small (3 columns, 5 rows) generic one." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:225 +# header +msgid "### Where to ask for help?" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:227 +# unordered list +msgid "* The person sitting next to you during the workshop. Don’t hesitate to talk to your neighbor during" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:228 +msgid "the workshop, compare your answers, and ask for help. You might also be interested in organizing\n" +"regular meetings following the workshop to keep learning from each other.\n" +"* Your friendly colleagues: if you know someone with more experience than you, they might be able and\n" +"willing to help you.\n" +"* [Stack Overflow][so-python]: if your question hasn’t been answered before and is well crafted,\n" +"chances are you will get an answer in less than 5 min. Remember to follow their guidelines on how to\n" +"ask a good question.\n" +"* [Python mailing lists][python-mailing-lists]" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:237 +# header +msgid "## More resources" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:239 +# unordered list +msgid "- [PyPI - the Python Package Index][pypi]" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:241 +# unordered list +msgid "- [The Hitchhiker's Guide to Python][python-guide]" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:243 +# unordered list +msgid "- [Dive into Python 3][dive-into-python3]" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:246 +msgid "[anaconda]: https://www.anaconda.com\n" +"[anaconda-community]: https://www.anaconda.com/community\n" +"[dive-into-python3]: https://finderiko.com/python-book\n" +"[pypi]: https://pypi.python.org/pypi\n" +"[python-docs]: https://www.python.org/doc\n" +"[python-guide]: https://docs.python-guide.org\n" +"[python-mailing-lists]: https://www.python.org/community/lists\n" +"[stack-overflow]: https://stackoverflow.com\n" +"[so-python]: https://stackoverflow.com/questions/tagged/python\n" +"[spyder-ide]: https://www.spyder-ide.org" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:1 +# Front Matter +msgid "---\n" +"title: Short Introduction to Programming in Python\n" +"teaching: 0\n" +"exercises: 0\n" +"questions:\n" +" - \"What is Python?\"\n" +" - \"Why should I learn Python?\"\n" +"objectives:\n" +" - \"Describe the advantages of using programming vs. completing repetitive tasks by hand.\"\n" +" - \"Define the following data types in Python: strings, integers, and floats.\"\n" +" - \"Perform mathematical operations in Python using basic operators.\"\n" +" - \"Define the following as it relates to Python: lists, tuples, and dictionaries.\"\n" +"keypoints:\n" +" - \"Python is an interpreted language which can be used interactively (executing one command at a time) or in scripting mode (executing a series of commands saved in file).\"\n" +" - \"One can assign a value to a variable in Python. Those variables can be of several types, such as string, integer, floating point and complex numbers.\"\n" +" - \"Lists and tuples are similar in that they are ordered lists of elements; they differ in that a tuple is immutable (cannot be changed).\"\n" +" - \"Dictionaries are unordered data structures that provide mappings between keys and values.\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:20 +# header +msgid "## Interpreter" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:22 +msgid "Python is an interpreted language which can be used in two ways:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:24 +# unordered list +msgid "* \"Interactively\": when you use it as an \"advanced calculator\" executing" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:25 +msgid " one command at a time. To start Python in this mode, simply execute `python`\n" +" on the command line:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:28 +# code block +msgid "~~~\n" +"$ python\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:31 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:69 +#: python-ecology-lesson/_extras/guide.md:27 +#: python-ecology-lesson/setup.md:68 +#: python-ecology-lesson/setup.md:88 +#: python-ecology-lesson/setup.md:98 +#: python-ecology-lesson/setup.md:108 +msgid "{: .language-bash}" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:33 +# code block +msgid "~~~\n" +"Python 3.5.1 (default, Oct 23 2015, 18:05:06)\n" +"[GCC 4.8.3] on linux2\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more information.\n" +">>>\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:39 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:52 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:61 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:74 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:100 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:112 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:121 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:130 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:145 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:153 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:181 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:202 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:211 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:219 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:227 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:242 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:251 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:260 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:269 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:287 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:304 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:326 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:341 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:378 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:393 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:404 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:420 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:436 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:450 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:479 +#: python-ecology-lesson/_episodes/02-starting-with-data.md:88 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:291 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:340 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:101 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:115 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:128 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:223 +#: python-ecology-lesson/_episodes/05-merging-data.md:279 +#: python-ecology-lesson/_episodes/05-merging-data.md:358 +#: python-ecology-lesson/_episodes/05-merging-data.md:381 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:47 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:62 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:81 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:91 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:138 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:190 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:204 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:242 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:350 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:360 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:516 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:554 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:608 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:659 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:94 +#: python-ecology-lesson/_extras/guide.md:61 +#: python-ecology-lesson/_extras/guide.md:71 +#: python-ecology-lesson/_extras/guide.md:614 +# SC/DC Template label +msgid "{: .output}" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:41 +msgid "Chevrons `>>>` indicate an interactive prompt in Python, meaning that it is waiting for your\n" +"input." +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:44 +# code block +msgid "~~~\n" +"2 + 2\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:47 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:87 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:197 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:297 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:321 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:357 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:429 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:53 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:76 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:85 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:103 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:124 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:169 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:182 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:200 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:219 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:230 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:262 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:281 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:309 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:326 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:333 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:372 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:392 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:399 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:406 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:465 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:487 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:501 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:510 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:522 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:89 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:96 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:110 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:123 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:137 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:175 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:188 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:205 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:218 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:280 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:290 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:300 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:308 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:344 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:359 +#: python-ecology-lesson/_episodes/05-merging-data.md:68 +#: python-ecology-lesson/_episodes/05-merging-data.md:91 +#: python-ecology-lesson/_episodes/05-merging-data.md:109 +#: python-ecology-lesson/_episodes/05-merging-data.md:128 +#: python-ecology-lesson/_episodes/05-merging-data.md:138 +#: python-ecology-lesson/_episodes/05-merging-data.md:194 +#: python-ecology-lesson/_episodes/05-merging-data.md:221 +#: python-ecology-lesson/_episodes/05-merging-data.md:256 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:42 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:53 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:77 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:86 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:120 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:159 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:259 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:271 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:333 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:345 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:355 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:395 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:406 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:411 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:437 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:454 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:510 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:601 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:52 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:87 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:104 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:120 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:163 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:175 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:188 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:203 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:220 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:235 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:253 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:292 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:307 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:357 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:367 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:380 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:394 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:415 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:444 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:525 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:542 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:560 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:588 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:57 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:78 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:107 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:116 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:159 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:166 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:186 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:210 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:241 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:263 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:336 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:54 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:82 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:103 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:150 +#: python-ecology-lesson/_extras/guide.md:66 +#: python-ecology-lesson/_extras/guide.md:132 +#: python-ecology-lesson/_extras/guide.md:139 +#: python-ecology-lesson/_extras/guide.md:155 +#: python-ecology-lesson/_extras/guide.md:247 +#: python-ecology-lesson/_extras/guide.md:317 +#: python-ecology-lesson/_extras/guide.md:357 +#: python-ecology-lesson/_extras/guide.md:411 +#: python-ecology-lesson/_extras/guide.md:430 +#: python-ecology-lesson/_extras/guide.md:444 +#: python-ecology-lesson/_extras/guide.md:462 +#: python-ecology-lesson/_extras/guide.md:470 +#: python-ecology-lesson/_extras/guide.md:491 +#: python-ecology-lesson/_extras/guide.md:505 +#: python-ecology-lesson/_extras/guide.md:524 +#: python-ecology-lesson/_extras/guide.md:627 +#: python-ecology-lesson/_extras/guide.md:658 +#: python-ecology-lesson/_extras/guide.md:672 +#: python-ecology-lesson/_extras/guide.md:699 +#: python-ecology-lesson/_extras/guide.md:732 +msgid "{: .language-python}" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:49 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:199 +# code block +msgid "~~~\n" +"4\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:54 +# code block +msgid "~~~\n" +"print(\"Hello World\")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:57 +msgid "{: .language-python}\n" +"~~~\n" +"Hello World\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:63 +# unordered list +msgid "* \"Scripting\" Mode: executing a series of \"commands\" saved in text file," +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:64 +msgid " usually with a `.py` extension after the name of your file:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:66 +# code block +msgid "~~~\n" +"$ python my_script.py\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:71 +# code block +msgid "~~~\n" +"Hello World\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:76 +# header +msgid "## Introduction to Python built-in data types" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:78 +# header +msgid "### Strings, integers, and floats" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:80 +msgid "One of the most basic things we can do in Python is assign values to variables:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:82 +# code block +msgid "~~~\n" +"text = \"Data Carpentry\" # An example of a string\n" +"number = 42 # An example of an integer\n" +"pi_value = 3.1415 # An example of a float\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:89 +msgid "Here we've assigned data to the variables `text`, `number` and `pi_value`,\n" +"using the assignment operator `=`. To review the value of a variable, we\n" +"can type the name of the variable into the interpreter and press Return:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:93 +# code block +msgid "~~~\n" +"text\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:96 +msgid "{: .language-python}\n" +"~~~\n" +"\"Data Carpentry\"\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:102 +msgid "Everything in Python has a type. To get the type of something, we can pass it\n" +"to the built-in function `type`:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:105 +# code block +msgid "~~~\n" +"type(text)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:108 +msgid "{: .language-python}\n" +"~~~\n" +"\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:114 +# code block +msgid "~~~\n" +"type(number)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:117 +msgid "{: .language-python}\n" +"~~~\n" +"\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:123 +# code block +msgid "~~~\n" +"type(pi_value)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:126 +msgid "{: .language-python}\n" +"~~~\n" +"\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:132 +msgid "The variable `text` is of type `str`, short for \"string\". Strings hold\n" +"sequences of characters, which can be letters, numbers, punctuation\n" +"or more exotic forms of text (even emoji!)." +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:136 +msgid "We can also see the value of something using another built-in function, `print`:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:138 +# code block +msgid "~~~\n" +"print(text)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:141 +msgid "{: .language-python}\n" +"~~~\n" +"Data Carpentry\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:146 +# code block +msgid "~~~\n" +"print(number)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:149 +msgid "{: .language-python}\n" +"~~~\n" +"11\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:155 +msgid "This may seem redundant, but in fact it's the only way to display output in a script:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:157 +msgid "*example.py*\n" +"~~~\n" +"# A Python script file\n" +"# Comments in Python start with #\n" +"# The next line assigns the string \"Data Carpentry\" to the variable \"text\".\n" +"text = \"Data Carpentry\"" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:164 +# header +msgid "# The next line does nothing!" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:165 +msgid "text" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:167 +# header +msgid "# The next line uses the print function to print out the value we assigned to \"text\"" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:168 +msgid "print(text)\n" +"~~~\n" +"{: .language-python}" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:172 +msgid "*Running the script*\n" +"~~~\n" +"$ python example.py\n" +"~~~\n" +"{: .language-bash}" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:178 +# code block +msgid "~~~\n" +"Data Carpentry\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:183 +msgid "Notice that \"Data Carpentry\" is printed only once." +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:185 +msgid "**Tip**: `print` and `type` are built-in functions in Python. Later in this\n" +"lesson, we will introduce methods and user-defined functions. The Python\n" +"documentation is excellent for reference on the differences between them." +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:189 +# header +msgid "### Operators" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:191 +msgid "We can perform mathematical calculations in Python using the basic operators\n" +" `+, -, /, *, %`:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:194 +# code block +msgid "~~~\n" +"2 + 2 # Addition\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:204 +# code block +msgid "~~~\n" +"6 * 7 # Multiplication\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:207 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:475 +msgid "{: .language-python}\n" +"~~~\n" +"42\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:212 +# code block +msgid "~~~\n" +"2 ** 16 # Power\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:215 +msgid "{: .language-python}\n" +"~~~\n" +"65536\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:220 +# code block +msgid "~~~\n" +"13 % 5 # Modulo\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:223 +msgid "{: .language-python}\n" +"~~~\n" +"3\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:229 +msgid "We can also use comparison and logic operators:\n" +"`<, >, ==, !=, <=, >=` and statements of identity such as\n" +"`and, or, not`. The data type returned by this is\n" +"called a _boolean_." +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:235 +# code block +msgid "~~~\n" +"3 > 4\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:238 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:265 +msgid "{: .language-python}\n" +"~~~\n" +"False\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:244 +# code block +msgid "~~~\n" +"True and True\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:247 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:256 +msgid "{: .language-python}\n" +"~~~\n" +"True\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:253 +# code block +msgid "~~~\n" +"True or False\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:262 +# code block +msgid "~~~\n" +"True and False\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:271 +# header +msgid "## Sequences: Lists and Tuples" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:273 +# header +msgid "### Lists" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:275 +msgid "**Lists** are a common data structure to hold an ordered sequence of\n" +"elements. Each element can be accessed by an index. Note that Python\n" +"indexes start with 0 instead of 1:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:279 +# code block +msgid "~~~\n" +"numbers = [1, 2, 3]\n" +"numbers[0]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:283 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:374 +msgid "{: .language-python}\n" +"~~~\n" +"1\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:289 +msgid "A `for` loop can be used to access the elements in a list or other Python data\n" +"structure one at a time:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:292 +# code block +msgid "~~~\n" +">>> for num in numbers:\n" +"... print(num)\n" +"...\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:299 +# code block +msgid "~~~\n" +"1\n" +"2\n" +"3\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:306 +msgid "**Indentation** is very important in Python. Note that the second line in the\n" +"example above is indented. Just like three chevrons `>>>` indicate an\n" +"interactive prompt in Python, the three dots `...` are Python's prompt for\n" +"multiple lines. This is Python's way of marking a block of code. [Note: you\n" +"do not type `>>>` or `...`.]" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:312 +msgid "To add elements to the end of a list, we can use the `append` method. Methods\n" +"are a way to interact with an object (a list, for example). We can invoke a\n" +"method using the dot `.` followed by the method name and a list of arguments\n" +"in parentheses. Let's look at an example using `append`:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:317 +# code block +msgid "~~~\n" +"numbers.append(4)\n" +"print(numbers)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:323 +# code block +msgid "~~~\n" +"[1, 2, 3, 4]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:328 +msgid "To find out what methods are available for an\n" +"object, we can use the built-in `help` command:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:331 +# code block +msgid "~~~\n" +"help(numbers)\n" +"\n" +"Help on list object:\n" +"\n" +"class list(object)\n" +" | list() -> new empty list\n" +" | list(iterable) -> new list initialized from iterable's items\n" +" ...\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:343 +# header +msgid "### Tuples" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:345 +msgid "A tuple is similar to a list in that it's an ordered sequence of elements.\n" +"However, tuples can not be changed once created (they are \"immutable\"). Tuples\n" +"are created by placing comma-separated values inside parentheses `()`." +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:349 +# code block +msgid "~~~\n" +"# Tuples use parentheses\n" +"a_tuple = (1, 2, 3)\n" +"another_tuple = ('blue', 'green', 'red')\n" +"\n" +"# Note: lists use square brackets\n" +"a_list = [1, 2, 3]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:359 +# blockquote, which can be cascaded +msgid "> ## Tuples _vs._ Lists" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:360 +# blockquote, which can be cascaded +msgid "> 1. What happens when you execute `a_list[1] = 5`?" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:361 +# blockquote, which can be cascaded +msgid "> 2. What happens when you execute `a_tuple[2] = 5`?" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:362 +# blockquote, which can be cascaded +msgid "> 3. What does `type(a_tuple)` tell you about `a_tuple`?" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:363 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:458 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:154 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:361 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:444 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:539 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:236 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:324 +#: python-ecology-lesson/_episodes/05-merging-data.md:146 +#: python-ecology-lesson/_episodes/05-merging-data.md:408 +#: python-ecology-lesson/_episodes/05-merging-data.md:422 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:104 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:298 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:372 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:480 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:575 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:693 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:141 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:276 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:345 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:486 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:506 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:573 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:218 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:327 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:357 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:373 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:124 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:159 +#: python-ecology-lesson/_extras/extra_challenges.md:46 +# SC/DC Template label +msgid "{: .challenge}" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:366 +# header +msgid "## Dictionaries" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:368 +msgid "A **dictionary** is a container that holds pairs of objects - keys and values." +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:370 +# code block +msgid "~~~\n" +"translation = {'one': 1, 'two': 2}\n" +"translation['one']\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:380 +msgid "Dictionaries work a lot like lists - except that you index them with *keys*.\n" +"You can think about a key as a name for or a unique identifier for a set of values\n" +"in the dictionary. Keys can only have particular types - they have to be\n" +"\"hashable\". Strings and numeric types are acceptable, but lists aren't." +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:385 +# code block +msgid "~~~\n" +"rev = {1: 'one', 2: 'two'}\n" +"rev[1]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:389 +msgid "{: .language-python}\n" +"~~~\n" +"'one'\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:395 +# code block +msgid "~~~\n" +"bad = {[1, 2, 3]: 3}\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:398 +msgid "{: .language-python}\n" +"~~~\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: unhashable type: 'list'\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:406 +msgid "In Python, a \"Traceback\" is an multi-line error block printed out for the\n" +"user." +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:409 +msgid "To add an item to the dictionary we assign a value to a new key:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:411 +# code block +msgid "~~~\n" +"rev = {1: 'one', 2: 'two'}\n" +"rev[3] = 'three'\n" +"rev\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:416 +#: python-ecology-lesson/_extras/guide.md:57 +msgid "{: .language-python}\n" +"~~~\n" +"{1: 'one', 2: 'two', 3: 'three'}\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:422 +msgid "Using `for` loops with dictionaries is a little more complicated. We can do\n" +"this in two ways:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:425 +# code block +msgid "~~~\n" +"for key, value in rev.items():\n" +" print(key, '->', value)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:431 +# code block +msgid "~~~\n" +"1 -> one\n" +"2 -> two\n" +"3 -> three\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:438 +msgid "or" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:440 +# code block +msgid "~~~\n" +"for key in rev.keys():\n" +" print(key, '->', rev[key])\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:444 +msgid "{: .language-python}\n" +"~~~\n" +"1 -> one\n" +"2 -> two\n" +"3 -> three\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:452 +# blockquote, which can be cascaded +msgid "> ## Changing dictionaries" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:453 +msgid ">\n" +"> 1. First, print the value of the `rev` dictionary to the screen.\n" +"> 2. Reassign the value that corresponds to the key `2` so that it no longer\n" +"> reads \"two\" but instead \"apple-sauce\".\n" +"> 3. Print the value of `rev` to the screen again to see if the value has changed." +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:461 +# header +msgid "## Functions" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:463 +msgid "Defining a section of code as a function in Python is done using the `def`\n" +"keyword. For example a function that takes two arguments and returns their sum\n" +"can be defined as:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:467 +# code block +msgid "~~~\n" +"def add_function(a, b):\n" +" result = a + b\n" +" return result\n" +"\n" +"z = add_function(20, 22)\n" +"print(z)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:1 +# Front Matter +msgid "---\n" +"title: Starting With Data\n" +"teaching: 30\n" +"exercises: 30\n" +"questions:\n" +" - \"How can I import data in Python?\"\n" +" - \"What is Pandas?\"\n" +" - \"Why should I use Pandas to work with data?\"\n" +"objectives:\n" +" - \"Navigate the workshop directory and download a dataset.\"\n" +" - \"Explain what a library is and what libraries are used for.\"\n" +" - \"Describe what the Python Data Analysis Library (Pandas) is.\"\n" +" - \"Load the Python Data Analysis Library (Pandas).\"\n" +" - \"Use `read_csv` to read tabular data into Python.\"\n" +" - \"Describe what a DataFrame is in Python.\"\n" +" - \"Access and summarize data stored in a DataFrame.\"\n" +" - \"Define indexing as it relates to data structures.\"\n" +" - \"Perform basic mathematical operations and summary statistics on data in a Pandas DataFrame.\"\n" +" - \"Create simple plots.\"\n" +"keypoints:\n" +" - \"Libraries enable us to extend the functionality of Python.\" \n" +" - \"Pandas is a popular library for working with data.\"\n" +" - \"A Dataframe is a Pandas data structure that allows one to access data by column (name or index) or row.\"\n" +" - \"Aggregating data using the `groupby()` function enables you to generate useful summaries of data quickly.\"\n" +" - \"Plots can be created from DataFrames or subsets of data that have been generated with `groupby()`.\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:28 +# header +msgid "# Working With Pandas DataFrames in Python" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:30 +msgid "We can automate the process of performing data manipulations in Python. It's efficient to spend time\n" +"building the code to perform these tasks because once it's built, we can use it\n" +"over and over on different datasets that use a similar format. This makes our\n" +"methods easily reproducible. We can also easily share our code with colleagues\n" +"and they can replicate the same analysis." +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:36 +# header +msgid "### Starting in the same spot" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:38 +msgid "To help the lesson run smoothly, let's ensure everyone is in the same directory.\n" +"This should help us avoid path and file name issues. At this time please\n" +"navigate to the workshop directory. If you working in IPython Notebook be sure\n" +"that you start your notebook in the workshop directory." +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:43 +msgid "A quick aside that there are Python libraries like [OS Library][os-lib] that can work with our\n" +"directory structure, however, that is not our focus today." +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:46 +# header +msgid "### Our Data" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:48 +msgid "For this lesson, we will be using the Portal Teaching data, a subset of the data\n" +"from Ernst et al\n" +"[Long-term monitoring and experimental manipulation of a Chihuahuan Desert ecosystem near Portal,\n" +"Arizona, USA][ernst]." +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:53 +msgid "We will be using files from the [Portal Project Teaching Database][pptd].\n" +"This section will use the `surveys.csv` file that can be downloaded here:\n" +"[https://ndownloader.figshare.com/files/2292172][figshare-ndownloader]" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:57 +msgid "We are studying the species and weight of animals caught in sites in our study\n" +"area. The dataset is stored as a `.csv` file: each row holds information for a\n" +"single animal, and the columns represent:" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:61 +msgid "| Column | Description |\n" +"|------------------|------------------------------------|\n" +"| record_id | Unique id for the observation |\n" +"| month | month of observation |\n" +"| day | day of observation |\n" +"| year | year of observation |\n" +"| plot_id | ID of a particular site |\n" +"| species_id | 2-letter code |\n" +"| sex | sex of animal (\"M\", \"F\") |\n" +"| hindfoot_length | length of the hindfoot in mm |\n" +"| weight | weight of the animal in grams |" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:74 +msgid "The first few rows of our first file look like this:" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:76 +# code block +msgid "~~~\n" +"record_id,month,day,year,plot_id,species_id,sex,hindfoot_length,weight\n" +"1,7,16,1977,2,NL,M,32,\n" +"2,7,16,1977,3,NL,M,33,\n" +"3,7,16,1977,2,DM,F,37,\n" +"4,7,16,1977,7,DM,M,36,\n" +"5,7,16,1977,3,DM,M,35,\n" +"6,7,16,1977,1,PF,M,14,\n" +"7,7,16,1977,2,PE,F,,\n" +"8,7,16,1977,1,DM,M,37,\n" +"9,7,16,1977,1,DM,F,34,\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:90 +# Front Matter +msgid "---\n" +"\n" +"## About Libraries\n" +"A library in Python contains a set of tools (called functions) that perform\n" +"tasks on our data. Importing a library is like getting a piece of lab equipment\n" +"out of a storage locker and setting it up on the bench for use in a project.\n" +"Once a library is set up, it can be used or called to perform many tasks.\n" +"\n" +"## Pandas in Python\n" +"One of the best options for working with tabular data in Python is to use the\n" +"[Python Data Analysis Library][pandas] (a.k.a. Pandas). The\n" +"Pandas library provides data structures, produces high quality plots with\n" +"[matplotlib][matplotlib] and integrates nicely with other libraries\n" +"that use [NumPy][numpy] (which is another Python library) arrays.\n" +"\n" +"Python doesn't load all of the libraries available to it by default. We have to\n" +"add an `import` statement to our code in order to use library functions. To import\n" +"a library, we use the syntax `import libraryName`. If we want to give the\n" +"library a nickname to shorten the command, we can add `as nickNameHere`. An\n" +"example of importing the pandas library using the common nickname `pd` is below.\n" +"\n" +"\n" +"~~~\n" +"import pandas as pd\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"Each time we call a function that's in a library, we use the syntax\n" +"`LibraryName.FunctionName`. Adding the library name with a `.` before the\n" +"function name tells Python where to find the function. In the example above, we\n" +"have imported Pandas as `pd`. This means we don't have to type out `pandas` each\n" +"time we call a Pandas function.\n" +"\n" +"\n" +"# Reading CSV Data Using Pandas\n" +"\n" +"We will begin by locating and reading our survey data which are in CSV format. CSV stands for\n" +"Comma-Separated Values and is a common way store formatted data. Other symbols may also be used, so\n" +"you might see tab-separated, colon-separated or space separated files. It is quite easy to replace\n" +"one separator with another, to match your application. The first line in the file often has headers\n" +"to explain what is in each column. CSV (and other separators) make it easy to share data, and can be\n" +"imported and exported from many applications, including Microsoft Excel. For more details on CSV\n" +"files, see the [Data Organisation in Spreadsheets][spreadsheet-lesson5] lesson.\n" +"We can use Pandas' `read_csv` function to pull the file directly into a [DataFrame][pd-dataframe].\n" +"\n" +"## So What's a DataFrame?\n" +"\n" +"A DataFrame is a 2-dimensional data structure that can store data of different\n" +"types (including characters, integers, floating point values, factors and more)\n" +"in columns. It is similar to a spreadsheet or an SQL table or the `data.frame` in\n" +"R. A DataFrame always has an index (0-based). An index refers to the position of\n" +"an element in the data structure.\n" +"\n" +"~~~\n" +"# Note that pd.read_csv is used because we imported pandas as pd\n" +"pd.read_csv(\"data/surveys.csv\")\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"The above command yields the **output** below:\n" +"\n" +"~~~\n" +"record_id month day year plot_id species_id sex hindfoot_length weight\n" +"0 1 7 16 1977 2 NL M 32 NaN\n" +"1 2 7 16 1977 3 NL M 33 NaN\n" +"2 3 7 16 1977 2 DM F 37 NaN\n" +"3 4 7 16 1977 7 DM M 36 NaN\n" +"4 5 7 16 1977 3 DM M 35 NaN\n" +"...\n" +"35544 35545 12 31 2002 15 AH NaN NaN NaN\n" +"35545 35546 12 31 2002 15 AH NaN NaN NaN\n" +"35546 35547 12 31 2002 10 RM F 15 14\n" +"35547 35548 12 31 2002 7 DO M 36 51\n" +"35548 35549 12 31 2002 5 NaN NaN NaN NaN\n" +"\n" +"[35549 rows x 9 columns]\n" +"~~~\n" +"{: .output}\n" +"\n" +"We can see that there were 35,549 rows parsed. Each row has 9\n" +"columns. The first column is the index of the DataFrame. The index is used to\n" +"identify the position of the data, but it is not an actual column of the DataFrame.\n" +"It looks like the `read_csv` function in Pandas read our file properly. However,\n" +"we haven't saved any data to memory so we can work with it. We need to assign the\n" +"DataFrame to a variable. Remember that a variable is a name for a value, such as `x`,\n" +"or `data`. We can create a new object with a variable name by assigning a value to it using `=`.\n" +"\n" +"Let's call the imported survey data `surveys_df`:\n" +"\n" +"~~~\n" +"surveys_df = pd.read_csv(\"data/surveys.csv\")\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"Notice when you assign the imported DataFrame to a variable, Python does not\n" +"produce any output on the screen. We can view the value of the `surveys_df`\n" +"object by typing its name into the Python command prompt.\n" +"\n" +"~~~\n" +"surveys_df\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"which prints contents like above.\n" +"\n" +"Note: if the output is too wide to print on your narrow terminal window, you may see something\n" +"slightly different as the large set of data scrolls past. You may see simply the last column\n" +"of data:\n" +"~~~\n" +"17 NaN\n" +"18 NaN\n" +"19 NaN\n" +"20 NaN\n" +"21 NaN\n" +"22 NaN\n" +"23 NaN\n" +"24 NaN\n" +"25 NaN\n" +"26 NaN\n" +"27 NaN\n" +"28 NaN\n" +"29 NaN\n" +"... ...\n" +"35519 36.0\n" +"35520 48.0\n" +"35521 45.0\n" +"35522 44.0\n" +"35523 27.0\n" +"35524 26.0\n" +"35525 24.0\n" +"35526 43.0\n" +"35527 NaN\n" +"35528 25.0\n" +"35529 NaN\n" +"35530 NaN\n" +"35531 43.0\n" +"35532 48.0\n" +"35533 56.0\n" +"35534 53.0\n" +"35535 42.0\n" +"35536 46.0\n" +"35537 31.0\n" +"35538 68.0\n" +"35539 23.0\n" +"35540 31.0\n" +"35541 29.0\n" +"35542 34.0\n" +"35543 NaN\n" +"35544 NaN\n" +"35545 NaN\n" +"35546 14.0\n" +"35547 51.0\n" +"35548 NaN\n" +"\n" +"[35549 rows x 9 columns]\n" +"~~~\n" +"{: .output}\n" +"\n" +"Never fear, all the data is there, if you scroll up. Selecting just a few rows, so it is\n" +"easier to fit on one window, you can see that pandas has neatly formatted the data to fit\n" +"our screen:\n" +"\n" +"~~~\n" +"surveys_df.head() # The head() method displays the first several lines of a file. It\n" +" # is discussed below.\n" +"~~~\n" +"{: .language-python}\n" +"~~~\n" +" record_id month day year plot_id species_id sex hindfoot_length \\\n" +"5 6 7 16 1977 1 PF M 14.0\n" +"6 7 7 16 1977 2 PE F NaN\n" +"7 8 7 16 1977 1 DM M 37.0\n" +"8 9 7 16 1977 1 DM F 34.0\n" +"9 10 7 16 1977 6 PF F 20.0\n" +"\n" +" weight\n" +"5 NaN\n" +"6 NaN\n" +"7 NaN\n" +"8 NaN\n" +"9 NaN\n" +"~~~\n" +"{: .output}\n" +"\n" +"## Exploring Our Species Survey Data\n" +"\n" +"Again, we can use the `type` function to see what kind of thing `surveys_df` is:\n" +"\n" +"~~~\n" +"type(surveys_df)\n" +"~~~\n" +"{: .language-python}\n" +"~~~\n" +"\n" +"~~~\n" +"{: .output}\n" +"\n" +"As expected, it's a DataFrame (or, to use the full name that Python uses to refer\n" +"to it internally, a `pandas.core.frame.DataFrame`).\n" +"\n" +"What kind of things does `surveys_df` contain? DataFrames have an attribute\n" +"called `dtypes` that answers this:\n" +"\n" +"~~~\n" +"surveys_df.dtypes\n" +"~~~\n" +"{: .language-python}\n" +"~~~\n" +"record_id int64\n" +"month int64\n" +"day int64\n" +"year int64\n" +"plot_id int64\n" +"species_id object\n" +"sex object\n" +"hindfoot_length float64\n" +"weight float64\n" +"dtype: object\n" +"~~~\n" +"{: .output}\n" +"\n" +"All the values in a column have the same type. For example, months have type\n" +"`int64`, which is a kind of integer. Cells in the month column cannot have\n" +"fractional values, but the weight and hindfoot_length columns can, because they\n" +"have type `float64`. The `object` type doesn't have a very helpful name, but in\n" +"this case it represents strings (such as 'M' and 'F' in the case of sex).\n" +"\n" +"We'll talk a bit more about what the different formats mean in a different lesson.\n" +"\n" +"### Useful Ways to View DataFrame objects in Python\n" +"\n" +"There are many ways to summarize and access the data stored in DataFrames,\n" +"using attributes and methods provided by the DataFrame object.\n" +"\n" +"To access an attribute, use the DataFrame object name followed by the attribute\n" +"name `df_object.attribute`. Using the DataFrame `surveys_df` and attribute\n" +"`columns`, an index of all the column names in the DataFrame can be accessed\n" +"with `surveys_df.columns`.\n" +"\n" +"Methods are called in a similar fashion using the syntax `df_object.method()`.\n" +"As an example, `surveys_df.head()` gets the first few rows in the DataFrame\n" +"`surveys_df` using **the `head()` method**. With a method, we can supply extra\n" +"information in the parens to control behaviour.\n" +"\n" +"Let's look at the data using these.\n" +"\n" +"> ## Challenge - DataFrames\n" +">\n" +"> Using our DataFrame `surveys_df`, try out the attributes & methods below to see\n" +"> what they return.\n" +">\n" +"> 1. `surveys_df.columns`\n" +"> 2. `surveys_df.shape` Take note of the output of `shape` - what format does it\n" +"> return the shape of the DataFrame in?\n" +">\n" +"> HINT: [More on tuples, here][python-datastructures].\n" +"> 3. `surveys_df.head()` Also, what does `surveys_df.head(15)` do?\n" +"> 4. `surveys_df.tail()`\n" +"{: .challenge}\n" +"\n" +"\n" +"## Calculating Statistics From Data In A Pandas DataFrame\n" +"\n" +"We've read our data into Python. Next, let's perform some quick summary\n" +"statistics to learn more about the data that we're working with. We might want\n" +"to know how many animals were collected in each site, or how many of each\n" +"species were caught. We can perform summary stats quickly using groups. But\n" +"first we need to figure out what we want to group by.\n" +"\n" +"Let's begin by exploring our data:\n" +"\n" +"~~~\n" +"# Look at the column names\n" +"surveys_df.columns\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"which **returns**:\n" +"\n" +"~~~\n" +"Index(['record_id', 'month', 'day', 'year', 'plot_id', 'species_id', 'sex',\n" +" 'hindfoot_length', 'weight'],\n" +" dtype='object')\n" +"~~~\n" +"{: .output}\n" +"\n" +"Let's get a list of all the species. The `pd.unique` function tells us all of\n" +"the unique values in the `species_id` column.\n" +"\n" +"~~~\n" +"pd.unique(surveys_df['species_id'])\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"which **returns**:\n" +"\n" +"~~~\n" +"array(['NL', 'DM', 'PF', 'PE', 'DS', 'PP', 'SH', 'OT', 'DO', 'OX', 'SS',\n" +" 'OL', 'RM', nan, 'SA', 'PM', 'AH', 'DX', 'AB', 'CB', 'CM', 'CQ',\n" +" 'RF', 'PC', 'PG', 'PH', 'PU', 'CV', 'UR', 'UP', 'ZL', 'UL', 'CS',\n" +" 'SC', 'BA', 'SF', 'RO', 'AS', 'SO', 'PI', 'ST', 'CU', 'SU', 'RX',\n" +" 'PB', 'PL', 'PX', 'CT', 'US'], dtype=object)\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"> ## Challenge - Statistics\n" +">\n" +"> 1. Create a list of unique site ID's (\"plot_id\") found in the surveys data. Call it\n" +"> `site_names`. How many unique sites are there in the data? How many unique\n" +"> species are in the data?\n" +">\n" +"> 2. What is the difference between `len(site_names)` and `surveys_df['plot_id'].nunique()`?\n" +"{: .challenge}\n" +"\n" +"# Groups in Pandas\n" +"\n" +"We often want to calculate summary statistics grouped by subsets or attributes\n" +"within fields of our data. For example, we might want to calculate the average\n" +"weight of all individuals per site.\n" +"\n" +"We can calculate basic statistics for all records in a single column using the\n" +"syntax below:\n" +"\n" +"~~~\n" +"surveys_df['weight'].describe()\n" +"~~~\n" +"{: .language-python}\n" +"gives **output**\n" +"\n" +"~~~\n" +"count 32283.000000\n" +"mean 42.672428\n" +"std 36.631259\n" +"min 4.000000\n" +"25% 20.000000\n" +"50% 37.000000\n" +"75% 48.000000\n" +"max 280.000000\n" +"Name: weight, dtype: float64\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"We can also extract one specific metric if we wish:\n" +"\n" +"~~~\n" +"surveys_df['weight'].min()\n" +"surveys_df['weight'].max()\n" +"surveys_df['weight'].mean()\n" +"surveys_df['weight'].std()\n" +"surveys_df['weight'].count()\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"But if we want to summarize by one or more variables, for example sex, we can\n" +"use **Pandas' `.groupby` method**. Once we've created a groupby DataFrame, we\n" +"can quickly calculate summary statistics by a group of our choice.\n" +"\n" +"~~~\n" +"# Group data by sex\n" +"grouped_data = surveys_df.groupby('sex')\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"The **pandas function `describe`** will return descriptive stats including: mean,\n" +"median, max, min, std and count for a particular column in the data. Pandas'\n" +"`describe` function will only return summary values for columns containing\n" +"numeric data.\n" +"\n" +"~~~\n" +"# Summary statistics for all numeric columns by sex\n" +"grouped_data.describe()\n" +"# Provide the mean for each numeric column by sex\n" +"grouped_data.mean()\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"`grouped_data.mean()` **OUTPUT:**\n" +"\n" +"~~~\n" +" record_id month day year plot_id \\\n" +"sex\n" +"F 18036.412046 6.583047 16.007138 1990.644997 11.440854\n" +"M 17754.835601 6.392668 16.184286 1990.480401 11.098282\n" +"\n" +" hindfoot_length weight\n" +"sex\n" +"F 28.836780 42.170555\n" +"M 29.709578 42.995379\n" +"\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"The `groupby` command is powerful in that it allows us to quickly generate\n" +"summary stats.\n" +"\n" +"> ## Challenge - Summary Data\n" +">\n" +"> 1. How many recorded individuals are female `F` and how many male `M`\n" +"> 2. What happens when you group by two columns using the following syntax and\n" +"> then grab mean values:\n" +"> - `grouped_data2 = surveys_df.groupby(['plot_id','sex'])`\n" +"> - `grouped_data2.mean()`\n" +"> 3. Summarize weight values for each site in your data. HINT: you can use the\n" +"> following syntax to only create summary statistics for one column in your data\n" +"> `by_site['weight'].describe()`\n" +">\n" +">\n" +">> ## Did you get #3 right?\n" +">> **A Snippet of the Output from challenge 3 looks like:**\n" +">>\n" +">> ~~~\n" +">> site\n" +">> 1 count 1903.000000\n" +">> mean 51.822911\n" +">> std 38.176670\n" +">> min 4.000000\n" +">> 25% 30.000000\n" +">> 50% 44.000000\n" +">> 75% 53.000000\n" +">> max 231.000000\n" +">> ...\n" +">> ~~~\n" +">> {: .output}\n" +"> {: .solution}\n" +"{: .challenge}\n" +"\n" +"## Quickly Creating Summary Counts in Pandas\n" +"\n" +"Let's next count the number of samples for each species. We can do this in a few\n" +"ways, but we'll use `groupby` combined with **a `count()` method**.\n" +"\n" +"\n" +"~~~\n" +"# Count the number of samples by species\n" +"species_counts = surveys_df.groupby('species_id')['record_id'].count()\n" +"print(species_counts)\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"Or, we can also count just the rows that have the species \"DO\":\n" +"\n" +"~~~\n" +"surveys_df.groupby('species_id')['record_id'].count()['DO']\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"> ## Challenge - Make a list\n" +">\n" +"> What's another way to create a list of species and associated `count` of the\n" +"> records in the data? Hint: you can perform `count`, `min`, etc functions on\n" +"> groupby DataFrames in the same way you can perform them on regular DataFrames.\n" +"{: .challenge}\n" +"\n" +"## Basic Math Functions\n" +"\n" +"If we wanted to, we could perform math on an entire column of our data. For\n" +"example let's multiply all weight values by 2. A more practical use of this might\n" +"be to normalize the data according to a mean, area, or some other value\n" +"calculated from our data.\n" +"\n" +"~~~\n" +"# Multiply all weight values by 2\n" +"surveys_df['weight']*2\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"# Quick & Easy Plotting Data Using Pandas\n" +"\n" +"We can plot our summary stats using Pandas, too.\n" +"\n" +"~~~\n" +"# Make sure figures appear inline in Ipython Notebook\n" +"%matplotlib inline\n" +"# Create a quick bar chart\n" +"species_counts.plot(kind='bar');\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"![Weight by Species Site](../fig/countPerSpecies.png)\n" +"Count per species site\n" +"\n" +"We can also look at how many animals were captured in each site:\n" +"\n" +"~~~\n" +"total_count = surveys_df.groupby('plot_id')['record_id'].nunique()\n" +"# Let's plot that too\n" +"total_count.plot(kind='bar');\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"> ## Challenge - Plots\n" +">\n" +"> 1. Create a plot of average weight across all species per site.\n" +"> 2. Create a plot of total males versus total females for the entire dataset.\n" +"{: .challenge}\n" +"\n" +"> ## Summary Plotting Challenge\n" +">\n" +"> Create a stacked bar plot, with weight on the Y axis, and the stacked variable\n" +"> being sex. The plot should show total weight by sex for each site. Some\n" +"> tips are below to help you solve this challenge:\n" +">\n" +"> * For more on Pandas plots, visit this [link][pandas-plot].\n" +"> * You can use the code that follows to create a stacked bar plot but the data to stack\n" +"> need to be in individual columns. Here's a simple example with some data where\n" +"> 'a', 'b', and 'c' are the groups, and 'one' and 'two' are the subgroups.\n" +">\n" +"> ~~~\n" +"> d = {'one' : pd.Series([1., 2., 3.], index=['a', 'b', 'c']),'two' : pd.Series([1., 2., 3., 4.], index=['a', 'b', 'c', 'd'])}\n" +"> pd.DataFrame(d)\n" +"> ~~~\n" +"> {: .language-python }\n" +">\n" +"> shows the following data\n" +">\n" +"> ~~~\n" +"> one two\n" +"> a 1 1\n" +"> b 2 2\n" +"> c 3 3\n" +"> d NaN 4\n" +"> ~~~\n" +"> {: .output}\n" +">\n" +"> We can plot the above with\n" +">\n" +"> ~~~\n" +"> # Plot stacked data so columns 'one' and 'two' are stacked\n" +"> my_df = pd.DataFrame(d)\n" +"> my_df.plot(kind='bar',stacked=True,title=\"The title of my graph\")\n" +"> ~~~\n" +"> {: .language-python }\n" +">\n" +"> ![Stacked Bar Plot](../fig/stackedBar1.png)\n" +">\n" +"> * You can use the `.unstack()` method to transform grouped data into columns\n" +"> for each plotting. Try running `.unstack()` on some DataFrames above and see\n" +"> what it yields.\n" +">\n" +"> Start by transforming the grouped data (by site and sex) into an unstacked layout, then create\n" +"> a stacked plot.\n" +">\n" +">\n" +">> ## Solution to Summary Challenge\n" +">>\n" +">> First we group data by site and by sex, and then calculate a total for each site.\n" +">>\n" +">> ~~~\n" +">> by_site_sex = surveys_df.groupby(['plot_id','sex'])\n" +">> site_sex_count = by_site_sex['weight'].sum()\n" +">> ~~~\n" +">> {: .language-python}\n" +">>\n" +">> This calculates the sums of weights for each sex within each site as a table\n" +">>\n" +">> ~~~\n" +">> site sex\n" +">> plot_id sex\n" +">> 1 F 38253\n" +">> M 59979\n" +">> 2 F 50144\n" +">> M 57250\n" +">> 3 F 27251\n" +">> M 28253\n" +">> 4 F 39796\n" +">> M 49377\n" +">> \n" +">> ~~~\n" +">> {: .output}\n" +">>\n" +">> Below we'll use `.unstack()` on our grouped data to figure out the total weight that each sex contributed to each site.\n" +">>\n" +">> ~~~\n" +">> by_site_sex = surveys_df.groupby(['plot_id','sex'])\n" +">> site_sex_count = by_site_sex['weight'].sum()\n" +">> site_sex_count.unstack()\n" +">> ~~~\n" +">> {: .language-python }\n" +">>\n" +">> The `unstack` method above will display the following output:\n" +">>\n" +">> ~~~\n" +">> sex F M\n" +">> plot_id\n" +">> 1 38253 59979\n" +">> 2 50144 57250\n" +">> 3 27251 28253\n" +">> 4 39796 49377\n" +">> \n" +">> ~~~\n" +">> {: .output}\n" +">>\n" +">> Now, create a stacked bar plot with that data where the weights for each sex are stacked by site.\n" +">>\n" +">> Rather than display it as a table, we can plot the above data by stacking the values of each sex as follows:\n" +">>\n" +">> ~~~\n" +">> by_site_sex = surveys_df.groupby(['plot_id','sex'])\n" +">> site_sex_count = by_site_sex['weight'].sum()\n" +">> spc = site_sex_count.unstack()\n" +">> s_plot = spc.plot(kind='bar',stacked=True,title=\"Total weight by site and sex\")\n" +">> s_plot.set_ylabel(\"Weight\")\n" +">> s_plot.set_xlabel(\"Plot\")\n" +">> ~~~\n" +">> {: .language-python}\n" +">>\n" +">> ![Stacked Bar Plot](../fig/stackedBar.png)\n" +"> {: .solution}\n" +"{: .challenge}\n" +"\n" +"[ernst]: http://www.esapubs.org/archive/ecol/E090/118/default.htm\n" +"[figshare-ndownloader]: https://ndownloader.figshare.com/files/2292172\n" +"[os-lib]: https://docs.python.org/3/library/os.html\n" +"[matplotlib]: https://matplotlib.org\n" +"[numpy]: https://www.numpy.org/\n" +"[pandas]: https://pandas.pydata.org\n" +"[pandas-plot]: http://pandas.pydata.org/pandas-docs/stable/user_guide/visualization.html#basic-plotting-plot\n" +"[pd-dataframe]: https://pandas.pydata.org/pandas-docs/stable/getting_started/dsintro.html#dataframe\n" +"[pptd]: https://figshare.com/articles/Portal_Project_Teaching_Database/1314459\n" +"[python-datastructures]: https://docs.python.org/3/tutorial/datastructures.html#tuples-and-sequences\n" +"[spreadsheet-lesson5]: http://www.datacarpentry.org/spreadsheet-ecology-lesson/05-exporting-data\n" +"\n" +"{% include links.md %}\n" +"" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:1 +# Front Matter +msgid "---\n" +"title: Indexing, Slicing and Subsetting DataFrames in Python\n" +"teaching: 30\n" +"exercises: 30\n" +"questions:\n" +" - \"How can I access specific data within my data set?\"\n" +" - \"How can Python and Pandas help me to analyse my data?\"\n" +"objectives:\n" +" - \"Describe what 0-based indexing is.\"\n" +" - \"Manipulate and extract data using column headings and index locations.\"\n" +" - \"Employ slicing to select sets of data from a DataFrame.\"\n" +" - \"Employ label and integer-based indexing to select ranges of data in a dataframe.\"\n" +" - \"Reassign values within subsets of a DataFrame.\"\n" +" - \"Create a copy of a DataFrame.\"\n" +" - \"Query / select a subset of data using a set of criteria using the following operators:\n" +" `=`, `!=`, `>`, `<`, `>=`, `<=`.\"\n" +" - \"Locate subsets of data using masks.\"\n" +" - \"Describe BOOLEAN objects in Python and manipulate data using BOOLEANs.\"\n" +"keypoints:\n" +" - \"In Python, portions of data can be accessed using indices, slices, column headings, and\n" +" condition-based subsetting.\"\n" +" - \"Python uses 0-based indexing, in which the first element in a list, tuple or any other data\n" +" structure has an index of 0.\"\n" +" - \"Pandas enables common data exploration steps such as data indexing, slicing and conditional\n" +" subsetting.\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:28 +msgid "In the first episode of this lesson, we read a CSV file into a pandas' DataFrame. We learned how to:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:30 +# unordered list +msgid "- save a DataFrame to a named object," +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:31 +# unordered list +msgid "- perform basic math on data," +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:32 +# unordered list +msgid "- calculate summary statistics, and" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:33 +# unordered list +msgid "- create plots based on the data we loaded into pandas." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:35 +msgid "In this lesson, we will explore ways to access different parts of the data using:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:37 +# unordered list +msgid "- indexing," +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:38 +# unordered list +msgid "- slicing, and" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:39 +# unordered list +msgid "- subsetting." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:41 +# header +msgid "## Loading our data" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:43 +msgid "We will continue to use the surveys dataset that we worked with in the last\n" +"episode. Let's reopen and read in the data again:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:46 +# code block +msgid "~~~\n" +"# Make sure pandas is loaded\n" +"import pandas as pd\n" +"\n" +"# Read in the survey CSV\n" +"surveys_df = pd.read_csv(\"data/surveys.csv\")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:55 +# header +msgid "## Indexing and Slicing in Python" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:57 +msgid "We often want to work with subsets of a **DataFrame** object. There are\n" +"different ways to accomplish this including: using labels (column headings),\n" +"numeric ranges, or specific x,y index locations." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:62 +# header +msgid "## Selecting data using Labels (Column Headings)" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:64 +msgid "We use square brackets `[]` to select a subset of a Python object. For example,\n" +"we can select all data from a column named `species_id` from the `surveys_df`\n" +"DataFrame by name. There are two ways to do this:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:68 +# code block +msgid "~~~\n" +"# TIP: use the .head() method we saw earlier to make output shorter\n" +"# Method 1: select a 'subset' of the data using the column name\n" +"surveys_df['species_id']\n" +"\n" +"# Method 2: use the column name as an 'attribute'; gives the same output\n" +"surveys_df.species_id\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:78 +msgid "We can also create a new object that contains only the data within the\n" +"`species_id` column as follows:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:81 +# code block +msgid "~~~\n" +"# Creates an object, surveys_species, that only contains the `species_id` column\n" +"surveys_species = surveys_df['species_id']\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:87 +msgid "We can pass a list of column names too, as an index to select columns in that\n" +"order. This is useful when we need to reorganize our data." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:90 +msgid "**NOTE:** If a column name is not contained in the DataFrame, an exception\n" +"(error) will be raised." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:93 +# code block +msgid "~~~\n" +"# Select the species and plot columns from the DataFrame\n" +"surveys_df[['species_id', 'plot_id']]\n" +"\n" +"# What happens when you flip the order?\n" +"surveys_df[['plot_id', 'species_id']]\n" +"\n" +"# What happens if you ask for a column that doesn't exist?\n" +"surveys_df['speciess']\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:105 +msgid "Python tells us what type of error it is in the traceback, at the bottom it says\n" +"`KeyError: 'speciess'` which means that `speciess` is not a valid column name (nor a valid key in\n" +"the related Python data type dictionary)." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:109 +# header +msgid "## Extracting Range based Subsets: Slicing" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:111 +# blockquote, which can be cascaded +msgid "> ## Reminder" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:112 +# blockquote, which can be cascaded +msgid "> Python uses 0-based indexing." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:113 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:129 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:139 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:177 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:343 +#: python-ecology-lesson/_extras/guide.md:79 +# SC/DC Template label +msgid "{: .callout}" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:115 +msgid "Let's remind ourselves that Python uses 0-based\n" +"indexing. This means that the first element in an object is located at position\n" +"0. This is different from other tools like R and Matlab that index elements\n" +"within objects starting at 1." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:120 +# code block +msgid "~~~\n" +"# Create a list of numbers:\n" +"a = [1, 2, 3, 4, 5]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:126 +msgid "![indexing diagram](../fig/slicing-indexing.png)\n" +"![slicing diagram](../fig/slicing-slicing.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:130 +# blockquote, which can be cascaded +msgid "> ## Challenge - Extracting data" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:131 +msgid ">\n" +"> 1. What value does the code below return?\n" +">\n" +"> ~~~\n" +"> a[0]\n" +"> ~~~\n" +"> {: .language-python }\n" +">\n" +"> 2. How about this:\n" +">\n" +"> ~~~\n" +"> a[5]\n" +"> ~~~\n" +"> {: .language-python }\n" +">\n" +"> 3. In the example above, calling `a[5]` returns an error. Why is that?\n" +">\n" +"> 4. What about?\n" +">\n" +"> ~~~\n" +"> a[len(a)]\n" +"> ~~~\n" +"> {: .language-python }" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:157 +# header +msgid "## Slicing Subsets of Rows in Python" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:159 +msgid "Slicing using the `[]` operator selects a set of rows and/or columns from a\n" +"DataFrame. To slice out a set of rows, you use the following syntax:\n" +"`data[start:stop]`. When slicing in pandas the start bound is included in the\n" +"output. The stop bound is one step BEYOND the row you want to select. So if you\n" +"want to select rows 0, 1 and 2 your code would look like this:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:165 +# code block +msgid "~~~\n" +"# Select rows 0, 1, 2 (row 3 is not selected)\n" +"surveys_df[0:3]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:171 +msgid "The stop bound in Python is different from what you might be used to in\n" +"languages like Matlab and R." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:174 +# code block +msgid "~~~\n" +"# Select the first 5 rows (rows 0, 1, 2, 3, 4)\n" +"surveys_df[:5]\n" +"\n" +"# Select the last element in the list\n" +"# (the slice starts at the last element, and ends at the end of the list)\n" +"surveys_df[-1:]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:184 +msgid "We can also reassign values within subsets of our DataFrame." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:186 +msgid "But before we do that, let's look at the difference between the concept of\n" +"copying objects and the concept of referencing objects in Python." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:189 +# header +msgid "## Copying Objects vs Referencing Objects in Python" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:191 +msgid "Let's start with an example:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:193 +# code block +msgid "~~~\n" +"# Using the 'copy() method'\n" +"true_copy_surveys_df = surveys_df.copy()\n" +"\n" +"# Using the '=' operator\n" +"ref_surveys_df = surveys_df\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:202 +msgid "You might think that the code `ref_surveys_df = surveys_df` creates a fresh\n" +"distinct copy of the `surveys_df` DataFrame object. However, using the `=`\n" +"operator in the simple statement `y = x` does **not** create a copy of our\n" +"DataFrame. Instead, `y = x` creates a new variable `y` that references the\n" +"**same** object that `x` refers to. To state this another way, there is only\n" +"**one** object (the DataFrame), and both `x` and `y` refer to it." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:209 +msgid "In contrast, the `copy()` method for a DataFrame creates a true copy of the\n" +"DataFrame." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:212 +msgid "Let's look at what happens when we reassign the values within a subset of the\n" +"DataFrame that references another DataFrame object:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:215 +# code block +msgid "~~~\n" +"# Assign the value `0` to the first three rows of data in the DataFrame\n" +"ref_surveys_df[0:3] = 0\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:221 +msgid "Let's try the following code:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:223 +# code block +msgid "~~~\n" +"# ref_surveys_df was created using the '=' operator\n" +"ref_surveys_df.head()\n" +"\n" +"# surveys_df is the original dataframe\n" +"surveys_df.head()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:232 +msgid "What is the difference between these two dataframes?" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:234 +msgid "When we assigned the first 3 columns the value of `0` using the\n" +"`ref_surveys_df` DataFrame, the `surveys_df` DataFrame is modified too.\n" +"Remember we created the reference `ref_survey_df` object above when we did\n" +"`ref_survey_df = surveys_df`. Remember `surveys_df` and `ref_surveys_df`\n" +"refer to the same exact DataFrame object. If either one changes the object,\n" +"the other will see the same changes to the reference object." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:241 +msgid "**To review and recap**:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:243 +# unordered list +msgid "- **Copy** uses the dataframe's `copy()` method" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:245 +msgid " ~~~\n" +" true_copy_surveys_df = surveys_df.copy()\n" +" ~~~\n" +" {: .language-python }\n" +"- A **Reference** is created using the `=` operator" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:251 +msgid " ~~~\n" +" ref_surveys_df = surveys_df\n" +" ~~~\n" +" {: .language-python }" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:256 +msgid "Okay, that's enough of that. Let's create a brand new clean dataframe from\n" +"the original data CSV file." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:259 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:333 +# code block +msgid "~~~\n" +"surveys_df = pd.read_csv(\"data/surveys.csv\")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:264 +# header +msgid "## Slicing Subsets of Rows and Columns in Python" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:266 +msgid "We can select specific ranges of our data in both the row and column directions\n" +"using either label or integer-based indexing." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:269 +# unordered list +msgid "- `loc` is primarily *label* based indexing. *Integers* may be used but" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:270 +msgid " they are interpreted as a *label*.\n" +"- `iloc` is primarily *integer* based indexing" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:273 +msgid "To select a subset of rows **and** columns from our DataFrame, we can use the\n" +"`iloc` method. For example, we can select month, day and year (columns 2, 3\n" +"and 4 if we start counting at 1), like this:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:277 +# code block +msgid "~~~\n" +"# iloc[row slicing, column slicing]\n" +"surveys_df.iloc[0:3, 1:4]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:283 +msgid "which gives the **output**" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:285 +# code block +msgid "~~~\n" +" month day year\n" +"0 7 16 1977\n" +"1 7 16 1977\n" +"2 7 16 1977\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:293 +msgid "Notice that we asked for a slice from 0:3. This yielded 3 rows of data. When you\n" +"ask for 0:3, you are actually telling Python to start at index 0 and select rows\n" +"0, 1, 2 **up to but not including 3**." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:297 +msgid "Let's explore some other ways to index and select subsets of data:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:299 +# code block +msgid "~~~\n" +"# Select all columns for rows of index values 0 and 10\n" +"surveys_df.loc[[0, 10], :]\n" +"\n" +"# What does this do?\n" +"surveys_df.loc[0, ['species_id', 'plot_id', 'weight']]\n" +"\n" +"# What happens when you type the code below?\n" +"surveys_df.loc[[0, 10, 35549], :]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:311 +msgid "**NOTE**: Labels must be found in the DataFrame or you will get a `KeyError`." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:313 +msgid "Indexing by labels `loc` differs from indexing by integers `iloc`.\n" +"With `loc`, both the start bound and the stop bound are **inclusive**. When using\n" +"`loc`, integers *can* be used, but the integers refer to the\n" +"index label and not the position. For example, using `loc` and select 1:4\n" +"will get a different result than using `iloc` to select rows 1:4." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:319 +msgid "We can also select a specific data value using a row and\n" +"column location within the DataFrame and `iloc` indexing:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:322 +# code block +msgid "~~~\n" +"# Syntax for iloc indexing to finding a specific data element\n" +"dat.iloc[row, column]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:328 +msgid "In this `iloc` example," +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:330 +# code block +msgid "~~~\n" +"surveys_df.iloc[2, 6]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:335 +msgid "gives the **output**" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:337 +# code block +msgid "~~~\n" +"'F'\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:342 +msgid "Remember that Python indexing begins at 0. So, the index location [2, 6]\n" +"selects the element that is 3 rows down and 7 columns over in the DataFrame." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:347 +# blockquote, which can be cascaded +msgid "> ## Challenge - Range" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:348 +msgid ">\n" +"> 1. What happens when you execute:\n" +">\n" +"> - `surveys_df[0:1]`\n" +"> - `surveys_df[:4]`\n" +"> - `surveys_df[:-1]`\n" +">\n" +"> 2. What happens when you call:\n" +">\n" +"> - `surveys_df.iloc[0:4, 1:4]`\n" +"> - `surveys_df.loc[0:4, 1:4]`\n" +">\n" +"> - How are the two commands different?" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:364 +# header +msgid "## Subsetting Data using Criteria" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:366 +msgid "We can also select a subset of our data using criteria. For example, we can\n" +"select all rows that have a year value of 2002:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:369 +# code block +msgid "~~~\n" +"surveys_df[surveys_df.year == 2002]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:374 +msgid "Which produces the following output:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:376 +# code block +msgid "~~~\n" +"record_id month day year plot_id species_id sex hindfoot_length weight\n" +"33320 33321 1 12 2002 1 DM M 38 44\n" +"33321 33322 1 12 2002 1 DO M 37 58\n" +"33322 33323 1 12 2002 1 PB M 28 45\n" +"33323 33324 1 12 2002 1 AB NaN NaN NaN\n" +"33324 33325 1 12 2002 1 DO M 35 29\n" +"...\n" +"35544 35545 12 31 2002 15 AH NaN NaN NaN\n" +"35545 35546 12 31 2002 15 AH NaN NaN NaN\n" +"35546 35547 12 31 2002 10 RM F 15 14\n" +"35547 35548 12 31 2002 7 DO M 36 51\n" +"35548 35549 12 31 2002 5 NaN NaN NaN NaN\n" +"\n" +"[2229 rows x 9 columns]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:394 +msgid "Or we can select all rows that do not contain the year 2002:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:396 +# code block +msgid "~~~\n" +"surveys_df[surveys_df.year != 2002]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:401 +msgid "We can define sets of criteria too:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:403 +# code block +msgid "~~~\n" +"surveys_df[(surveys_df.year >= 1980) & (surveys_df.year <= 1985)]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:408 +# header +msgid "### Python Syntax Cheat Sheet" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:410 +msgid "We can use the syntax below when querying data by criteria from a DataFrame.\n" +"Experiment with selecting various subsets of the \"surveys\" data." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:413 +# unordered list +msgid "* Equals: `==`" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:414 +# unordered list +msgid "* Not equals: `!=`" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:415 +# unordered list +msgid "* Greater than, less than: `>` or `<`" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:416 +# unordered list +msgid "* Greater than or equal to `>=`" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:417 +# unordered list +msgid "* Less than or equal to `<=`" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:420 +# blockquote, which can be cascaded +msgid "> ## Challenge - Queries" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:421 +msgid ">\n" +"> 1. Select a subset of rows in the `surveys_df` DataFrame that contain data from\n" +"> the year 1999 and that contain weight values less than or equal to 8. How\n" +"> many rows did you end up with? What did your neighbor get?\n" +">\n" +"> 2. You can use the `isin` command in Python to query a DataFrame based upon a\n" +"> list of values as follows:\n" +">\n" +"> ~~~\n" +"> surveys_df[surveys_df['species_id'].isin([listGoesHere])]\n" +"> ~~~\n" +"> {: .language-python }\n" +">\n" +"> Use the `isin` function to find all plots that contain particular species\n" +"> in the \"surveys\" DataFrame. How many records contain these values?\n" +">\n" +"> 3. Experiment with other queries. Create a query that finds all rows with a\n" +"> weight value > or equal to 0.\n" +">\n" +"> 4. The `~` symbol in Python can be used to return the OPPOSITE of the\n" +"> selection that you specify in Python. It is equivalent to **is not in**.\n" +"> Write a query that selects all rows with sex NOT equal to 'M' or 'F' in\n" +"> the \"surveys\" data." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:447 +# header +msgid "# Using masks to identify a specific condition" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:449 +msgid "A **mask** can be useful to locate where a particular subset of values exist or\n" +"don't exist - for example, NaN, or \"Not a Number\" values. To understand masks,\n" +"we also need to understand `BOOLEAN` objects in Python." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:453 +msgid "Boolean values include `True` or `False`. For example," +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:455 +# code block +msgid "~~~\n" +"# Set x to 5\n" +"x = 5\n" +"\n" +"# What does the code below return?\n" +"x > 5\n" +"\n" +"# How about this?\n" +"x == 5\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:467 +msgid "When we ask Python whether `x` is greater than 5, it returns `False`.\n" +"This is Python's way to say \"No\". Indeed, the value of `x` is 5,\n" +"and 5 is not greater than 5." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:471 +msgid "To create a boolean mask:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:473 +# unordered list +msgid "- Set the True / False criteria (e.g. `values > 5 = True`)" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:474 +# unordered list +msgid "- Python will then assess each value in the object to determine whether the" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:475 +msgid " value meets the criteria (True) or not (False).\n" +"- Python creates an output object that is the same shape as the original\n" +" object, but with a `True` or `False` value for each index location." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:479 +msgid "Let's try this out. Let's identify all locations in the survey data that have\n" +"null (missing or NaN) data values. We can use the `isnull` method to do this.\n" +"The `isnull` method will compare each cell with a null value. If an element\n" +"has a null value, it will be assigned a value of `True` in the output object." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:484 +# code block +msgid "~~~\n" +"pd.isnull(surveys_df)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:489 +msgid "A snippet of the output is below:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:491 +# code block +msgid "~~~\n" +" record_id month day year plot_id species_id sex hindfoot_length weight\n" +"0 False False False False False False False False True\n" +"1 False False False False False False False False True\n" +"2 False False False False False False False False True\n" +"3 False False False False False False False False True\n" +"4 False False False False False False False False True\n" +"\n" +"[35549 rows x 9 columns]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:503 +msgid "To select the rows where there are null values, we can use\n" +"the mask as an index to subset our data as follows:" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:506 +# code block +msgid "~~~\n" +"# To select just the rows with NaN values, we can use the 'any()' method\n" +"surveys_df[pd.isnull(surveys_df).any(axis=1)]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:512 +msgid "Note that the `weight` column of our DataFrame contains many `null` or `NaN`\n" +"values. We will explore ways of dealing with this in Lesson 03." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:515 +msgid "We can run `isnull` on a particular column too. What does the code below do?" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:517 +# code block +msgid "~~~\n" +"# What does this do?\n" +"empty_weights = surveys_df[pd.isnull(surveys_df['weight'])]['weight']\n" +"print(empty_weights)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:524 +msgid "Let's take a minute to look at the statement above. We are using the Boolean\n" +"object `pd.isnull(surveys_df['weight'])` as an index to `surveys_df`. We are\n" +"asking Python to select rows that have a `NaN` value of weight." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:529 +# blockquote, which can be cascaded +msgid "> ## Challenge - Putting it all together" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:530 +msgid ">\n" +"> 1. Create a new DataFrame that only contains observations with sex values that\n" +"> are **not** female or male. Assign each sex value in the new DataFrame to a\n" +"> new value of 'x'. Determine the number of null values in the subset.\n" +">\n" +"> 2. Create a new DataFrame that contains only observations that are of sex male\n" +"> or female and where weight values are greater than 0. Create a stacked bar\n" +"> plot of average weight by plot with male vs female values stacked for each\n" +"> plot." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:1 +# Front Matter +msgid "---\n" +"title: Data Types and Formats\n" +"teaching: 20\n" +"exercises: 25\n" +"questions:\n" +" - \"What types of data can be contained in a DataFrame?\"\n" +" - \"Why is the data type important?\"\n" +"objectives:\n" +" - \"Describe how information is stored in a Python DataFrame.\"\n" +" - \"Define the two main types of data in Python: text and numerics.\"\n" +" - \"Examine the structure of a DataFrame.\"\n" +" - \"Modify the format of values in a DataFrame.\"\n" +" - \"Describe how data types impact operations.\"\n" +" - \"Define, manipulate, and interconvert integers and floats in Python.\"\n" +" - \"Analyze datasets having missing/null values (NaN values).\"\n" +" - \"Write manipulated data to a file.\"\n" +"keypoints:\n" +" - \"Pandas uses other names for data types than Python, for example: `object` for textual data.\"\n" +" - \"A column in a DataFrame can only have one data type.\"\n" +" - \"The data type in a DataFrame’s single column can be checked using `dtype`.\"\n" +" - \"Make conscious decisions about how to manage missing data.\"\n" +" - \"A DataFrame can be saved to a CSV file using the `to_csv` function.\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:25 +msgid "The format of individual columns and rows will impact analysis performed on a\n" +"dataset read into python. For example, you can't perform mathematical\n" +"calculations on a string (text formatted data). This might seem obvious,\n" +"however sometimes numeric values are read into Python as strings. In this\n" +"situation, when you then try to perform calculations on the string-formatted\n" +"numeric data, you get an error." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:32 +msgid "In this lesson we will review ways to explore and better understand the\n" +"structure and format of our data." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:35 +# header +msgid "# Types of Data" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:37 +msgid "How information is stored in a\n" +"DataFrame or a Python object affects what we can do with it and the outputs of\n" +"calculations as well. There are two main types of data that we're explore in\n" +"this lesson: numeric and text data types." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:42 +# header +msgid "## Numeric Data Types" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:44 +msgid "Numeric data types include integers and floats. A **floating point** (known as a\n" +"float) number has decimal points even if that decimal point value is 0. For\n" +"example: 1.13, 2.0, 1234.345. If we have a column that contains both integers and\n" +"floating point numbers, Pandas will assign the entire column to the float data\n" +"type so the decimal points are not lost." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:50 +msgid "An **integer** will never have a decimal point. Thus if we wanted to store 1.13 as\n" +"an integer it would be stored as 1. Similarly, 1234.345 would be stored as 1234. You\n" +"will often see the data type `Int64` in Python which stands for 64 bit integer. The 64\n" +"simply refers to the memory allocated to store data in each cell which effectively\n" +"relates to how many digits it can store in each \"cell\". Allocating space ahead of time\n" +"allows computers to optimize storage and processing efficiency." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:57 +# header +msgid "## Text Data Type" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:59 +msgid "Text data type is known as Strings in Python, or Objects in Pandas. Strings can\n" +"contain numbers and / or characters. For example, a string might be a word, a\n" +"sentence, or several sentences. A Pandas object might also be a plot name like\n" +"'plot1'. A string can also contain or consist of numbers. For instance, '1234'\n" +"could be stored as a string. As could '10.23'. However **strings that contain\n" +"numbers can not be used for mathematical operations**!" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:66 +msgid "Pandas and base Python use slightly different names for data types. More on this\n" +"is in the table below:" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:69 +msgid "| Pandas Type | Native Python Type | Description |\n" +"|-------------|--------------------|-------------|\n" +"| object | string | The most general dtype. Will be assigned to your column if column has mixed types (numbers and strings). |\n" +"| int64 | int | Numeric characters. 64 refers to the memory allocated to hold this character. |\n" +"| float64 | float | Numeric characters with decimals. If a column contains numbers and NaNs (see below), pandas will default to float64, in case your missing value has a decimal. |\n" +"| datetime64, timedelta[ns] | N/A (but see the [datetime] module in Python's standard library) | Values meant to hold time data. Look into these for time series experiments. |" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:76 +msgid "[datetime]: http://doc.python.org/2/library/datetime.html" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:79 +# header +msgid "## Checking the format of our data" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:81 +msgid "Now that we're armed with a basic understanding of numeric and text data\n" +"types, let's explore the format of our survey data. We'll be working with the\n" +"same `surveys.csv` dataset that we've used in previous lessons." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:85 +# code block +msgid "~~~\n" +"# Note that pd.read_csv is used because we imported pandas as pd\n" +"surveys_df = pd.read_csv(\"data/surveys.csv\")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:91 +msgid "Remember that we can check the type of an object like this:" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:93 +# code block +msgid "~~~\n" +"type(surveys_df)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:98 +# code block +msgid "~~~\n" +"pandas.core.frame.DataFrame\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:103 +msgid "Next, let's look at the structure of our surveys data. In pandas, we can check\n" +"the type of one column in a DataFrame using the syntax\n" +"`dataFrameName[column_name].dtype`:" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:107 +# code block +msgid "~~~\n" +"surveys_df['sex'].dtype\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:112 +# code block +msgid "~~~\n" +"dtype('O')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:117 +msgid "A type 'O' just stands for \"object\" which in Pandas' world is a string\n" +"(text)." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:120 +# code block +msgid "~~~\n" +"surveys_df['record_id'].dtype\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:125 +# code block +msgid "~~~\n" +"dtype('int64')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:130 +msgid "The type `int64` tells us that Python is storing each value within this column\n" +"as a 64 bit integer. We can use the `dat.dtypes` command to view the data type\n" +"for each column in a DataFrame (all at once)." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:134 +# code block +msgid "~~~\n" +"surveys_df.dtypes\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:139 +msgid "which **returns**:" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:141 +# code block +msgid "~~~\n" +"record_id int64\n" +"month int64\n" +"day int64\n" +"year int64\n" +"plot_id int64\n" +"species_id object\n" +"sex object\n" +"hindfoot_length float64\n" +"weight float64\n" +"dtype: object\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:153 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:41 +msgid "{: .language-python }" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:155 +msgid "Note that most of the columns in our Survey data are of type `int64`. This means\n" +"that they are 64 bit integers. But the weight column is a floating point value\n" +"which means it contains decimals. The `species_id` and `sex` columns are objects which\n" +"means they contain strings." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:160 +# header +msgid "## Working With Integers and Floats" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:162 +msgid "So we've learned that computers store numbers in one of two ways: as integers or\n" +"as floating-point numbers (or floats). Integers are the numbers we usually count\n" +"with. Floats have fractional parts (decimal places). Let's next consider how\n" +"the data type can impact mathematical operations on our data. Addition,\n" +"subtraction, division and multiplication work on floats and integers as we'd expect." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:168 +# code block +msgid "~~~\n" +"print(5+5)\n" +"10\n" +"\n" +"print(24-4)\n" +"20\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:177 +msgid "If we divide one integer by another, we get a float.\n" +"The result on Python 3 is different than in Python 2, where the result is an\n" +"integer (integer division)." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:181 +# code block +msgid "~~~\n" +"print(5/9)\n" +"0.5555555555555556\n" +"\n" +"print(10/3)\n" +"3.3333333333333335\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:190 +msgid "We can also convert a floating point number to an integer or an integer to\n" +"floating point number. Notice that Python by default rounds down when it\n" +"converts from floating point to integer." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:194 +# code block +msgid "~~~\n" +"# Convert a to an integer\n" +"a = 7.83\n" +"int(a)\n" +"7\n" +"\n" +"# Convert b to a float\n" +"b = 7\n" +"float(b)\n" +"7.0\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:207 +# header +msgid "# Working With Our Survey Data" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:209 +msgid "Getting back to our data, we can modify the format of values within our data, if\n" +"we want. For instance, we could convert the `record_id` field to floating point\n" +"values." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:213 +# code block +msgid "~~~\n" +"# Convert the record_id field from an integer to a float\n" +"surveys_df['record_id'] = surveys_df['record_id'].astype('float64')\n" +"surveys_df['record_id'].dtype\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:220 +# code block +msgid "~~~\n" +"dtype('float64')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:225 +# blockquote, which can be cascaded +msgid "> ## Challenge - Changing Types" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:226 +msgid ">\n" +"> Try converting the column `plot_id` to floats using\n" +">\n" +"> ~~~\n" +"> surveys_df.plot_id.astype(\"float\")\n" +"> ~~~\n" +"> {: .language-python}\n" +">\n" +"> Next try converting `weight` to an integer. What goes wrong here? What is Pandas telling you?\n" +"> We will talk about some solutions to this later." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:238 +# header +msgid "## Missing Data Values - NaN" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:240 +msgid "What happened in the last challenge activity? Notice that this throws a value error:\n" +"`ValueError: Cannot convert NA to integer`. If we look at the `weight` column in the surveys\n" +"data we notice that there are NaN (**N**ot **a** **N**umber) values. **NaN** values are undefined\n" +"values that cannot be represented mathematically. Pandas, for example, will read\n" +"an empty cell in a CSV or Excel sheet as a NaN. NaNs have some desirable properties: if we\n" +"were to average the `weight` column without replacing our NaNs, Python would know to skip\n" +"over those cells." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:248 +# code block +msgid "~~~\n" +"surveys_df['weight'].mean()\n" +"42.672428212991356\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:252 +msgid "{: .language-python}\n" +"Dealing with missing data values is always a challenge. It's sometimes hard to\n" +"know why values are missing - was it because of a data entry error? Or data that\n" +"someone was unable to collect? Should the value be 0? We need to know how\n" +"missing values are represented in the dataset in order to make good decisions.\n" +"If we're lucky, we have some metadata that will tell us more about how null\n" +"values were handled." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:260 +msgid "For instance, in some disciplines, like Remote Sensing, missing data values are\n" +"often defined as -9999. Having a bunch of -9999 values in your data could really\n" +"alter numeric calculations. Often in spreadsheets, cells are left empty where no\n" +"data are available. Pandas will, by default, replace those missing values with\n" +"NaN. However it is good practice to get in the habit of intentionally marking\n" +"cells that have no data, with a no data value! That way there are no questions\n" +"in the future when you (or someone else) explores your data." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:268 +# header +msgid "### Where Are the NaN's?" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:270 +msgid "Let's explore the NaN values in our data a bit further. Using the tools we\n" +"learned in lesson 02, we can figure out how many rows contain NaN values for\n" +"weight. We can also create a new subset from our data that only contains rows\n" +"with weight values > 0 (i.e., select meaningful weight values):" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:275 +# code block +msgid "~~~\n" +"len(surveys_df[pd.isnull(surveys_df.weight)])\n" +"# How many rows have weight values?\n" +"len(surveys_df[surveys_df.weight> 0])\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:282 +msgid "We can replace all NaN values with zeroes using the `.fillna()` method (after\n" +"making a copy of the data so we don't lose our work):" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:285 +# code block +msgid "~~~\n" +"df1 = surveys_df.copy()\n" +"# Fill all NaN values with 0\n" +"df1['weight'] = df1['weight'].fillna(0)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:292 +msgid "However NaN and 0 yield different analysis results. The mean value when NaN\n" +"values are replaced with 0 is different from when NaN values are simply thrown\n" +"out or ignored." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:296 +# code block +msgid "~~~\n" +"df1['weight'].mean()\n" +"38.751976145601844\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:302 +msgid "We can fill NaN values with any value that we chose. The code below fills all\n" +"NaN values with a mean for all weight values." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:305 +# code block +msgid "~~~\n" +"df1['weight'] = surveys_df['weight'].fillna(surveys_df['weight'].mean())\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:310 +msgid "We could also chose to create a subset of our data, only keeping rows that do\n" +"not contain NaN values." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:313 +msgid "The point is to make conscious decisions about how to manage missing data. This\n" +"is where we think about how our data will be used and how these values will\n" +"impact the scientific conclusions made from the data." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:317 +msgid "Python gives us all of the tools that we need to account for these issues. We\n" +"just need to be cautious about how the decisions that we make impact scientific\n" +"results." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:321 +# blockquote, which can be cascaded +msgid "> ## Challenge - Counting" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:322 +# blockquote, which can be cascaded +msgid "> Count the number of missing values per column. Hint: The method .count() gives you" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:323 +# blockquote, which can be cascaded +msgid "> the number of non-NA observations per column. Try looking to the .isnull() method." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:326 +#: python-ecology-lesson/_episodes/05-merging-data.md:116 +# header +msgid "## Writing Out Data to CSV" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:328 +msgid "We've learned about using manipulating data to get desired outputs. But we've also discussed\n" +"keeping data that has been manipulated separate from our raw data. Something we might be interested\n" +"in doing is working with only the columns that have full data. First, let's reload the data so\n" +"we're not mixing up all of our previous manipulations." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:336 +msgid "{: .language-python}\n" +"Next, let's drop all the rows that contain missing values. We will use the command `dropna`.\n" +"By default, dropna removes rows that contain missing data for even just one column." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:340 +# code block +msgid "~~~\n" +"df_na = surveys_df.dropna()\n" +"\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:346 +msgid "If you now type `df_na`, you should observe that the resulting DataFrame has 30676 rows\n" +"and 9 columns, much smaller than the 35549 row original." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:349 +msgid "We can now use the `to_csv` command to do export a DataFrame in CSV format. Note that the code\n" +"below will by default save the data into the current working directory. We can\n" +"save it to a different folder by adding the foldername and a slash before the filename:\n" +"`df.to_csv('foldername/out.csv')`. We use 'index=False' so that\n" +"pandas doesn't include the index number for each line." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:355 +# code block +msgid "~~~\n" +"# Write DataFrame to CSV\n" +"df_na.to_csv('data_output/surveys_complete.csv', index=False)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:361 +msgid "We will use this data file later in the workshop. Check out your working directory to make\n" +"sure the CSV wrote out properly, and that you can open it! If you want, try to bring it\n" +"back into Python to make sure it imports properly." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:366 +# header +msgid "## Recap" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:368 +msgid "What we've learned:" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:370 +# unordered list +msgid "+ How to explore the data types of columns within a DataFrame" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:371 +# unordered list +msgid "+ How to change the data type" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:372 +# unordered list +msgid "+ What NaN values are, how they might be represented, and what this means for your work" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:373 +# unordered list +msgid "+ How to replace NaN values, if desired" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:374 +# unordered list +msgid "+ How to use `to_csv` to write manipulated data to a file." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:1 +# Front Matter +msgid "---\n" +"title: Combining DataFrames with Pandas\n" +"teaching: 20\n" +"exercises: 25\n" +"questions:\n" +" - \"Can I work with data from multiple sources?\"\n" +" - \"How can I combine data from different data sets?\"\n" +"objectives:\n" +" - \"Combine data from multiple files into a single DataFrame using merge and concat.\"\n" +" - \"Combine two DataFrames using a unique ID found in both DataFrames.\"\n" +" - \"Employ `to_csv` to export a DataFrame in CSV format.\"\n" +" - \"Join DataFrames using common fields (join keys).\"\n" +"keypoints:\n" +" - \"Pandas' `merge` and `concat` can be used to combine subsets of a DataFrame, or even data from different files.\"\n" +" - \"`join` function combines DataFrames based on index or column.\"\n" +" - \"Joining two DataFrames can be done in multiple ways (left, right, and inner) depending on what data must be in the final DataFrame.\"\n" +" - \"`to_csv` can be used to write out DataFrames in CSV format.\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:20 +msgid "In many \"real world\" situations, the data that we want to use come in multiple\n" +"files. We often need to combine these files into a single DataFrame to analyze\n" +"the data. The pandas package provides [various methods for combining\n" +"DataFrames](http://pandas.pydata.org/pandas-docs/stable/merging.html) including\n" +"`merge` and `concat`." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:26 +msgid "To work through the examples below, we first need to load the species and\n" +"surveys files into pandas DataFrames. In iPython:" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:29 +# code block +msgid "~~~\n" +"import pandas as pd\n" +"surveys_df = pd.read_csv(\"data/surveys.csv\",\n" +" keep_default_na=False, na_values=[\"\"])\n" +"surveys_df\n" +"\n" +" record_id month day year plot species sex hindfoot_length weight\n" +"0 1 7 16 1977 2 NA M 32 NaN\n" +"1 2 7 16 1977 3 NA M 33 NaN\n" +"2 3 7 16 1977 2 DM F 37 NaN\n" +"3 4 7 16 1977 7 DM M 36 NaN\n" +"4 5 7 16 1977 3 DM M 35 NaN\n" +"... ... ... ... ... ... ... ... ... ...\n" +"35544 35545 12 31 2002 15 AH NaN NaN NaN\n" +"35545 35546 12 31 2002 15 AH NaN NaN NaN\n" +"35546 35547 12 31 2002 10 RM F 15 14\n" +"35547 35548 12 31 2002 7 DO M 36 51\n" +"35548 35549 12 31 2002 5 NaN NaN NaN NaN\n" +"\n" +"[35549 rows x 9 columns]\n" +"\n" +"species_df = pd.read_csv(\"data/species.csv\",\n" +" keep_default_na=False, na_values=[\"\"])\n" +"species_df\n" +" species_id genus species taxa\n" +"0 AB Amphispiza bilineata Bird\n" +"1 AH Ammospermophilus harrisi Rodent\n" +"2 AS Ammodramus savannarum Bird\n" +"3 BA Baiomys taylori Rodent\n" +"4 CB Campylorhynchus brunneicapillus Bird\n" +".. ... ... ... ...\n" +"49 UP Pipilo sp. Bird\n" +"50 UR Rodent sp. Rodent\n" +"51 US Sparrow sp. Bird\n" +"52 ZL Zonotrichia leucophrys Bird\n" +"53 ZM Zenaida macroura Bird\n" +"\n" +"[54 rows x 4 columns]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:70 +msgid "Take note that the `read_csv` method we used can take some additional options which\n" +"we didn't use previously. Many functions in Python have a set of options that\n" +"can be set by the user if needed. In this case, we have told pandas to assign\n" +"empty values in our CSV to NaN `keep_default_na=False, na_values=[\"\"]`.\n" +"[More about all of the read_csv options here.](http://pandas.pydata.org/pandas-docs/dev/generated/pandas.io.parsers.read_csv.html)" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:76 +# header +msgid "# Concatenating DataFrames" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:78 +msgid "We can use the `concat` function in pandas to append either columns or rows from\n" +"one DataFrame to another. Let's grab two subsets of our data to see how this\n" +"works." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:82 +# code block +msgid "~~~\n" +"# Read in first 10 lines of surveys table\n" +"survey_sub = surveys_df.head(10)\n" +"# Grab the last 10 rows\n" +"survey_sub_last10 = surveys_df.tail(10)\n" +"# Reset the index values to the second dataframe appends properly\n" +"survey_sub_last10=survey_sub_last10.reset_index(drop=True)\n" +"# drop=True option avoids adding new index column with old index values\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:93 +msgid "When we concatenate DataFrames, we need to specify the axis. `axis=0` tells\n" +"pandas to stack the second DataFrame under the first one. It will automatically\n" +"detect whether the column names are the same and will stack accordingly.\n" +"`axis=1` will stack the columns in the second DataFrame to the RIGHT of the\n" +"first DataFrame. To stack the data vertically, we need to make sure we have the\n" +"same columns and associated column format in both datasets. When we stack\n" +"horizonally, we want to make sure what we are doing makes sense (ie the data are\n" +"related in some way)." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:102 +# code block +msgid "~~~\n" +"# Stack the DataFrames on top of each other\n" +"vertical_stack = pd.concat([survey_sub, survey_sub_last10], axis=0)\n" +"\n" +"# Place the DataFrames side by side\n" +"horizontal_stack = pd.concat([survey_sub, survey_sub_last10], axis=1)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:111 +# header +msgid "### Row Index Values and Concat" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:112 +msgid "Have a look at the `vertical_stack` dataframe? Notice anything unusual?\n" +"The row indexes for the two data frames `survey_sub` and `survey_sub_last10`\n" +"have been repeated. We can reindex the new dataframe using the `reset_index()` method." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:118 +msgid "We can use the `to_csv` command to do export a DataFrame in CSV format. Note that the code\n" +"below will by default save the data into the current working directory. We can\n" +"save it to a different folder by adding the foldername and a slash to the file\n" +"`vertical_stack.to_csv('foldername/out.csv')`. We use the 'index=False' so that\n" +"pandas doesn't include the index number for each line." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:124 +# code block +msgid "~~~\n" +"# Write DataFrame to CSV\n" +"vertical_stack.to_csv('data_output/out.csv', index=False)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:130 +msgid "Check out your working directory to make sure the CSV wrote out properly, and\n" +"that you can open it! If you want, try to bring it back into Python to make sure\n" +"it imports properly." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:134 +# code block +msgid "~~~\n" +"# For kicks read our output back into Python and make sure all looks good\n" +"new_output = pd.read_csv('data_output/out.csv', keep_default_na=False, na_values=[\"\"])\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:140 +# blockquote, which can be cascaded +msgid "> ## Challenge - Combine Data" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:141 +msgid ">\n" +"> In the data folder, there are two survey data files: `survey2001.csv` and\n" +"> `survey2002.csv`. Read the data into Python and combine the files to make one\n" +"> new data frame. Create a plot of average plot weight by year grouped by sex.\n" +"> Export your results as a CSV and make sure it reads back into Python properly." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:148 +# header +msgid "# Joining DataFrames" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:150 +msgid "When we concatenated our DataFrames we simply added them to each other -\n" +"stacking them either vertically or side by side. Another way to combine\n" +"DataFrames is to use columns in each dataset that contain common values (a\n" +"common unique id). Combining DataFrames using a common field is called\n" +"\"joining\". The columns containing the common values are called \"join key(s)\".\n" +"Joining DataFrames in this way is often useful when one DataFrame is a \"lookup\n" +"table\" containing additional data that we want to include in the other." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:158 +msgid "NOTE: This process of joining tables is similar to what we do with tables in an\n" +"SQL database." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:161 +msgid "For example, the `species.csv` file that we've been working with is a lookup\n" +"table. This table contains the genus, species and taxa code for 55 species. The\n" +"species code is unique for each line. These species are identified in our survey\n" +"data as well using the unique species code. Rather than adding 3 more columns\n" +"for the genus, species and taxa to each of the 35,549 line Survey data table, we\n" +"can maintain the shorter table with the species information. When we want to\n" +"access that information, we can create a query that joins the additional columns\n" +"of information to the Survey data." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:170 +msgid "Storing data in this way has many benefits including:" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:172 +# ordered list +msgid "1. It ensures consistency in the spelling of species attributes (genus, species" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:173 +msgid " and taxa) given each species is only entered once. Imagine the possibilities\n" +" for spelling errors when entering the genus and species thousands of times!\n" +"2. It also makes it easy for us to make changes to the species information once\n" +" without having to find each instance of it in the larger survey data.\n" +"3. It optimizes the size of our data." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:180 +# header +msgid "## Joining Two DataFrames" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:182 +msgid "To better understand joins, let's grab the first 10 lines of our data as a\n" +"subset to work with. We'll use the `.head` method to do this. We'll also read\n" +"in a subset of the species table." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:186 +# code block +msgid "~~~\n" +"# Read in first 10 lines of surveys table\n" +"survey_sub = surveys_df.head(10)\n" +"\n" +"# Import a small subset of the species data designed for this part of the lesson.\n" +"# It is stored in the data folder.\n" +"species_sub = pd.read_csv('data/speciesSubset.csv', keep_default_na=False, na_values=[\"\"])\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:196 +msgid "In this example, `species_sub` is the lookup table containing genus, species, and\n" +"taxa names that we want to join with the data in `survey_sub` to produce a new\n" +"DataFrame that contains all of the columns from both `species_df` *and*\n" +"`survey_df`." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:202 +# header +msgid "## Identifying join keys" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:204 +msgid "To identify appropriate join keys we first need to know which field(s) are\n" +"shared between the files (DataFrames). We might inspect both DataFrames to\n" +"identify these columns. If we are lucky, both DataFrames will have columns with\n" +"the same name that also contain the same data. If we are less lucky, we need to\n" +"identify a (differently-named) column in each DataFrame that contains the same\n" +"information." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:211 +# code block +msgid "~~~\n" +">>> species_sub.columns\n" +"\n" +"Index([u'species_id', u'genus', u'species', u'taxa'], dtype='object')\n" +"\n" +">>> survey_sub.columns\n" +"\n" +"Index([u'record_id', u'month', u'day', u'year', u'plot_id', u'species_id',\n" +" u'sex', u'hindfoot_length', u'weight'], dtype='object')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:223 +msgid "In our example, the join key is the column containing the two-letter species\n" +"identifier, which is called `species_id`." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:226 +msgid "Now that we know the fields with the common species ID attributes in each\n" +"DataFrame, we are almost ready to join our data. However, since there are\n" +"[different types of joins](http://blog.codinghorror.com/a-visual-explanation-of-sql-joins/), we\n" +"also need to decide which type of join makes sense for our analysis." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:231 +# header +msgid "## Inner joins" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:233 +msgid "The most common type of join is called an _inner join_. An inner join combines\n" +"two DataFrames based on a join key and returns a new DataFrame that contains\n" +"**only** those rows that have matching values in *both* of the original\n" +"DataFrames." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:238 +msgid "Inner joins yield a DataFrame that contains only rows where the value being\n" +"joins exists in BOTH tables. An example of an inner join, adapted from [this\n" +"page](http://blog.codinghorror.com/a-visual-explanation-of-sql-joins/) is below:" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:242 +msgid "![Inner join -- courtesy of codinghorror.com](../fig/inner-join.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:244 +msgid "The pandas function for performing joins is called `merge` and an Inner join is\n" +"the default option:" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:247 +# code block +msgid "~~~\n" +"merged_inner = pd.merge(left=survey_sub,right=species_sub, left_on='species_id', right_on='species_id')\n" +"# In this case `species_id` is the only column name in both dataframes, so if we skipped `left_on`\n" +"# And `right_on` arguments we would still get the same result\n" +"\n" +"# What's the size of the output data?\n" +"merged_inner.shape\n" +"merged_inner\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:258 +# code block +msgid "~~~\n" +" record_id month day year plot_id species_id sex hindfoot_length \\\n" +"0 1 7 16 1977 2 NL M 32\n" +"1 2 7 16 1977 3 NL M 33\n" +"2 3 7 16 1977 2 DM F 37\n" +"3 4 7 16 1977 7 DM M 36\n" +"4 5 7 16 1977 3 DM M 35\n" +"5 8 7 16 1977 1 DM M 37\n" +"6 9 7 16 1977 1 DM F 34\n" +"7 7 7 16 1977 2 PE F NaN\n" +"\n" +" weight genus species taxa\n" +"0 NaN Neotoma albigula Rodent\n" +"1 NaN Neotoma albigula Rodent\n" +"2 NaN Dipodomys merriami Rodent\n" +"3 NaN Dipodomys merriami Rodent\n" +"4 NaN Dipodomys merriami Rodent\n" +"5 NaN Dipodomys merriami Rodent\n" +"6 NaN Dipodomys merriami Rodent\n" +"7 NaN Peromyscus eremicus Rodent\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:281 +msgid "The result of an inner join of `survey_sub` and `species_sub` is a new DataFrame\n" +"that contains the combined set of columns from `survey_sub` and `species_sub`. It\n" +"*only* contains rows that have two-letter species codes that are the same in\n" +"both the `survey_sub` and `species_sub` DataFrames. In other words, if a row in\n" +"`survey_sub` has a value of `species_id` that does *not* appear in the `species_id`\n" +"column of `species`, it will not be included in the DataFrame returned by an\n" +"inner join. Similarly, if a row in `species_sub` has a value of `species_id`\n" +"that does *not* appear in the `species_id` column of `survey_sub`, that row will not\n" +"be included in the DataFrame returned by an inner join." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:291 +msgid "The two DataFrames that we want to join are passed to the `merge` function using\n" +"the `left` and `right` argument. The `left_on='species'` argument tells `merge`\n" +"to use the `species_id` column as the join key from `survey_sub` (the `left`\n" +"DataFrame). Similarly , the `right_on='species_id'` argument tells `merge` to\n" +"use the `species_id` column as the join key from `species_sub` (the `right`\n" +"DataFrame). For inner joins, the order of the `left` and `right` arguments does\n" +"not matter." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:299 +msgid "The result `merged_inner` DataFrame contains all of the columns from `survey_sub`\n" +"(record id, month, day, etc.) as well as all the columns from `species_sub`\n" +"(species_id, genus, species, and taxa)." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:303 +msgid "Notice that `merged_inner` has fewer rows than `survey_sub`. This is an\n" +"indication that there were rows in `surveys_df` with value(s) for `species_id` that\n" +"do not exist as value(s) for `species_id` in `species_df`." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:307 +# header +msgid "## Left joins" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:309 +msgid "What if we want to add information from `species_sub` to `survey_sub` without\n" +"losing any of the information from `survey_sub`? In this case, we use a different\n" +"type of join called a \"left outer join\", or a \"left join\"." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:313 +msgid "Like an inner join, a left join uses join keys to combine two DataFrames. Unlike\n" +"an inner join, a left join will return *all* of the rows from the `left`\n" +"DataFrame, even those rows whose join key(s) do not have values in the `right`\n" +"DataFrame. Rows in the `left` DataFrame that are missing values for the join\n" +"key(s) in the `right` DataFrame will simply have null (i.e., NaN or None) values\n" +"for those columns in the resulting joined DataFrame." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:320 +msgid "Note: a left join will still discard rows from the `right` DataFrame that do not\n" +"have values for the join key(s) in the `left` DataFrame." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:323 +msgid "![Left Join](../fig/left-join.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:325 +msgid "A left join is performed in pandas by calling the same `merge` function used for\n" +"inner join, but using the `how='left'` argument:" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:328 +# code block +msgid "~~~\n" +"merged_left = pd.merge(left=survey_sub,right=species_sub, how='left', left_on='species_id', right_on='species_id')\n" +"merged_left\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:332 +msgid "{: .language-python}\n" +"~~~\n" +" record_id month day year plot_id species_id sex hindfoot_length \\\n" +"0 1 7 16 1977 2 NL M 32\n" +"1 2 7 16 1977 3 NL M 33\n" +"2 3 7 16 1977 2 DM F 37\n" +"3 4 7 16 1977 7 DM M 36\n" +"4 5 7 16 1977 3 DM M 35\n" +"5 6 7 16 1977 1 PF M 14\n" +"6 7 7 16 1977 2 PE F NaN\n" +"7 8 7 16 1977 1 DM M 37\n" +"8 9 7 16 1977 1 DM F 34\n" +"9 10 7 16 1977 6 PF F 20" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:346 +msgid " weight genus species taxa\n" +"0 NaN Neotoma albigula Rodent\n" +"1 NaN Neotoma albigula Rodent\n" +"2 NaN Dipodomys merriami Rodent\n" +"3 NaN Dipodomys merriami Rodent\n" +"4 NaN Dipodomys merriami Rodent\n" +"5 NaN NaN NaN NaN\n" +"6 NaN Peromyscus eremicus Rodent\n" +"7 NaN Dipodomys merriami Rodent\n" +"8 NaN Dipodomys merriami Rodent\n" +"9 NaN NaN NaN NaN\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:360 +msgid "The result DataFrame from a left join (`merged_left`) looks very much like the\n" +"result DataFrame from an inner join (`merged_inner`) in terms of the columns it\n" +"contains. However, unlike `merged_inner`, `merged_left` contains the **same\n" +"number of rows** as the original `survey_sub` DataFrame. When we inspect\n" +"`merged_left`, we find there are rows where the information that should have\n" +"come from `species_sub` (i.e., `species_id`, `genus`, and `taxa`) is\n" +"missing (they contain NaN values):" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:368 +# code block +msgid "~~~\n" +"merged_left[ pd.isnull(merged_left.genus) ]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:371 +msgid "{: .language-python}\n" +"~~~\n" +" record_id month day year plot_id species_id sex hindfoot_length \\\n" +"5 6 7 16 1977 1 PF M 14\n" +"9 10 7 16 1977 6 PF F 20" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:377 +msgid " weight genus species taxa\n" +"5 NaN NaN NaN NaN\n" +"9 NaN NaN NaN NaN\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:383 +msgid "These rows are the ones where the value of `species_id` from `survey_sub` (in this\n" +"case, `PF`) does not occur in `species_sub`." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:387 +# header +msgid "## Other join types" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:389 +msgid "The pandas `merge` function supports two other join types:" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:391 +# unordered list +msgid "* Right (outer) join: Invoked by passing `how='right'` as an argument. Similar" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:392 +msgid " to a left join, except *all* rows from the `right` DataFrame are kept, while\n" +" rows from the `left` DataFrame without matching join key(s) values are\n" +" discarded.\n" +"* Full (outer) join: Invoked by passing `how='outer'` as an argument. This join\n" +" type returns the all pairwise combinations of rows from both DataFrames; i.e.,\n" +" the result DataFrame will `NaN` where data is missing in one of the dataframes. This join type is\n" +" very rarely used." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:400 +# header +msgid "# Final Challenges" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:402 +# blockquote, which can be cascaded +msgid "> ## Challenge - Distributions" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:403 +# blockquote, which can be cascaded +msgid "> Create a new DataFrame by joining the contents of the `surveys.csv` and" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:404 +# blockquote, which can be cascaded +msgid "> `species.csv` tables. Then calculate and plot the distribution of:" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:405 +msgid ">\n" +"> 1. taxa by plot\n" +"> 2. taxa by sex by plot" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:410 +# blockquote, which can be cascaded +msgid "> ## Challenge - Diversity Index" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:411 +msgid ">\n" +"> 1. In the data folder, there is a `plots.csv` file that contains information about the\n" +"> type associated with each plot. Use that data to summarize the number of\n" +"> plots by plot type.\n" +"> 2. Calculate a diversity index of your choice for control vs rodent exclosure\n" +"> plots. The index should consider both species abundance and number of\n" +"> species. You might choose to use the simple [biodiversity index described\n" +"> here](http://www.amnh.org/explore/curriculum-collections/biodiversity-counts/plant-ecology/how-to-calculate-a-biodiversity-index)\n" +"> which calculates diversity as:\n" +">\n" +"> the number of species in the plot / the total number of individuals in the plot = Biodiversity index." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:1 +# Front Matter +msgid "---\n" +"title: Data Workflows and Automation\n" +"teaching: 40\n" +"exercises: 50\n" +"questions:\n" +" - \"Can I automate operations in Python?\"\n" +" - \"What are functions and why should I use them?\"\n" +"objectives:\n" +" - \"Describe why for loops are used in Python.\"\n" +" - \"Employ for loops to automate data analysis.\"\n" +" - \"Write unique filenames in Python.\"\n" +" - \"Build reusable code in Python.\"\n" +" - \"Write functions using conditional statements (if, then, else).\"\n" +"keypoints:\n" +" - \"Loops help automate repetitive tasks over sets of items.\"\n" +" - \"Loops combined with functions provide a way to process data more efficiently than we could by hand.\"\n" +" - \"Conditional statements enable execution of different operations on different data.\"\n" +" - \"Functions enable code reuse.\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:21 +msgid "So far, we've used Python and the pandas library to explore and manipulate\n" +"individual datasets by hand, much like we would do in a spreadsheet. The beauty\n" +"of using a programming language like Python, though, comes from the ability to\n" +"automate data processing through the use of loops and functions." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:26 +# header +msgid "## For loops" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:28 +msgid "Loops allow us to repeat a workflow (or series of actions) a given number of\n" +"times or while some condition is true. We would use a loop to automatically\n" +"process data that's stored in multiple files (daily values with one file per\n" +"year, for example). Loops lighten our work load by performing repeated tasks\n" +"without our direct involvement and make it less likely that we'll introduce\n" +"errors by making mistakes while processing each file by hand." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:35 +msgid "Let's write a simple for loop that simulates what a kid might see during a\n" +"visit to the zoo:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:38 +# code block +msgid "~~~\n" +"animals = ['lion', 'tiger', 'crocodile', 'vulture', 'hippo']\n" +"print(animals)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:44 +# code block +msgid "~~~\n" +"['lion', 'tiger', 'crocodile', 'vulture', 'hippo']\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:49 +# code block +msgid "~~~\n" +"for creature in animals:\n" +" print(creature)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:55 +# code block +msgid "~~~\n" +"lion\n" +"tiger\n" +"crocodile\n" +"vulture\n" +"hippo\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:64 +msgid "The line defining the loop must start with `for` and end with a colon, and the\n" +"body of the loop must be indented." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:67 +msgid "In this example, `creature` is the loop variable that takes the value of the next\n" +"entry in `animals` every time the loop goes around. We can call the loop variable\n" +"anything we like. After the loop finishes, the loop variable will still exist\n" +"and will have the value of the last entry in the collection:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:72 +# code block +msgid "~~~\n" +"animals = ['lion', 'tiger', 'crocodile', 'vulture', 'hippo']\n" +"for creature in animals:\n" +" pass\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:79 +# code block +msgid "~~~\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:83 +# code block +msgid "~~~\n" +"print('The loop variable is now: ' + creature)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:88 +# code block +msgid "~~~\n" +"The loop variable is now: hippo\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:93 +msgid "We are not asking Python to print the value of the loop variable anymore, but\n" +"the for loop still runs and the value of `creature` changes on each pass through\n" +"the loop. The statement `pass` in the body of the loop just means \"do nothing\"." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:97 +# blockquote, which can be cascaded +msgid "> ## Challenge - Loops" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:98 +msgid ">\n" +"> 1. What happens if we don't include the `pass` statement?\n" +">\n" +"> 2. Rewrite the loop so that the animals are separated by commas, not new lines\n" +"> (Hint: You can concatenate strings using a plus sign. For example,\n" +"> `print(string1 + string2)` outputs 'string1string2')." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:106 +# header +msgid "## Automating data processing using For Loops" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:108 +msgid "The file we've been using so far, `surveys.csv`, contains 25 years of data and is\n" +"very large. We would like to separate the data for each year into a separate\n" +"file." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:112 +msgid "Let's start by making a new directory inside the folder `data` to store all of\n" +"these files using the module `os`:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:115 +# code block +msgid "~~~\n" +"import os\n" +"\n" +"os.mkdir('data/yearly_files')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:122 +msgid "The command `os.mkdir` is equivalent to `mkdir` in the shell. Just so we are\n" +"sure, we can check that the new directory was created within the `data` folder:\n" +"~~~\n" +"os.listdir('data')\n" +"~~~\n" +"{: .language-python}\n" +"~~~\n" +"['plots.csv',\n" +" 'portal_mammals.sqlite',\n" +" 'species.csv',\n" +" 'survey2001.csv',\n" +" 'survey2002.csv',\n" +" 'surveys.csv',\n" +" 'surveys2002_temp.csv',\n" +" 'yearly_files']\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:140 +msgid "The command `os.listdir` is equivalent to `ls` in the shell." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:142 +msgid "In previous lessons, we saw how to use the library pandas to load the species\n" +"data into memory as a DataFrame, how to select a subset of the data using some\n" +"criteria, and how to write the DataFrame into a CSV file. Let's write a script\n" +"that performs those three steps in sequence for the year 2002:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:147 +# code block +msgid "~~~\n" +"import pandas as pd\n" +"\n" +"# Load the data into a DataFrame\n" +"surveys_df = pd.read_csv('data/surveys.csv')\n" +"\n" +"# Select only data for the year 2002\n" +"surveys2002 = surveys_df[surveys_df.year == 2002]\n" +"\n" +"# Write the new DataFrame to a CSV file\n" +"surveys2002.to_csv('data/yearly_files/surveys2002.csv')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:161 +msgid "To create yearly data files, we could repeat the last two commands over and\n" +"over, once for each year of data. Repeating code is neither elegant nor\n" +"practical, and is very likely to introduce errors into your code. We want to\n" +"turn what we've just written into a loop that repeats the last two commands for\n" +"every year in the dataset." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:167 +msgid "Let's start by writing a loop that simply prints the names of the files we want\n" +"to create - the dataset we are using covers 1977 through 2002, and we'll create\n" +"a separate file for each of those years. Listing the filenames is a good way to\n" +"confirm that the loop is behaving as we expect." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:172 +msgid "We have seen that we can loop over a list of items, so we need a list of years\n" +"to loop over. We can get the years in our DataFrame with:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:175 +# code block +msgid "~~~\n" +"surveys_df['year']\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:178 +msgid "{: .language-python}\n" +"~~~\n" +"0 1977\n" +"1 1977\n" +"2 1977\n" +"3 1977\n" +" ...\n" +"35545 2002\n" +"35546 2002\n" +"35547 2002\n" +"35548 2002\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:192 +msgid "but we want only unique years, which we can get using the `unique` method\n" +"which we have already seen." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:195 +# code block +msgid "~~~\n" +"surveys_df['year'].unique()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:198 +msgid "{: .language-python}\n" +"~~~\n" +"array([1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987,\n" +" 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,\n" +" 1999, 2000, 2001, 2002], dtype=int64)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:206 +msgid "Putting this into our for loop we get" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:208 +# code block +msgid "~~~\n" +"for year in surveys_df['year'].unique():\n" +" filename='data/yearly_files/surveys' + str(year) + '.csv'\n" +" print(filename)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:213 +msgid "{: .language-python}\n" +"~~~\n" +"data/yearly_files/surveys1977.csv\n" +"data/yearly_files/surveys1978.csv\n" +"data/yearly_files/surveys1979.csv\n" +"data/yearly_files/surveys1980.csv\n" +"data/yearly_files/surveys1981.csv\n" +"data/yearly_files/surveys1982.csv\n" +"data/yearly_files/surveys1983.csv\n" +"data/yearly_files/surveys1984.csv\n" +"data/yearly_files/surveys1985.csv\n" +"data/yearly_files/surveys1986.csv\n" +"data/yearly_files/surveys1987.csv\n" +"data/yearly_files/surveys1988.csv\n" +"data/yearly_files/surveys1989.csv\n" +"data/yearly_files/surveys1990.csv\n" +"data/yearly_files/surveys1991.csv\n" +"data/yearly_files/surveys1992.csv\n" +"data/yearly_files/surveys1993.csv\n" +"data/yearly_files/surveys1994.csv\n" +"data/yearly_files/surveys1995.csv\n" +"data/yearly_files/surveys1996.csv\n" +"data/yearly_files/surveys1997.csv\n" +"data/yearly_files/surveys1998.csv\n" +"data/yearly_files/surveys1999.csv\n" +"data/yearly_files/surveys2000.csv\n" +"data/yearly_files/surveys2001.csv\n" +"data/yearly_files/surveys2002.csv\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:244 +msgid "We can now add the rest of the steps we need to create separate text files:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:246 +# code block +msgid "~~~\n" +"# Load the data into a DataFrame\n" +"surveys_df = pd.read_csv('data/surveys.csv')\n" +"\n" +"for year in surveys_df['year'].unique():\n" +"\n" +" # Select data for the year\n" +" surveys_year = surveys_df[surveys_df.year == year]\n" +"\n" +" # Write the new DataFrame to a CSV file\n" +" filename = 'data/yearly_files/surveys' + str(year) + '.csv'\n" +" surveys_year.to_csv(filename)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:261 +msgid "Look inside the `yearly_files` directory and check a couple of the files you\n" +"just created to confirm that everything worked as expected." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:264 +# header +msgid "## Writing Unique FileNames" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:266 +msgid "Notice that the code above created a unique filename for each year." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:268 +# code block +msgid "~~~\n" +"filename = 'data/yearly_files/surveys' + str(year) + '.csv'\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:273 +msgid "Let's break down the parts of this name:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:275 +# unordered list +msgid "* The first part is simply some text that specifies the directory to store our" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:276 +msgid " data file in (data/yearly_files/) and the first part of the file name\n" +" (surveys): `'data/yearly_files/surveys'`\n" +"* We can concatenate this with the value of a variable, in this case `year` by\n" +" using the plus `+` sign and the variable we want to add to the file name: `+\n" +" str(year)`\n" +"* Then we add the file extension as another text string: `+ '.csv'`" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:283 +msgid "Notice that we use single quotes to add text strings. The variable is not\n" +"surrounded by quotes. This code produces the string\n" +"`data/yearly_files/surveys2002.csv` which contains the path to the new filename\n" +"AND the file name itself." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:288 +# blockquote, which can be cascaded +msgid "> ## Challenge - Modifying loops" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:289 +msgid ">\n" +"> 1. Some of the surveys you saved are missing data (they have null values that\n" +"> show up as NaN - Not A Number - in the DataFrames and do not show up in the text\n" +"> files). Modify the for loop so that the entries with null values are not\n" +"> included in the yearly files.\n" +">\n" +"> 2. Let's say you only want to look at data from a given multiple of years. How would you modify your loop in order to generate a data file for only every 5th year, starting from 1977?\n" +">\n" +"> 3. Instead of splitting out the data by years, a colleague wants to do analyses each species separately. How would you write a unique CSV file for each species?" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:300 +# header +msgid "## Building reusable and modular code with functions" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:302 +msgid "Suppose that separating large data files into individual yearly files is a task\n" +"that we frequently have to perform. We could write a **for loop** like the one above\n" +"every time we needed to do it but that would be time consuming and error prone.\n" +"A more elegant solution would be to create a reusable tool that performs this\n" +"task with minimum input from the user. To do this, we are going to turn the code\n" +"we've already written into a function." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:309 +msgid "Functions are reusable, self-contained pieces of code that are called with a\n" +"single command. They can be designed to accept arguments as input and return\n" +"values, but they don't need to do either. Variables declared inside functions\n" +"only exist while the function is running and if a variable within the function\n" +"(a local variable) has the same name as a variable somewhere else in the code,\n" +"the local variable hides but doesn't overwrite the other." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:316 +msgid "Every method used in Python (for example, `print`) is a function, and the\n" +"libraries we import (say, `pandas`) are a collection of functions. We will only\n" +"use functions that are housed within the same code that uses them, but it's also\n" +"easy to write functions that can be used by different programs." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:321 +msgid "Functions are declared following this general structure:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:323 +# code block +msgid "~~~\n" +"def this_is_the_function_name(input_argument1, input_argument2):\n" +"\n" +" # The body of the function is indented\n" +" # This function prints the two arguments to screen\n" +" print('The function arguments are:', input_argument1, input_argument2, '(this is done inside the function!)')\n" +"\n" +" # And returns their product\n" +" return input_argument1 * input_argument2\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:335 +msgid "The function declaration starts with the word `def`, followed by the function\n" +"name and any arguments in parenthesis, and ends in a colon. The body of the\n" +"function is indented just like loops are. If the function returns something when\n" +"it is called, it includes a return statement at the end." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:340 +msgid "This is how we call the function:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:342 +# code block +msgid "~~~\n" +"product_of_inputs = this_is_the_function_name(2,5)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:347 +# code block +msgid "~~~\n" +"The function arguments are: 2 5 (this is done inside the function!)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:352 +# code block +msgid "~~~\n" +"print('Their product is:', product_of_inputs, '(this is done outside the function!)')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:357 +# code block +msgid "~~~\n" +"Their product is: 10 (this is done outside the function!)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:362 +# blockquote, which can be cascaded +msgid "> ## Challenge - Functions" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:363 +msgid ">\n" +"> 1. Change the values of the arguments in the function and check its output\n" +"> 2. Try calling the function by giving it the wrong number of arguments (not 2)\n" +"> or not assigning the function call to a variable (no `product_of_inputs =`)\n" +"> 3. Declare a variable inside the function and test to see where it exists (Hint:\n" +"> can you print it from outside the function?)\n" +"> 4. Explore what happens when a variable both inside and outside the function\n" +"> have the same name. What happens to the global variable when you change the\n" +"> value of the local variable?" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:374 +msgid "We can now turn our code for saving yearly data files into a function. There are\n" +"many different \"chunks\" of this code that we can turn into functions, and we can\n" +"even create functions that call other functions inside them. Let's first write a\n" +"function that separates data for just one year and saves that data to a file:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:379 +# code block +msgid "~~~\n" +"def one_year_csv_writer(this_year, all_data):\n" +" \"\"\"\n" +" Writes a csv file for data from a given year.\n" +"\n" +" this_year --- year for which data is extracted\n" +" all_data --- DataFrame with multi-year data\n" +" \"\"\"\n" +"\n" +" # Select data for the year\n" +" surveys_year = all_data[all_data.year == this_year]\n" +"\n" +" # Write the new DataFrame to a csv file\n" +" filename = 'data/yearly_files/function_surveys' + str(this_year) + '.csv'\n" +" surveys_year.to_csv(filename)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:397 +msgid "The text between the two sets of triple double quotes is called a docstring and\n" +"contains the documentation for the function. It does nothing when the function\n" +"is running and is therefore not necessary, but it is good practice to include\n" +"docstrings as a reminder of what the code does. Docstrings in functions also\n" +"become part of their 'official' documentation:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:403 +# code block +msgid "~~~\n" +"one_year_csv_writer?\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:408 +# code block +msgid "~~~\n" +"one_year_csv_writer(2002, surveys_df)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:413 +msgid "We changed the root of the name of the CSV file so we can distinguish it from\n" +"the one we wrote before. Check the `yearly_files` directory for the file. Did it\n" +"do what you expect?" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:417 +msgid "What we really want to do, though, is create files for multiple years without\n" +"having to request them one by one. Let's write another function that replaces\n" +"the entire For loop by simply looping through a sequence of years and repeatedly\n" +"calling the function we just wrote, `one_year_csv_writer`:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:423 +# code block +msgid "~~~\n" +"def yearly_data_csv_writer(start_year, end_year, all_data):\n" +" \"\"\"\n" +" Writes separate CSV files for each year of data.\n" +"\n" +" start_year --- the first year of data we want\n" +" end_year --- the last year of data we want\n" +" all_data --- DataFrame with multi-year data\n" +" \"\"\"\n" +"\n" +" # \"end_year\" is the last year of data we want to pull, so we loop to end_year+1\n" +" for year in range(start_year, end_year+1):\n" +" one_year_csv_writer(year, all_data)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:439 +msgid "Because people will naturally expect that the end year for the files is the last\n" +"year with data, the for loop inside the function ends at `end_year + 1`. By\n" +"writing the entire loop into a function, we've made a reusable tool for whenever\n" +"we need to break a large data file into yearly files. Because we can specify the\n" +"first and last year for which we want files, we can even use this function to\n" +"create files for a subset of the years available. This is how we call this\n" +"function:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:447 +# code block +msgid "~~~\n" +"# Load the data into a DataFrame\n" +"surveys_df = pd.read_csv('data/surveys.csv')\n" +"\n" +"# Create CSV files\n" +"yearly_data_csv_writer(1977, 2002, surveys_df)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:456 +msgid "BEWARE! If you are using IPython Notebooks and you modify a function, you MUST\n" +"re-run that cell in order for the changed function to be available to the rest\n" +"of the code. Nothing will visibly happen when you do this, though, because\n" +"simply defining a function without *calling* it doesn't produce an output. Any\n" +"cells that use the now-changed functions will also have to be re-run for their\n" +"output to change." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:463 +# blockquote, which can be cascaded +msgid "> ## Challenge- More functions" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:464 +msgid ">\n" +"> 1. Add two arguments to the functions we wrote that take the path of the\n" +"> directory where the files will be written and the root of the file name.\n" +"> Create a new set of files with a different name in a different directory.\n" +"> 2. How could you use the function `yearly_data_csv_writer` to create a CSV file\n" +"> for only one year? (Hint: think about the syntax for `range`)\n" +"> 3. Make the functions return a list of the files they have written. There are\n" +"> many ways you can do this (and you should try them all!): either of the\n" +"> functions can print to screen, either can use a return statement to give back\n" +"> numbers or strings to their function call, or you can use some combination of\n" +"> the two. You could also try using the `os` library to list the contents of\n" +"> directories.\n" +"> 4. Explore what happens when variables are declared inside each of the functions\n" +"> versus in the main (non-indented) body of your code. What is the scope of the\n" +"> variables (where are they visible)? What happens when they have the same name\n" +"> but are given different values?" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:482 +msgid "The functions we wrote demand that we give them a value for every argument.\n" +"Ideally, we would like these functions to be as flexible and independent as\n" +"possible. Let's modify the function `yearly_data_csv_writer` so that the\n" +"`start_year` and `end_year` default to the full range of the data if they are\n" +"not supplied by the user. Arguments can be given default values with an equal\n" +"sign in the function declaration. Any arguments in the function without default\n" +"values (here, `all_data`) is a required argument and MUST come before the\n" +"argument with default values (which are optional in the function call)." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:491 +# code block +msgid "~~~\n" +"def yearly_data_arg_test(all_data, start_year = 1977, end_year = 2002):\n" +" \"\"\"\n" +" Modified from yearly_data_csv_writer to test default argument values!\n" +"\n" +" start_year --- the first year of data we want --- default: 1977\n" +" end_year --- the last year of data we want --- default: 2002\n" +" all_data --- DataFrame with multi-year data\n" +" \"\"\"\n" +"\n" +" return start_year, end_year\n" +"\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, 1988, 1993)\n" +"print('Both optional arguments:\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df)\n" +"print('Default values:\\t\\t\\t', start, end)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:512 +# code block +msgid "~~~\n" +"Both optional arguments: 1988 1993\n" +"Default values: 1977 2002\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:518 +msgid "The \"\\t\" in the `print` statements are tabs, used to make the text align and be\n" +"easier to read." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:521 +msgid "But what if our dataset doesn't start in 1977 and end in 2002? We can modify the\n" +"function so that it looks for the start and end years in the dataset if those\n" +"dates are not provided:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:525 +# code block +msgid "~~~\n" +"def yearly_data_arg_test(all_data, start_year = None, end_year = None):\n" +" \"\"\"\n" +" Modified from yearly_data_csv_writer to test default argument values!\n" +"\n" +" start_year --- the first year of data we want --- default: None - check all_data\n" +" end_year --- the last year of data we want --- default: None - check all_data\n" +" all_data --- DataFrame with multi-year data\n" +" \"\"\"\n" +"\n" +" if start_year is None:\n" +" start_year = min(all_data.year)\n" +" if end_year is None:\n" +" end_year = max(all_data.year)\n" +"\n" +" return start_year, end_year\n" +"\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, 1988, 1993)\n" +"print('Both optional arguments:\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df)\n" +"print('Default values:\\t\\t\\t', start, end)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:549 +msgid "{: .language-python}\n" +"~~~\n" +"Both optional arguments: 1988 1993\n" +"Default values: 1977 2002\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:556 +msgid "The default values of the `start_year` and `end_year` arguments in the function\n" +"`yearly_data_arg_test` are now `None`. This is a build-it constant in Python\n" +"that indicates the absence of a value - essentially, that the variable exists in\n" +"the namespace of the function (the directory of variable names) but that it\n" +"doesn't correspond to any existing object." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:562 +# blockquote, which can be cascaded +msgid "> ## Challenge - Variables" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:563 +msgid ">\n" +"> 1. What type of object corresponds to a variable declared as `None`? (Hint:\n" +"> create a variable set to `None` and use the function `type()`)\n" +">\n" +"> 2. Compare the behavior of the function `yearly_data_arg_test` when the\n" +"> arguments have `None` as a default and when they do not have default values.\n" +">\n" +"> 3. What happens if you only include a value for `start_year` in the function\n" +"> call? Can you write the function call with only a value for `end_year`? (Hint:\n" +"> think about how the function must be assigning values to each of the arguments -\n" +"> this is related to the need to put the arguments without default values before\n" +"> those with default values in the function definition!)" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:577 +# header +msgid "## If Statements" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:579 +msgid "The body of the test function now has two conditionals (if statements) that\n" +"check the values of `start_year` and `end_year`. If statements execute a segment\n" +"of code when some condition is met. They commonly look something like this:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:583 +# code block +msgid "~~~\n" +"a = 5\n" +"\n" +"if a<0: # Meets first condition?\n" +"\n" +" # if a IS less than zero\n" +" print('a is a negative number')\n" +"\n" +"elif a>0: # Did not meet first condition. meets second condition?\n" +"\n" +" # if a ISN'T less than zero and IS more than zero\n" +" print('a is a positive number')\n" +"\n" +"else: # Met neither condition\n" +"\n" +" # if a ISN'T less than zero and ISN'T more than zero\n" +" print('a must be zero!')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:603 +msgid "Which would return:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:605 +# code block +msgid "~~~\n" +"a is a positive number\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:610 +msgid "Change the value of `a` to see how this function works. The statement `elif`\n" +"means \"else if\", and all of the conditional statements must end in a colon." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:613 +msgid "The if statements in the function `yearly_data_arg_test` check whether there is an\n" +"object associated with the variable names `start_year` and `end_year`. If those\n" +"variables are `None`, the if statements return the boolean `True` and execute whatever\n" +"is in their body. On the other hand, if the variable names are associated with\n" +"some value (they got a number in the function call), the if statements return `False`\n" +"and do not execute. The opposite conditional statements, which would return\n" +"`True` if the variables were associated with objects (if they had received value\n" +"in the function call), would be `if start_year` and `if end_year`." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:622 +msgid "As we've written it so far, the function `yearly_data_arg_test` associates\n" +"values in the function call with arguments in the function definition just based\n" +"in their order. If the function gets only two values in the function call, the\n" +"first one will be associated with `all_data` and the second with `start_year`,\n" +"regardless of what we intended them to be. We can get around this problem by\n" +"calling the function using keyword arguments, where each of the arguments in the\n" +"function definition is associated with a keyword and the function call passes\n" +"values to the function using these keywords:" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:631 +# code block +msgid "~~~\n" +"start,end = yearly_data_arg_test (surveys_df)\n" +"print('Default values:\\t\\t\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, 1988, 1993)\n" +"print('No keywords:\\t\\t\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, start_year = 1988, end_year = 1993)\n" +"print('Both keywords, in order:\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, end_year = 1993, start_year = 1988)\n" +"print('Both keywords, flipped:\\t\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, start_year = 1988)\n" +"print('One keyword, default end:\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, end_year = 1993)\n" +"print('One keyword, default start:\\t', start, end)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:650 +msgid "{: .language-python}\n" +"~~~\n" +"Default values: 1977 2002\n" +"No keywords: 1988 1993\n" +"Both keywords, in order: 1988 1993\n" +"Both keywords, flipped: 1988 1993\n" +"One keyword, default end: 1988 2002\n" +"One keyword, default start: 1977 1993\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:661 +# blockquote, which can be cascaded +msgid "> ## Challenge - Modifying functions" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:662 +msgid ">\n" +"> 1. Rewrite the `one_year_csv_writer` and `yearly_data_csv_writer` functions to\n" +"> have keyword arguments with default values\n" +">\n" +"> 2. Modify the functions so that they don't create yearly files if there is no\n" +"> data for a given year and display an alert to the user (Hint: use conditional\n" +"> statements to do this. For an extra challenge, use `try`\n" +"> statements!)\n" +">\n" +"> 3. The code below checks to see whether a directory exists and creates one if it\n" +"> doesn't. Add some code to your function that writes out the CSV files, to check\n" +"> for a directory to write to.\n" +">\n" +"> ~~~\n" +">if 'dir_name_here' in os.listdir('.'):\n" +"> print('Processed directory exists')\n" +">else:\n" +"> os.mkdir('dir_name_here')\n" +"> print('Processed directory created')\n" +"> ~~~\n" +"> {: .language-python }\n" +">\n" +"> 4. The code that you have written so far to loop through the years is good,\n" +"> however it is not necessarily reproducible with different datasets.\n" +"> For instance, what happens to the code if we have additional years of data\n" +"> in our CSV files? Using the tools that you learned in the previous activities,\n" +"> make a list of all years represented in the data. Then create a loop to process\n" +"> your data, that begins at the earliest year and ends at the latest year using\n" +"> that list.\n" +">\n" +"> HINT: you can create a loop with a list as follows: `for years in year_list:`" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:1 +# Front Matter +msgid "---\n" +"title: Making Plots With plotnine\n" +"teaching: 40\n" +"exercises: 50\n" +"questions:\n" +" - \"How can I visualize data in Python?\"\n" +" - \"What is 'grammar of graphics'?\"\n" +"objectives:\n" +" - \"Create a `plotnine` object.\"\n" +" - \"Set universal plot settings.\"\n" +" - \"Modify an existing plotnine object.\"\n" +" - \"Change the aesthetics of a plot such as color.\"\n" +" - \"Edit the axis labels.\"\n" +" - \"Build complex plots using a step-by-step approach.\"\n" +" - \"Create scatter plots, box plots, and time series plots.\"\n" +" - \"Use the facet_wrap and facet_grid commands to create a collection of plots splitting the data by a factor variable.\"\n" +" - \"Create customized plot styles to meet their needs.\"\n" +"keypoints:\n" +" - \"The `data`, `aes` variables and a `geometry` are the main elements of a plotnine graph\"\n" +" - \"With the `+` operator, additional `scale_*`, `theme_*`, `xlab/ylab` and `facet_*` elements are added\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:23 +# header +msgid "## Disclaimer" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:25 +msgid "Python has powerful built-in plotting capabilities such as `matplotlib`, but for\n" +"this episode, we will be using the [`plotnine`][plotnine]\n" +"package, which facilitates the creation of highly-informative plots of\n" +"structured data based on the R implementation of [`ggplot2`][ggplot2]\n" +"and [The Grammar of Graphics][grammar-of-graphics]\n" +"by Leland Wilkinson. The `plotnine`\n" +"package is built on top of Matplotlib and interacts well with Pandas." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:33 +msgid "Just as with the other packages, `plotnine` need to be imported. It is good\n" +"practice to not just load an entire package such as `from plotnine import *`,\n" +"but to use an abbreviation as we used `pd` for Pandas:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:37 +# code block +msgid "~~~\n" +"%matplotlib inline\n" +"import plotnine as p9\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:43 +msgid "From now on, the functions of `plotnine` are available using `p9.`. For the\n" +"exercise, we will use the `surveys.csv` data set, with the `NA` values removed" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:46 +# code block +msgid "~~~\n" +"import pandas as pd\n" +"\n" +"surveys_complete = pd.read_csv('data/surveys.csv')\n" +"surveys_complete = surveys_complete.dropna()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:54 +# header +msgid "## Plotting with plotnine" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:56 +msgid "The `plotnine` package (cfr. other packages conform The Grammar of Graphics) supports the creation of complex plots from data in a\n" +"dataframe. It uses default settings, which help creating publication quality\n" +"plots with a minimal amount of settings and tweaking." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:60 +msgid "`plotnine` graphics are built step by step by adding new elementsadding\n" +"different elements on top of each other using the `+` operator. Putting the\n" +"individual steps together in brackets `()` provides Python-compatible syntax." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:64 +msgid "To build a `plotnine` graphic we need to:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:66 +# unordered list +msgid "- Bind the plot to a specific data frame using the `data` argument:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:68 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete))\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:71 +msgid "{: .language-python}\n" +"As we have not defined anything else, just an empty figure is available and\n" +"presented." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:75 +msgid "As we have not defined anything else, just an empty figure is available and\n" +"presented." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:78 +# unordered list +msgid "- Define aesthetics (`aes`), by **selecting variables** used in the plot and" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:79 +msgid "`mapping` them to a presentation such as plotting size, shape color, etc. You\n" +"can interpret this as: *which** of the variables will influence the plotted\n" +"objects/geometries:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:83 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length')))\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:89 +msgid "The most important aes mappings are: `x`, `y`, `alpha`, `color`, `colour`,\n" +"`fill`, `linetype`, `shape`, `size` and `stroke`." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:92 +# unordered list +msgid "- Still no specific data is plotted, as we have to define what kind of geometry" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:93 +msgid "will be used for the plot. The most straightforward is probably using points.\n" +"Points is one of the `geoms` options, the graphical representation of the data\n" +"in the plot. Others are lines, bars,... To add a geom to the plot use `+`\n" +"operator:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:98 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:157 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length'))\n" +" + p9.geom_point()\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:106 +msgid "The `+` in the `plotnine` package is particularly useful because it allows you\n" +"to modify existing `plotnine` objects. This means you can easily set up plot\n" +"*templates* and conveniently explore different types of plots, so the above\n" +"plot can also be generated with code like this:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:112 +# code block +msgid "~~~\n" +"# Create\n" +"surveys_plot = p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length'))\n" +"\n" +"# Draw the plot\n" +"surveys_plot + p9.geom_point()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:122 +msgid "![png](../fig/06_first_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:124 +# blockquote, which can be cascaded +msgid "> ## Challenge - bar chart" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:125 +# blockquote, which can be cascaded +msgid "> Working on the `surveys_complete` data set, use the `plot-id` column to" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:126 +# blockquote, which can be cascaded +msgid "> create a `bar`-plot that counts the number of records for each plot. (Check" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:127 +# blockquote, which can be cascaded +msgid "> the documentation of the bar geometry to handle the counts)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:128 +msgid ">\n" +"> > ## Answers\n" +"> >\n" +"> > ~~~\n" +"> > (p9.ggplot(data=surveys_complete,\n" +"> > mapping=p9.aes(x='plot_id'))\n" +"> > + p9.geom_bar()\n" +"> > )\n" +"> > ~~~\n" +"> > {: .language-python}\n" +"> >\n" +"> > ![png](../fig/06_challenge_bar.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:140 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:275 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:344 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:485 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:505 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:326 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:356 +# SC/DC Template label +msgid "> {: .solution}" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:143 +msgid "Notes:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:145 +# unordered list +msgid "- Anything you put in the `ggplot()` function can be seen by any geom layers" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:146 +msgid "that you add (i.e., these are universal plot settings). This includes the `x`\n" +"and `y` axis you set up in `aes()`.\n" +"- You can also specify aesthetics for a given `geom` independently of the\n" +"aesthetics defined globally in the `ggplot()` function." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:151 +# header +msgid "## Building your plots iteratively" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:153 +msgid "Building plots with `plotnine` is typically an iterative process. We start by\n" +"defining the dataset we'll use, lay the axes, and choose a geom. Hence, the\n" +"`data`, `aes` and `geom-*` are the elementary elements of any graph:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:165 +msgid "Then, we start modifying this plot to extract more information from it. For\n" +"instance, we can add transparency (alpha) to avoid overplotting:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:169 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length'))\n" +" + p9.geom_point(alpha=0.1)\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:177 +msgid "![png](../fig/06_alpha_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:179 +msgid "We can also add colors for all the points" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:182 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length'))\n" +" + p9.geom_point(alpha=0.1, color='blue')\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:190 +msgid "![png](../fig/06_blue_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:192 +msgid "Or to color each species in the plot differently, map the `species_id` column\n" +"to the color aesthetic:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:195 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:407 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight',\n" +" y='hindfoot_length',\n" +" color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:205 +msgid "![png](../fig/06_color_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:207 +msgid "Apart from the adaptations of the arguments and settings of the `data`, `aes`\n" +"and `geom-*` elements, additional elements can be added as well, using the `+`\n" +"operator:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:211 +# unordered list +msgid "- Changing the labels:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:213 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length', color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +" + p9.xlab(\"Weight (g)\")\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:222 +msgid "![png](../fig/06_color_label_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:224 +# unordered list +msgid "- Defining scale for colors, axes,... For example, a log-version of the x-axis" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:225 +msgid "could support the interpretation of the lower numbers:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:227 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length', color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +" + p9.xlab(\"Weight (g)\")\n" +" + p9.scale_x_log10()\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:237 +msgid "![png](../fig/06_log_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:239 +# unordered list +msgid "- Changing the theme (`theme_*`) or some specific theming (`theme`) elements." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:240 +msgid "Usually plots with white background look more readable when printed. We can\n" +"set the background to white using the function `theme_bw()`." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:243 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length', color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +" + p9.xlab(\"Weight (g)\")\n" +" + p9.scale_x_log10()\n" +" + p9.theme_bw()\n" +" + p9.theme(text=p9.element_text(size=16))\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:255 +msgid "![png](../fig/06_white_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:257 +# blockquote, which can be cascaded +msgid "> ## Challenge - Bar plot adaptations" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:258 +# blockquote, which can be cascaded +msgid "> Adapt the bar plot of the previous exercise by mapping the `sex` variable to" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:259 +# blockquote, which can be cascaded +msgid "> the color fill of the bar chart. Change the `scale` of the color fill by" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:260 +# blockquote, which can be cascaded +msgid "> providing the colors `blue` and `orange` manually" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:261 +# blockquote, which can be cascaded +msgid "> (see [API reference][plotnine-api] to find the appropriate function)." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:262 +msgid ">\n" +"> > ## Answers\n" +"> >\n" +"> > ~~~\n" +"> > (p9.ggplot(data=surveys_complete,\n" +"> > mapping=p9.aes(x='plot_id',\n" +"> > fill='sex'))\n" +"> > + p9.geom_bar()\n" +"> > + p9.scale_fill_manual([\"blue\", \"orange\"])\n" +"> > )\n" +"> > ~~~\n" +"> > {: .language-python}\n" +"> > ![png](../fig/06_challenge_color_bar.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:279 +# header +msgid "## Plotting distributions" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:281 +msgid "Visualizing distributions is a common task during data exploration and\n" +"analysis. To visualize the distribution of `weight` within each `species_id`\n" +"group, a boxplot can be used:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:285 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='species_id',\n" +" y='weight'))\n" +" + p9.geom_boxplot()\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:294 +msgid "![png](../fig/06_boxplot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:296 +msgid "By adding points of the individual observations to the boxplot, we can have a\n" +"better idea of the number of measurements and of their distribution:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:299 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='species_id',\n" +" y='weight'))\n" +" + p9.geom_jitter(alpha=0.2)\n" +" + p9.geom_boxplot(alpha=0.)\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:309 +msgid "![png](../fig/06_point_boxplot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:311 +# blockquote, which can be cascaded +msgid "> ## Challenge - distributions" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:312 +msgid ">\n" +"> Boxplots are useful summaries, but hide the *shape* of the distribution.\n" +"> For example, if there is a bimodal distribution, this would not be observed\n" +"> with a boxplot. An alternative to the boxplot is the violin plot (sometimes\n" +"> known as a beanplot), where the shape (of the density of points) is drawn.\n" +">\n" +"> In many types of data, it is important to consider the *scale* of the\n" +"> observations. For example, it may be worth changing the scale of the axis\n" +"> to better distribute the observations in the space of the plot.\n" +">\n" +"> - Replace the box plot with a violin plot, see `geom_violin()`\n" +"> - Represent weight on the log10 scale, see `scale_y_log10()`\n" +"> - Add color to the datapoints on your boxplot according to the plot from which\n" +"> the sample was taken (`plot_id`)\n" +">\n" +"> Hint: Check the class for `plot_id`. By using `factor()` within the `aes`\n" +"> mapping of a variable, `plotnine` will handle the values as category values.\n" +">\n" +"> > ## Answers\n" +"> >\n" +"> > ~~~\n" +"> > (p9.ggplot(data=surveys_complete,\n" +"> > mapping=p9.aes(x='species_id',\n" +"> > y='weight',\n" +"> > color='factor(plot_id)'))\n" +"> > + p9.geom_jitter(alpha=0.3)\n" +"> > + p9.geom_violin(alpha=0, color=\"0.7\")\n" +"> > + p9.scale_y_log10()\n" +"> > )\n" +"> > ~~~\n" +"> > {: .language-python}\n" +"> > ![png](../fig/06_challenge_boxplot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:348 +# header +msgid "## Plotting time series data" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:350 +msgid "Let's calculate number of counts per year for each species. To do that we need\n" +"to group data first and count the species (`species_id`) within each group." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:353 +# code block +msgid "~~~\n" +"yearly_counts = surveys_complete.groupby(['year', 'species_id'])['species_id'].count()\n" +"yearly_counts\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:359 +msgid "When checking the result of the previous calculation, we actually have both the\n" +"`year` and the `species_id` as a row index. We can reset this index to use both\n" +"as column variable:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:363 +# code block +msgid "~~~\n" +"yearly_counts = yearly_counts.reset_index(name='counts')\n" +"yearly_counts\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:369 +msgid "Timelapse data can be visualised as a line plot (`geom_line`) with years on `x`\n" +"axis and counts on the `y` axis." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:373 +# code block +msgid "~~~\n" +"(p9.ggplot(data=yearly_counts,\n" +" mapping=p9.aes(x='year',\n" +" y='counts'))\n" +" + p9.geom_line()\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:382 +msgid "Unfortunately this does not work, because we plot data for all the species\n" +"together. We need to tell `plotnine` to draw a line for each species by\n" +"modifying the aesthetic function and map the species_id to the color:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:386 +# code block +msgid "~~~\n" +"(p9.ggplot(data=yearly_counts,\n" +" mapping=p9.aes(x='year',\n" +" y='counts',\n" +" color='species_id'))\n" +" + p9.geom_line()\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:396 +msgid "![png](../fig/06_time_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:398 +# header +msgid "## Faceting" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:400 +msgid "As any other library supporting the Grammar of Graphics, `plotnine` has a\n" +"special technique called *faceting* that allows to split one plot into multiple\n" +"plots based on a factor variable included in the dataset." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:404 +msgid "Consider our scatter plot of the `weight` versus the `hindfoot_length` from the\n" +"previous sections:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:417 +msgid "We can now keep the same code and at the `facet_wrap` on a chosen variable to\n" +"split out the graph and make a separate graph for each of the groups in that\n" +"variable. As an example, use `sex`:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:421 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight',\n" +" y='hindfoot_length',\n" +" color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +" + p9.facet_wrap(\"sex\")\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:430 +msgid "{: .language-python}\n" +"![png](../fig/06_facet_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:433 +msgid "We can apply the same concept on any of the available categorical variables:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:435 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight',\n" +" y='hindfoot_length',\n" +" color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +" + p9.facet_wrap(\"plot_id\")\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:446 +msgid "![png](../fig/06_facet_all_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:448 +msgid "The `facet_wrap` geometry extracts plots into an arbitrary number of dimensions\n" +"to allow them to cleanly fit on one page. On the other hand, the `facet_grid`\n" +"geometry allows you to explicitly specify how you want your plots to be\n" +"arranged via formula notation (`rows ~ columns`; a `.` can be used as a\n" +"placeholder that indicates only one row or column)." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:454 +# code block +msgid "~~~\n" +"# only select the years of interest\n" +"survey_2000 = surveys_complete[surveys_complete[\"year\"].isin([2000, 2001])]\n" +"\n" +"(p9.ggplot(data=survey_2000,\n" +" mapping=p9.aes(x='weight',\n" +" y='hindfoot_length',\n" +" color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +" + p9.facet_grid(\"year ~ sex\")\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:466 +msgid "{: .language-python}\n" +"![png](../fig/06_select_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:469 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:489 +# blockquote, which can be cascaded +msgid "> ## Challenge - facetting" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:470 +# blockquote, which can be cascaded +msgid "> Create a separate plot for each of the species that depicts how the average" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:471 +# blockquote, which can be cascaded +msgid "> weight of the species changes through the years." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:472 +msgid ">\n" +"> > ## Answers\n" +"> > yearly_weight = surveys_complete.groupby(['year', 'species_id'])['weight'].mean().reset_index()\n" +"> >\n" +"> > ~~~\n" +"> > (p9.ggplot(data=yearly_weight,\n" +"> > mapping=p9.aes(x='year',\n" +"> > y='weight'))\n" +"> > + p9.geom_line()\n" +"> > + p9.facet_wrap(\"species_id\")\n" +"> > )\n" +"> > ~~~\n" +"> > {: .language-python}" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:490 +# blockquote, which can be cascaded +msgid "> Based on the previous exercise, visually compare how the weights of male and" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:491 +# blockquote, which can be cascaded +msgid "> females has changed through time by creating a separate plot for each sex and" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:492 +# blockquote, which can be cascaded +msgid "> an individual color assigned to each `species_id`." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:493 +msgid ">\n" +"> > ## Answers\n" +"> > yearly_weight = surveys_complete.groupby(['year', 'species_id', 'sex'])['weight'].mean().reset_index()\n" +"> >\n" +"> > (p9.ggplot(data=yearly_weight,\n" +"> > mapping=p9.aes(x='year',\n" +"> > y='weight',\n" +"> > color='species_id'))\n" +"> > + p9.geom_line()\n" +"> > + p9.facet_wrap(\"sex\")\n" +"> > )\n" +"> > {: .language-python}" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:509 +# header +msgid "## Further customization" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:511 +msgid "As the syntax of `plotnine` follows the original R package `ggplot2`, the\n" +"documentation of `ggplot2` can provide information and inspiration to customize\n" +"graphs. Take a look at the `ggplot2` [cheat sheet][ggplot2-cheat-sheet], and think of ways to\n" +"improve the plot. You can write down some of your ideas as comments in the Etherpad." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:516 +msgid "The theming options provide a rich set of visual adaptations. Consider the\n" +"following example of a bar plot with the counts per year." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:519 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='factor(year)'))\n" +" + p9.geom_bar()\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:527 +msgid "![png](../fig/06_overlap_bars.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:529 +msgid "Notice that we use the `year` here as a categorical variable by using the\n" +"`factor` functionality. However, by doing so, we have the individual year\n" +"labels overlapping with each other. The `theme` functionality provides a way to\n" +"rotate the text of the x-axis labels:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:534 +# code block +msgid "~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='factor(year)'))\n" +" + p9.geom_bar()\n" +" + p9.theme_bw()\n" +" + p9.theme(axis_text_x = p9.element_text(angle=90))\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:544 +msgid "![png](../fig/06_good_bars.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:546 +msgid "When you like a specific set of theme-customizations you created, you can save\n" +"them as an object to easily apply them to other plots you may create:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:550 +# code block +msgid "~~~\n" +"my_custom_theme = p9.theme(axis_text_x = p9.element_text(color=\"grey\", size=10,\n" +" angle=90, hjust=.5),\n" +" axis_text_y = p9.element_text(color=\"grey\", size=10))\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='factor(year)'))\n" +" + p9.geom_bar()\n" +" + my_custom_theme\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:562 +msgid "![png](../fig/06_theme_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:564 +# blockquote, which can be cascaded +msgid "> ## Challenge - customization" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:565 +# blockquote, which can be cascaded +msgid "> Please take another five minutes to either improve one of the plots" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:566 +# blockquote, which can be cascaded +msgid "> generated in this exercise or create a beautiful graph of your own." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:567 +msgid ">\n" +"> Here are some ideas:\n" +">\n" +"> * See if you can change thickness of lines for the line plot .\n" +"> * Can you find a way to change the name of the legend? What about its labels?\n" +"> * Use a different color palette (see )" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:576 +msgid "After creating your plot, you can save it to a file in your favourite format.\n" +"You can easily change the dimension (and its resolution) of your plot by\n" +"adjusting the appropriate arguments (`width`, `height` and `dpi`):" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:581 +# code block +msgid "~~~\n" +"my_plot = (p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length'))\n" +" + p9.geom_point()\n" +")\n" +"my_plot.save(\"scatterplot.png\", width=10, height=10, dpi=300)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:590 +msgid "[ggplot2-cheat-sheet]: https://www.rstudio.com/wp-content/uploads/2015/08/ggplot2-cheatsheet.pdf\n" +"[ggplot2]: https://ggplot2.tidyverse.org\n" +"[grammar-of-graphics]: http://link.springer.com/book/10.1007%2F0-387-28695-0\n" +"[plotnine-api]: https://plotnine.readthedocs.io/en/stable/api.html#color-and-fill-scales\n" +"[plotnine]: https://plotnine.readthedocs.io/en/stable" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:1 +# Front Matter +msgid "---\n" +"title: Data Ingest and Visualization - Matplotlib and Pandas\n" +"teaching: 40\n" +"exercises: 65\n" +"questions:\n" +" - \"What other tools can I use to create plots apart from ggplot?\"\n" +" - \"Why should I use Python to create plots?\"\n" +"objectives:\n" +" - \"Import the pyplot toolbox to create figures in Python.\"\n" +" - \"Use matplotlib to make adjustments to Pandas or plotnine objects.\"\n" +"keypoints:\n" +" - \"Matplotlib is the engine behind plotnine and Pandas plots.\"\n" +" - \"Object-based nature of matplotlib plots enables their detailed customization after they have been created.\"\n" +" - \"Export plots to a file using the `savefig` method.\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:18 +# header +msgid "## Putting it all together" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:20 +msgid "Up to this point, we have walked through tasks that are often\n" +"involved in handling and processing data using the workshop ready cleaned\n" +"files that we have provided. In this wrap-up exercise, we will perform\n" +"many of the same tasks with real data sets. This lesson also covers data\n" +"visualization." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:26 +msgid "As opposed to the previous ones, this lesson does not give step-by-step\n" +"directions to each of the tasks. Use the lesson materials you've already gone\n" +"through as well as the Python documentation to help you along." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:30 +# header +msgid "## Obtain data" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:32 +msgid "There are many repositories online from which you can obtain data. We are\n" +"providing you with one data file to use with these exercises, but feel free to\n" +"use any data that is relevant to your research. The file\n" +"[`bouldercreek_09_2013.txt`]({{ page.root }}/data/bouldercreek_09_2013.txt)\n" +"contains stream discharge data, summarized at 15\n" +"15 minute intervals (in cubic feet per second) for a streamgage on Boulder\n" +"Creek at North 75th Street (USGS gage06730200) for 1-30 September 2013. If you'd\n" +"like to use this dataset, please find it in the data folder." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:41 +# header +msgid "## Clean up your data and open it using Python and Pandas" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:43 +msgid "To begin, import your data file into Python using Pandas. Did it fail? Your data\n" +"file probably has a header that Pandas does not recognize as part of the data\n" +"table. Remove this header, but do not simply delete it in a text editor! Use\n" +"either a shell script or Python to do this - you wouldn't want to do it by hand\n" +"if you had many files to process." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:49 +msgid "If you are still having trouble importing the data as a table using Pandas,\n" +"check the documentation. You can open the docstring in an ipython notebook using\n" +"a question mark. For example:" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:53 +# code block +msgid "~~~\n" +"import pandas as pd\n" +"pd.read_csv?\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:59 +msgid "Look through the function arguments to see if there is a default value that is\n" +"different from what your file requires (Hint: the problem is most likely the\n" +"delimiter or separator. Common delimiters are `','` for comma, `' '` for space,\n" +"and `'\\t'` for tab)." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:64 +msgid "Create a DataFrame that includes only the values of the data that are useful to\n" +"you. In the streamgage file, those values might be the date, time, and discharge\n" +"measurements. Convert any measurements in imperial units into SI units. You can\n" +"also change the name of the columns in the DataFrame like this:" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:69 +# code block +msgid "~~~\n" +"df = pd.DataFrame({'1stcolumn':[100,200], '2ndcolumn':[10,20]}) # this just creates a DataFrame for the example!\n" +"print('With the old column names:\\n') # the \\n makes a new line, so it's easier to see\n" +"print(df)\n" +"\n" +"df.columns = ['FirstColumn','SecondColumn'] # rename the columns!\n" +"print('\\n\\nWith the new column names:\\n')\n" +"print(df)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:80 +# code block +msgid "~~~\n" +"With the old column names:\n" +"\n" +" 1stcolumn 2ndcolumn\n" +"0 100 10\n" +"1 200 20\n" +"\n" +"\n" +"With the new column names:\n" +"\n" +" FirstColumn SecondColumn\n" +"0 100 10\n" +"1 200 20\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:96 +# header +msgid "## Matplotlib package" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:98 +msgid "[Matplotlib](https://matplotlib.org/) is a Python package that is widely used throughout the scientific Python community to create high-quality and publication-ready graphics. It supports a wide range of raster and vector graphics formats including PNG, PostScript, EPS, PDF and SVG." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:100 +msgid "Moreover, matplotlib is the actual engine behind the plotting capabilities of both Pandas and plotnine packages. For example, when we call the `.plot` method on Pandas data objects, we actually use the matplotlib package." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:102 +msgid "First, import the pyplot toolbox:" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:104 +# code block +msgid "~~~\n" +"import matplotlib.pyplot as plt\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:109 +msgid "Now, let's read data and plot it!" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:111 +# code block +msgid "~~~\n" +"surveys = pd.read_csv(\"data/surveys.csv\")\n" +"my_plot = surveys.plot(\"hindfoot_length\", \"weight\", kind=\"scatter\")\n" +"plt.show() # not necessary in Jupyter Notebooks\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:118 +msgid "![Scatter plot of survey data set](../fig/08_scatter_surveys.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:120 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:134 +# blockquote, which can be cascaded +msgid "> ## Tip" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:121 +# blockquote, which can be cascaded +msgid "> By default, matplotlib creates a figure in a separate window. When using" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:122 +# blockquote, which can be cascaded +msgid "> Jupyter notebooks, we can make figures appear in-line within the notebook by" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:123 +# blockquote, which can be cascaded +msgid "> executing:" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:124 +msgid ">\n" +"> ~~~\n" +"> %matplotlib inline\n" +"> ~~~\n" +"> {: .language-python}" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:131 +msgid "The returned object is a matplotlib object (check it yourself with `type(my_plot)`),\n" +"to which we may make further adjustments and refinements using other matplotlib methods." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:135 +# blockquote, which can be cascaded +msgid "> Matplotlib itself can be overwhelming, so a useful strategy is to" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:136 +# blockquote, which can be cascaded +msgid "> do as much as you easily can in a convenience layer, _i.e._ start" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:137 +# blockquote, which can be cascaded +msgid "> creating the plot in Pandas or plotnine, and then use matplotlib" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:138 +# blockquote, which can be cascaded +msgid "> for the rest." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:141 +msgid "We will cover a few basic commands for creating and formatting plots with matplotlib in this lesson.\n" +"A great resource for help creating and styling your figures is the matplotlib gallery\n" +"(), which includes plots in many different\n" +"styles and the source codes that create them." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:147 +# header +msgid "### `plt` pyplot versus object-based matplotlib" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:149 +msgid "Matplotlib integrates nicely with the NumPy package and can use NumPy arrays\n" +"as input to the available plot functions. Consider the following example data,\n" +"created with NumPy by drawing 1000 samples from a normal distribution with a mean value of 0 and\n" +"a standard deviation of 0.1:" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:154 +# code block +msgid "~~~\n" +"import numpy as np\n" +"sample_data = np.random.normal(0, 0.1, 1000)\n" +"\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:161 +msgid "To plot a histogram of our draws from the normal distribution, we can use the `hist` function directly:" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:163 +# code block +msgid "~~~\n" +"plt.hist(sample_data)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:168 +msgid "![Histogram of 1000 samples from normal distribution](../fig/08-normal-distribution.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:170 +# blockquote, which can be cascaded +msgid "> ## Tip: Cross-Platform Visualization of Figures" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:171 +# blockquote, which can be cascaded +msgid "> Jupyter Notebooks make many aspects of data analysis and visualization much simpler. This includes" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:172 +# blockquote, which can be cascaded +msgid "> doing some of the labor of visualizing plots for you. But, not every one of your collaborators" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:173 +# blockquote, which can be cascaded +msgid "> will be using a Jupyter Notebook. The `.show()` command allows you to visualize plots" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:174 +# blockquote, which can be cascaded +msgid "> when working at the command line, with a script, or at the IPython interpreter. In the" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:175 +# blockquote, which can be cascaded +msgid "> previous example, adding `plt.show()` after the creation of the plot will enable your" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:176 +# blockquote, which can be cascaded +msgid "> colleagues who aren't using a Jupyter notebook to reproduce your work on their platform." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:179 +msgid "or create matplotlib `figure` and `axis` objects first and subsequently add a histogram with 30\n" +"data bins:" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:182 +# code block +msgid "~~~\n" +"fig, ax = plt.subplots() # initiate an empty figure and axis matplotlib object\n" +"ax.hist(sample_data, 30)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:188 +msgid "Although the latter approach requires a little bit more code to create the same plot,\n" +"the advantage is that it gives us **full control** over the plot and we can add new items\n" +"such as labels, grid lines, title, and other visual elements. For example, we can add\n" +"additional axes to the figure and customize their labels:" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:193 +# code block +msgid "~~~\n" +"fig, ax1 = plt.subplots() # prepare a matplotlib figure\n" +"ax1.hist(sample_data, 30)\n" +"\n" +"# Add a plot of a Beta distribution\n" +"a = 5\n" +"b = 10\n" +"beta_draws = np.random.beta(a, b)\n" +"# adapt the labels\n" +"ax1.set_ylabel('density')\n" +"ax1.set_xlabel('value')\n" +"\n" +"# add additional axes to the figure\n" +"ax2 = fig.add_axes([0.125, 0.575, 0.3, 0.3])\n" +"#ax2 = fig.add_axes([left, bottom, right, top])\n" +"ax2.hist(beta_draws)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:212 +msgid "![Plot with additional axes](../fig/08-dualdistribution.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:214 +# blockquote, which can be cascaded +msgid "> ## Challenge - Drawing from distributions" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:215 +# blockquote, which can be cascaded +msgid "> Have a look at the NumPy" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:216 +# blockquote, which can be cascaded +msgid "> random documentation ." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:217 +# blockquote, which can be cascaded +msgid "> Choose a distribution you have no familiarity with, and try to sample from and visualize it." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:222 +# header +msgid "### Link matplotlib, Pandas and plotnine" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:224 +msgid "When we create a plot using pandas or plotnine, both libraries use matplotlib\n" +"to create those plots. The plots created in pandas or plotnine are matplotlib\n" +"objects, which enables us to use some of the advanced plotting options available\n" +"in the matplotlib library. Because the objects output by pandas and plotnine\n" +"can be read by matplotlib, we have many more options than any one library can\n" +"provide, offering a consistent environment to make publication-quality visualizations." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:231 +# code block +msgid "~~~\n" +"fig, ax1 = plt.subplots() # prepare a matplotlib figure\n" +"\n" +"surveys.plot(\"hindfoot_length\", \"weight\", kind=\"scatter\", ax=ax1)\n" +"\n" +"# Provide further adaptations with matplotlib:\n" +"ax1.set_xlabel(\"Hindfoot length\")\n" +"ax1.tick_params(labelsize=16, pad=8)\n" +"fig.suptitle('Scatter plot of weight versus hindfoot length', fontsize=15)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:243 +msgid "![Extended version of scatter plot surveys](../fig/08_scatter_surveys_extended.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:245 +msgid "To retrieve the matplotlib figure object from plotnine for customization, use the `draw()` function in plotnine:" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:247 +# code block +msgid "~~~\n" +"import plotnine as p9\n" +"myplot = (p9.ggplot(data=surveys,\n" +" mapping=p9.aes(x='hindfoot_length', y='weight')) +\n" +" p9.geom_point())\n" +"\n" +"# convert output plotnine to a matplotlib object\n" +"my_plt_version = myplot.draw()\n" +"\n" +"# Provide further adaptations with matplotlib:\n" +"p9_ax = my_plt_version.axes[0] # each subplot is an item in a list\n" +"p9_ax.set_xlabel(\"Hindfoot length\")\n" +"p9_ax.tick_params(labelsize=16, pad=8)\n" +"p9_ax.set_title('Scatter plot of weight versus hindfoot length', fontsize=15)\n" +"plt.show() # not necessary in Jupyter Notebooks\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:265 +msgid "![Extended version of plotnine scatter plot](../fig/08_scatter_surveys_plotnine.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:267 +# blockquote, which can be cascaded +msgid "> ## Challenge - Pandas and matplotlib" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:268 +# blockquote, which can be cascaded +msgid "> Load the streamgage data set with Pandas, subset the week of the 2013 Front Range flood" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:269 +# blockquote, which can be cascaded +msgid "> (September 11 through 15) and create a hydrograph (line plot) of the discharge data using" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:270 +# blockquote, which can be cascaded +msgid "> Pandas, linking it to an empty maptlotlib `ax` object. Create a second axis that displays the" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:271 +# blockquote, which can be cascaded +msgid "> whole dataset. Adapt the title and axes' labels using matplotlib." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:272 +msgid ">\n" +"> > ## Answers\n" +"> >\n" +"> > ~~~\n" +"> > discharge = pd.read_csv(\"data/bouldercreek_09_2013.txt\",\n" +"> > skiprows=27, delimiter=\"\\t\",\n" +"> > names=[\"agency\", \"site_id\", \"datetime\",\n" +"> > \"timezone\", \"discharge\", \"discharge_cd\"])\n" +"> > discharge[\"datetime\"] = pd.to_datetime(discharge[\"datetime\"])\n" +"> > front_range = discharge[(discharge[\"datetime\"] >= \"2013-09-09\") &\n" +"> > (discharge[\"datetime\"] < \"2013-09-15\")]\n" +"> >\n" +"> > fig, ax = plt.subplots()\n" +"> > front_range.plot(x =\"datetime\", y=\"discharge\", ax=ax)\n" +"> > ax.set_xlabel(\"\") # no label\n" +"> > ax.set_ylabel(\"Discharge, cubic feet per second\")\n" +"> > ax.set_title(\" Front Range flood event 2013\")\n" +"> > discharge = pd.read_csv(\"../data/bouldercreek_09_2013.txt\",\n" +"> > skiprows=27, delimiter=\"\\t\",\n" +"> > names=[\"agency\", \"site_id\", \"datetime\",\n" +"> > \"timezone\", \"flow_rate\", \"height\"])\n" +"> > fig, ax = plt.subplots()\n" +"> > flood = discharge[(discharge[\"datetime\"] >= \"2013-09-11\") &\n" +"> > (discharge[\"datetime\"] < \"2013-09-15\")]\n" +"> >\n" +"> > ax2 = fig.add_axes([0.65, 0.575, 0.25, 0.3])\n" +"> > flood.plot(x =\"datetime\", y=\"flow_rate\", ax=ax)\n" +"> > discharge.plot(x =\"datetime\", y=\"flow_rate\", ax=ax2)\n" +"> > ax2.legend().set_visible(False)\n" +"> > ax.set_xlabel(\"\") # no label\n" +"> > ax.set_ylabel(\"Discharge, cubic feet per second\")\n" +"> > ax.legend().set_visible(False)\n" +"> > ax.set_title(\" Front Range flood event 2013\")\n" +"> > discharge = pd.read_csv(\"../data/bouldercreek_09_2013.txt\",\n" +"> > skiprows=27, delimiter=\"\\t\",\n" +"> > names=[\"agency\", \"site_id\", \"datetime\",\n" +"> > \"timezone\", \"flow_rate\", \"height\"])\n" +"> > fig, ax = plt.subplots()\n" +"> > flood = discharge[(discharge[\"datetime\"] >= \"2013-09-11\") &\n" +"> > (discharge[\"datetime\"] < \"2013-09-15\")]\n" +"> >\n" +"> > ax2 = fig.add_axes([0.65, 0.575, 0.25, 0.3])\n" +"> > flood.plot(x =\"datetime\", y=\"flow_rate\", ax=ax)\n" +"> > discharge.plot(x =\"datetime\", y=\"flow_rate\", ax=ax2)\n" +"> > ax2.legend().set_visible(False)\n" +"> >\n" +"> > ax.set_xlabel(\"\") # no label\n" +"> > ax.set_ylabel(\"Discharge, cubic feet per second\")\n" +"> > ax.legend().set_visible(False)\n" +"> > ax.set_title(\" Front Range flood event 2013\")\n" +"> > ~~~\n" +"> > {: .language-python}\n" +"> >\n" +"> > ![Flood event plot](../fig/08_flood_event.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:329 +# header +msgid "### Saving matplotlib figures" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:331 +msgid "Once satisfied with the resulting plot, you can save the plot with the `.savefig(*args)` method from matplotlib:" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:333 +# code block +msgid "~~~\n" +"fig.savefig(\"my_plot_name.png\")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:338 +msgid "which will save the `fig` created using Pandas/matplotlib as a png file with the name `my_plot_name`" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:340 +# blockquote, which can be cascaded +msgid "> ## Tip: Saving figures in different formats" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:341 +# blockquote, which can be cascaded +msgid "> Matplotlib recognizes the extension used in the filename and" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:342 +# blockquote, which can be cascaded +msgid "> supports (on most computers) png, pdf, ps, eps and svg formats." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:345 +# blockquote, which can be cascaded +msgid "> ## Challenge - Saving figure to file" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:346 +# blockquote, which can be cascaded +msgid "> Check the documentation of the `savefig` method and check how" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:347 +# blockquote, which can be cascaded +msgid "> you can comply to journals requiring figures as `pdf` file with" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:348 +# blockquote, which can be cascaded +msgid "> dpi >= 300." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:349 +msgid ">\n" +"> > ## Answers\n" +"> >\n" +"> > ~~~\n" +"> > fig.savefig(\"my_plot_name.pdf\", dpi=300)\n" +"> > ~~~\n" +"> > {: .language-python}" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:359 +# header +msgid "## Make other types of plots:" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:361 +msgid "Matplotlib can make many other types of plots in much the same way that it makes two-dimensional line plots. Look through the examples in\n" +" and try a few of them (click on the\n" +"\"Source code\" link and copy and paste into a new cell in ipython notebook or\n" +"save as a text file with a `.py` extension and run in the command line)." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:366 +# blockquote, which can be cascaded +msgid "> ## Challenge - Final Plot" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:367 +# blockquote, which can be cascaded +msgid "> Display your data using one or more plot types from the example gallery. Which" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:368 +# blockquote, which can be cascaded +msgid "> ones to choose will depend on the content of your own data file. If you are" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:369 +# blockquote, which can be cascaded +msgid "> using the streamgage file [`bouldercreek_09_2013.txt`]({{ page.root }}/data/bouldercreek_09_2013.txt), you could make a" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:370 +# blockquote, which can be cascaded +msgid "> histogram of the number of days with a given mean discharge, use bar plots" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:371 +# blockquote, which can be cascaded +msgid "> to display daily discharge statistics, or explore the different ways matplotlib" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:372 +# blockquote, which can be cascaded +msgid "> can handle dates and times for figures." +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:1 +# Front Matter +msgid "---\n" +"title: Accessing SQLite Databases Using Python and Pandas\n" +"teaching: 20\n" +"exercises: 25\n" +"questions:\n" +" - \"What if my data are stored in an SQL database? Can I manage them with Python?\"\n" +" - \"How can I write data from Python to be used with SQL?\"\n" +"objectives:\n" +" - \"Use the sqlite3 module to interact with a SQL database.\"\n" +" - \"Access data stored in SQLite using Python.\"\n" +" - \"Describe the difference in interacting with data stored as a CSV file versus in SQLite.\"\n" +" - \"Describe the benefits of accessing data using a database compared to a CSV file.\"\n" +"keypoints:\n" +" - \"sqlite3 provides a SQL-like interface to read, query, and write SQL databases from Python.\"\n" +" - \"sqlite3 can be used with Pandas to read SQL data to the familiar Pandas DataFrame.\"\n" +" - \"Pandas and sqlite3 can also be used to transfer between the CSV and SQL formats.\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:19 +# header +msgid "## Python and SQL" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:21 +msgid "When you open a CSV in python, and assign it to a variable name, you are using\n" +"your computers memory to save that variable. Accessing data from a database like\n" +"SQL is not only more efficient, but also it allows you to subset and import only\n" +"the parts of the data that you need." +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:26 +msgid "In the following lesson, we'll see some approaches that can be taken to do so." +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:28 +# header +msgid "### The `sqlite3` module" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:30 +msgid "The [sqlite3] module provides a straightforward interface for interacting with\n" +"SQLite databases. A connection object is created using `sqlite3.connect()`; the\n" +"connection must be closed at the end of the session with the `.close()` command.\n" +"While the connection is open, any interactions with the database require you to\n" +"make a cursor object with the `.cursor()` command. The cursor is then ready to\n" +"perform all kinds of operations with `.execute()`." +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:37 +msgid "[sqlite3]: https://docs.python.org/3/library/sqlite3.html" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:39 +# code block +msgid "~~~\n" +"import sqlite3\n" +"\n" +"# Create a SQL connection to our SQLite database\n" +"con = sqlite3.connect(\"data/portal_mammals.sqlite\")\n" +"\n" +"cur = con.cursor()\n" +"\n" +"# The result of a \"cursor.execute\" can be iterated over by row\n" +"for row in cur.execute('SELECT * FROM species;'):\n" +" print(row)\n" +"\n" +"# Be sure to close the connection\n" +"con.close()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:56 +# header +msgid "### Queries" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:58 +msgid "One of the most common ways to interact with a database is by querying:\n" +"retrieving data based on some search parameters. Use a SELECT statement string.\n" +"The query is returned as a single tuple or a tuple of tuples. Add a WHERE\n" +"statement to filter your results based on some parameter." +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:63 +# code block +msgid "~~~\n" +"import sqlite3\n" +"\n" +"# Create a SQL connection to our SQLite database\n" +"con = sqlite3.connect(\"data/portal_mammals.sqlite\")\n" +"\n" +"cur = con.cursor()\n" +"\n" +"# Return all results of query\n" +"cur.execute('SELECT plot_id FROM plots WHERE plot_type=\"Control\"')\n" +"cur.fetchall()\n" +"\n" +"# Return first result of query\n" +"cur.execute('SELECT species FROM species WHERE taxa=\"Bird\"')\n" +"cur.fetchone()\n" +"\n" +"# Be sure to close the connection\n" +"con.close()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:84 +# header +msgid "## Accessing data stored in SQLite using Python and Pandas" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:86 +msgid "Using pandas, we can import results of a SQLite query into a dataframe. Note\n" +"that you can use the same SQL commands / syntax that we used in the SQLite\n" +"lesson. An example of using pandas together with sqlite is below:" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:90 +# code block +msgid "~~~\n" +"import pandas as pd\n" +"import sqlite3\n" +"\n" +"# Read sqlite query results into a pandas DataFrame\n" +"con = sqlite3.connect(\"data/portal_mammals.sqlite\")\n" +"df = pd.read_sql_query(\"SELECT * from surveys\", con)\n" +"\n" +"# Verify that result of SQL query is stored in the dataframe\n" +"print(df.head())\n" +"\n" +"con.close()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:105 +# header +msgid "## Storing data: CSV vs SQLite" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:107 +msgid "Storing your data in an SQLite database can provide substantial performance\n" +"improvements when reading/writing compared to CSV. The difference in performance\n" +"becomes more noticeable as the size of the dataset grows (see for example [these\n" +"benchmarks])." +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:112 +msgid "[these benchmarks]: http://sebastianraschka.com/Articles/2013_sqlite_database.html#results-and-conclusions" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:115 +# blockquote, which can be cascaded +msgid "> ## Challenge - SQL" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:116 +msgid ">\n" +"> 1. Create a query that contains survey data collected between 1998 - 2001 for\n" +"> observations of sex \"male\" or \"female\" that includes observation's genus and\n" +"> species and site type for the sample. How many records are returned?\n" +">\n" +"> 2. Create a dataframe that contains the total number of observations (count)\n" +"> made for all years, and sum of observation weights for each site, ordered by\n" +"> site ID." +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:126 +# header +msgid "## Storing data: Create new tables using Pandas" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:128 +msgid "We can also us pandas to create new tables within an SQLite database. Here, we run we re-do an\n" +"exercise we did before with CSV files using our SQLite database. We first read in our survey data,\n" +"then select only those survey results for 2002, and then save it out to its own table so we can work\n" +"with it on its own later." +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:133 +# code block +msgid "~~~\n" +"import pandas as pd\n" +"import sqlite3\n" +"\n" +"con = sqlite3.connect(\"data/portal_mammals.sqlite\")\n" +"\n" +"# Load the data into a DataFrame\n" +"surveys_df = pd.read_sql_query(\"SELECT * from surveys\", con)\n" +"\n" +"# Select only data for 2002\n" +"surveys2002 = surveys_df[surveys_df.year == 2002]\n" +"\n" +"# Write the new DataFrame to a new SQLite table\n" +"surveys2002.to_sql(\"surveys2002\", con, if_exists=\"replace\")\n" +"\n" +"con.close()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:152 +# blockquote, which can be cascaded +msgid "> ## Challenge - Saving your work" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:153 +msgid ">\n" +"> 1. For each of the challenges in the previous challenge block, modify your code to save the\n" +"> results to their own tables in the portal database.\n" +">\n" +"> 2. What are some of the reasons you might want to save the results of your queries back into the\n" +"> database? What are some of the reasons you might avoid doing this." +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:1 +# Front Matter +msgid "---\n" +"layout: page\n" +"title: About Contributors\n" +"permalink: /contributors/\n" +"---" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:6 +msgid "The materials in this python-ecology-lesson repository were initially developed\n" +"and adapted and continue to be revised by many contributors. Some of the lessons\n" +"were adapted from Software Carpentry materials." +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:10 +msgid "The first Python Data Carpentry workshop was run at University of Miami on March\n" +"30 2015 John Gosset and Francois Michonneau. During this time materials were\n" +"refined and they presented again at the UCAR Software Engineering Assembly (SEA)\n" +"conference in Boulder, Colorado by Leah Wasser (NEON,Inc) and Mariela Perignon." +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:15 +# header +msgid "## Data" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:17 +msgid "Data is from the paper S. K. Morgan Ernest, Thomas J. Valone, and James H.\n" +"Brown. 2009. Long-term monitoring and experimental manipulation of a Chihuahuan\n" +"Desert ecosystem near Portal, Arizona, USA. Ecology 90:1708." +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:21 +msgid "" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:23 +msgid "Excel data is from the paper Bahlai, C.A., Schaafsma, A.W., Lagos, D., Voegtlin,\n" +"D., Smith, J.L., Welsman, J.A., Xue, Y., DiFonzo, C., Hallett, R.H., 2014.\n" +"Factors inducing migratory forms of soybean aphid and an examination of North\n" +"American spatial dynamics of this species in the context of migratory behavior.\n" +"Agriculture and Forest Entomology. 16, 240-250." +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:29 +msgid "" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:31 +msgid "Master_suction_trap_data_list_uncleaned.csv is a pre-cleaning version of a\n" +"publicly available dataset by David Voegtlin, Doris Lagos, Douglas Landis and\n" +"Christie Bahlai, available at " +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:35 +# header +msgid "## Lessons" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:37 +msgid "The current list of lessons." +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:39 +msgid "Note: these lessons were reorganized, cleaned up and developed further by Leah\n" +"Wasser, Mariela Perignon, John Gosset and François Michonneau in April 2015." +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:42 +# unordered list +msgid " - Short Introduction to Python" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:43 +# unordered list +msgid " - Starting With Data" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:44 +# unordered list +msgid " - Index Slice Subset" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:45 +# unordered list +msgid " - Data Types and Format" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:46 +# unordered list +msgid " - Merging Data" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:47 +# unordered list +msgid " - Data Analysis Automation: Loops and Functions (Developed by Mariela Perignon with minor edits both Leah Wasser)" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:48 +# unordered list +msgid " - Visualizing Data with ggplot (Developed by Jeremy Zucker November 2016)" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:49 +# unordered list +msgid " - Putting It All Together (Developed by Mariela Perignon with minor revisions by Leah Wasser April 2015)" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:50 +# unordered list +msgid " - Accessing SQL using Python (Added by John Gosset with minor revisions by Leah Wasser April 2015)" +msgstr "" + +#: python-ecology-lesson/_extras/about.md:1 +# Front Matter +msgid "---\n" +"layout: page\n" +"title: About\n" +"permalink: /about/\n" +"---" +msgstr "" + +#: python-ecology-lesson/_extras/about.md:6 +msgid "{% include carpentries.html %}" +msgstr "" + +#: python-ecology-lesson/_extras/discuss.md:1 +# Front Matter +msgid "---\n" +"layout: page\n" +"title: Discussion\n" +"permalink: /discuss/\n" +"---" +msgstr "" + +#: python-ecology-lesson/_extras/discuss.md:7 +msgid "No current discussion" +msgstr "" + +#: python-ecology-lesson/_extras/extra_challenges.md:1 +# Front Matter +msgid "--- \n" +"layout: page \n" +"title: \"Extra Challenges\" \n" +"permalink: /extra_challenges/ \n" +"--- " +msgstr "" + +#: python-ecology-lesson/_extras/extra_challenges.md:7 +# header +msgid "# Extra Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/extra_challenges.md:9 +msgid "A collection of challenges that have been either removed from or not (yet) added to the main lesson. " +msgstr "" + +#: python-ecology-lesson/_extras/extra_challenges.md:11 +# blockquote, which can be cascaded +msgid "> ## Looping Over DataFrame" +msgstr "" + +#: python-ecology-lesson/_extras/extra_challenges.md:12 +msgid ">\n" +"> (Please refer to lesson `06-loops-and-functions.md`)\n" +">\n" +"> The file `surveys.csv` in the `data` folder contains 25 years of data from surveys,\n" +"> starting from 1977. We can extract data corresponding to each year in this DataFrame\n" +"> to individual CSV files, by using a `for` loop:\n" +"> \n" +"> ~~~\n" +"> import pandas as pd\n" +"> \n" +"> # Load the data into a DataFrame\n" +"> surveys_df = pd.read_csv('data/surveys.csv')\n" +"> \n" +"> # Loop through a sequence of years and export selected data\n" +"> start_year = 1977\n" +"> end_year = 2002\n" +"> for year in range(start_year, end_year+1):\n" +">\n" +"> # Select data for the year\n" +"> surveys_year = surveys_df[surveys_df.year == year] \n" +">\n" +"> # Write the new DataFrame to a CSV file\n" +"> filename = 'data/surveys' + str(year) + '.csv' \n" +"> surveys_year.to_csv(filename)\n" +"> ~~~\n" +"> {: .language-python}\n" +">\n" +"> What happens if there is no data for a year in a sequence? For example,\n" +"> imagine we used `1976` as the `start_year`\n" +">\n" +"> > ## Solution\n" +"> > We get the expected files for all years between 1977 and 2002,\n" +"> > plus an empty `data/surveys1976.csv` file with only the headers. \n" +"> {: .solution} " +msgstr "" + +#: python-ecology-lesson/_extras/figures.md:1 +# Front Matter +msgid "---\n" +"title: Figures\n" +"---" +msgstr "" + +#: python-ecology-lesson/_extras/figures.md:5 +#: python-ecology-lesson/aio.md:6 +msgid "{% include base_path.html %}" +msgstr "" + +#: python-ecology-lesson/_extras/figures.md:7 +# inline html +msgid "" +msgstr "" + +#: python-ecology-lesson/_extras/figures.md:61 +msgid "{% comment %}\n" +"Create anchor for each one of the episodes.\n" +"{% endcomment %}\n" +"{% for episode in site.episodes %}\n" +"
\n" +"{% endfor %}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:1 +# Front Matter +msgid "---\n" +"layout: page\n" +"title: \"Instructor Notes\"\n" +"permalink: /guide/\n" +"---" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:7 +# header +msgid "# Challenge solutions" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:9 +# header +msgid "## Install the required workshop packages" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:11 +msgid "Please use the instructions in the [Setup][lesson-setup] document to perform installs. If you\n" +"encounter setup issues, please file an issue with the tags 'High-priority'." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:14 +# header +msgid "## Checking installations." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:16 +msgid "In the `_include/scripts` directory, you will find a script called check_env.py This checks the\n" +"functionality of the Anaconda install." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:19 +msgid "By default, Data Carpentry does not have people pull the whole repository with all the scripts and\n" +"addenda. Therefore, you, as the instructor, get to decide how you'd like to provide this script to\n" +"learners, if at all. To use this, students can navigate into `_includes/scripts` terminal, and\n" +"execute the following:" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:24 +# code block +msgid "~~~\n" +"python check_env.py\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:29 +msgid "If learners receive an `AssertionError`, it will inform you how to help them correct this\n" +"installation. Otherwise, it will tell you that the system is good to go and ready for Data\n" +"Carpentry!" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:33 +# header +msgid "## 01-short-introduction-to-Python" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:35 +# header +msgid "### Tuples Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:37 +# unordered list +msgid "* What happens when you execute `a_list[1] = 5`?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:38 +# unordered list +msgid "* What happens when you execute `a_tuple[2] = 5`?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:40 +msgid " As a tuple is immutable, it does not support item assignment. Elements in a list can be altered\n" +" individually." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:43 +# unordered list +msgid "* What does `type(a_tuple)` tell you about `a_tuple`?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:45 +msgid " `tuple`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:47 +# header +msgid "### Dictionaries Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:49 +# unordered list +msgid "* Changing dictionaries: 2. Reassign the value that corresponds to the key `2`." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:51 +msgid "Make sure it is also clear that access to 'the value that corresponds to the key `2`' is actually\n" +"just about the key name. Add for example `rev[10] = \"ten\"` to clarify it is not about the position." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:54 +# code block +msgid "~~~\n" +"rev\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:63 +# code block +msgid "~~~\n" +"rev[2] = \"apple-sauce\"\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:68 +# code block +msgid "~~~\n" +"{1: 'one', 2: 'apple-sauce', 3: 'three'}\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:73 +# header +msgid "## 02-starting-with-data" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:75 +# blockquote, which can be cascaded +msgid "> ## Important Bug Note" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:76 +msgid ">\n" +"> In Pandas prior to 0.18.1 there is a bug causing `surveys_df['weight'].describe()` to return\n" +"> a runtime error." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:81 +# header +msgid "### Dataframe Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:83 +# unordered list +msgid "* `surveys_df.columns`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:85 +msgid " column names (optional: show `surveys_df.columns[4] = \"plotid\"` The index is not mutable; recap of\n" +" previous lesson. Adapting the name is done by `rename` function\n" +" `surveys_df.rename(columns={\"plot_id\": \"plotid\"})`)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:89 +# unordered list +msgid "* `surveys_df.head()`. Also, what does `surveys_df.head(15)` do?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:91 +msgid " Show first 5 lines. Show first 15 lines." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:93 +# unordered list +msgid "* `surveys_df.tail()`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:95 +msgid " Show last 5 lines" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:97 +# unordered list +msgid "* `surveys_df.shape`. Take note of the output of the shape method. What format does it return the" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:98 +msgid " shape of the DataFrame in?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:100 +msgid " `type(surveys_df.shape)` -> `Tuple`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:102 +# header +msgid "### Calculating Statistics Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:104 +# unordered list +msgid "* Create a list of unique plot ID's found in the surveys data. Call it `plot_names`. How many unique" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:105 +msgid " plots are in the data? How many unique species are in the data?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:107 +msgid " `plot_names = pd.unique(surveys_df[\"plot_id\"])` Number of unique plot ID's: `plot_names.size` or\n" +" `len(plot_names)`; Number of unique species in the data: `len(pd.unique(surveys_df[\"species\"]))`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:110 +# unordered list +msgid "* What is the difference between `len(plot_names)` and `surveys_df['plot_id'].nunique()`?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:112 +msgid " Both do result in the same output, making it alternative ways of getting the unique values.\n" +" `nunique` combines the count and unique value extraction." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:115 +# header +msgid "### Grouping Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:117 +# unordered list +msgid "* How many recorded individuals are female `F` and how many male `M`?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:119 +msgid " `grouped_data.count()`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:121 +# unordered list +msgid "* What happens when you group by two columns using the following syntax and then grab mean values?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:123 +msgid " The mean value for each combination of plot and sex is calculated. Remark that the mean does not\n" +" make sense for each variable, so you can specify this column-wise: e.g. I want to know the last\n" +" survey year, median foot-length and mean weight for each plot/sex combination:" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:127 +# code block +msgid "~~~\n" +"surveys_df.groupby(['plot_id','sex']).agg({\"year\": 'min',\n" +" \"hindfoot_length\": 'median',\n" +" \"weight\": 'mean'})\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:134 +# unordered list +msgid "* Summarize the weight values for each plot in your data." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:136 +# code block +msgid "~~~\n" +"surveys_df.groupby(['plot_id'])['weight'].describe()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:141 +# unordered list +msgid "* Another Challenge: What is another way to create a list of species and the associated count of the" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:142 +msgid " records in the data?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:144 +msgid " Instead of getting the column of the groupby and counting it, you can also count on the groupby\n" +" (all columns) and make a selection of the resulting data frame:\n" +" `surveys_df.groupby('species_id').count()[\"record_id\"]`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:148 +# header +msgid "### Plotting Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:150 +# unordered list +msgid "* Create a plot of the average weight across all species per plot." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:152 +# code block +msgid "~~~\n" +"surveys_df.groupby('plot_id').mean()[\"weight\"].plot(kind='bar')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:157 +msgid "![average weight across all species for each plot](../fig/01_chall_bar_meanweight.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:159 +# unordered list +msgid "* Create a plot of total males versus total females for the entire datase." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:161 +# code block +msgid "~~~\n" +"surveys_df.groupby('sex').count()[\"record_id\"].plot(kind='bar')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:164 +msgid "{: .language-python}\n" +"![total males versus total females for the entire dataset](../fig/01_chall_bar_totalsex.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:167 +# header +msgid "## 03-index-slice-subset" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:169 +msgid "Tip: use `.head()` method throughout this lesson to keep your display neater for students.\n" +"Encourage students to try with and without `.head()` to reinforce this useful tool and then to use\n" +"it or not at their preference. For example, if a student worries about keeping up in pace with\n" +"typing, let them know they can skip the `.head()`, but that you'll use it to keep more lines of\n" +"previous steps visible." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:175 +# header +msgid "### Indexing Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:177 +# unordered list +msgid "* What value does the code below return? `a[0]`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:179 +msgid " `1`, as Python starts with element 0 (for Matlab users: this is different!)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:181 +# unordered list +msgid "* How about this: `a[5]`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:183 +#: python-ecology-lesson/_extras/guide.md:191 +msgid " `IndexError`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:185 +# unordered list +msgid "* In the example above, calling `a[5]` returns an error. Why is that?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:187 +msgid " The list has no element with index 5 (going from 0 till 4)." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:189 +# unordered list +msgid "* What about? `a[len(a)]`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:193 +# header +msgid "### Selection Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:195 +# unordered list +msgid "* What happens when you execute:" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:197 +msgid " `surveys_df[0:3]`\n" +" `surveys_df[0:1]` slicing only the first element\n" +" `surveys_df[:5]` slicing from first element makes 0 redundant\n" +" `surveys_df[-1:]` you can count backwards" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:202 +msgid " *Suggestion*: You can also select every Nth row: `surveys_df[1:10:2]`. So, how to interpret\n" +" `surveys_df[::-1]`?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:205 +# unordered list +msgid "* What is the difference between `surveys_df.iloc[0:4, 1:4]` and `surveys_df.loc[0:4, 1:4]`?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:207 +msgid " Check the position, or the name. Cfr. the second is like it would be in a dictionary, asking for\n" +" the key-names. Column names 1:4 do not exist, resulting in an error. Check also the difference\n" +" between `surveys_df.loc[0:4]` and `surveys_df.iloc[0:4]`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:211 +# header +msgid "### Advanced Selection Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:213 +# unordered list +msgid "* Select a subset of rows in the `surveys_df` DataFrame that contain data from the year 1999 and" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:214 +msgid " that contain weight values less than or equal to 8. How many columns did you end up with? What did\n" +" your neighbor get?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:217 +msgid " `surveys_df[(surveys_df[\"year\"] == 1999) & (surveys_df[\"weight\"] <= 8)]`; when only interested in\n" +" how many, the sum of `True` values could be used as well:\n" +" `sum((surveys_df[\"year\"] == 1999) & (surveys_df[\"weight\"] <= 8))`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:221 +# unordered list +msgid "* You can use the `isin` command in Python to query a DataFrame based upon a list of values as" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:222 +msgid " follows: `surveys_df[surveys_df['species_id'].isin([listGoesHere])]`. Use the `isin` function to\n" +" find all plots that contain particular species in the surveys DataFrame. How many records contain\n" +" these values?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:226 +msgid " For example, using `PB` and `PL`:\n" +" `surveys_df[surveys_df['species_id'].isin(['PB', 'PL'])]['plot_id'].unique()` provides a list of\n" +" the plots with these species involved. With\n" +" `surveys_df[surveys_df['species_id'].isin(['PB', 'PL'])].shape` the number of records can be\n" +" derived." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:232 +# unordered list +msgid "* Create a query that finds all rows with a weight value > or equal to 0." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:234 +msgid " `surveys_df[surveys_df[\"weight\"] >= 0]`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:236 +msgid " *Suggestion*: Introduce already that all these slice operations are actually based on a\n" +" *Boolean indexing* operation (next section in the lesson). The filter provides for each record if\n" +" it satisfies (True) or not (False). The slicing itself interprets the True/False of each record." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:240 +# unordered list +msgid "* The `~` symbol in Python can be used to return the OPPOSITE of the selection that you specify in" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:241 +msgid " Python. It is equivalent to \"is not in\". Write a query that selects all rows that are NOT equal to\n" +" 'M' or 'F' in the surveys data." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:244 +# code block +msgid "~~~\n" +"surveys_df[~surveys_df[\"sex\"].isin(['M', 'F'])]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:249 +# header +msgid "### Masking Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:251 +# unordered list +msgid "* Create a new DataFrame that only contains observations with sex values that are not female or" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:252 +msgid " male. Assign each sex value in the new DataFrame to a new value of 'x'. Determine the number of\n" +" null values in the subset." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:255 +msgid " ~~~\n" +" new = surveys_df[~surveys_df['sex'].isin(['M', 'F'])].copy()\n" +" new['sex']='x'\n" +" print(len(new))\n" +" ~~~\n" +" {: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:262 +msgid " Can verify the number of Nan values with `sum(surveys_df['sex'].isnull())`, which is equal to the\n" +" number of none female/male records." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:265 +# unordered list +msgid "* Create a new DataFrame that contains only observations that are of sex male or female and where" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:266 +msgid " weight values are greater than 0. Create a stacked bar plot of average weight by plot with male vs\n" +" female values stacked for each plot." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:269 +msgid " ~~~\n" +" # selection of the data with isin\n" +" stack_selection = surveys_df[(surveys_df['sex'].isin(['M', 'F'])) &\n" +" surveys_df[\"weight\"] > 0.][[\"sex\", \"weight\", \"plot_id\"]]\n" +" # calculate the mean weight for each plot id and sex combination:\n" +" stack_selection = stack_selection.groupby([\"plot_id\", \"sex\"]).mean().unstack()\n" +" # and we can make a stacked bar plot from this:\n" +" stack_selection.plot(kind='bar', stacked=True)\n" +" ~~~\n" +" {: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:280 +msgid " *Suggestion*: As we know the other values are all Nan values, we could also select all not null\n" +" values (just preview, more on this in next lesson):\n" +" ~~~\n" +" stack_selection = surveys_df[(surveys_df['sex'].notnull()) &\n" +" surveys_df[\"weight\"] > 0.][[\"sex\", \"weight\", \"plot_id\"]]\n" +" ~~~\n" +" {: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:288 +msgid " ![average weight for each plot per sex](../fig/02_chall_stack_levelissue.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:290 +msgid " However, due to the `unstack` command, the legend header contains two levels. In order to remove\n" +" this, the column naming needs to be simplified:\n" +" ~~~\n" +" stack_selection.columns = stack_selection.columns.droplevel()\n" +" ~~~\n" +" {: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:297 +msgid " ![average weight for each plot per sex](../fig/02_chall_stack_level.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:299 +# header +msgid "## 04-data-types-and-format" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:301 +# header +msgid "### Challenge - Changing Types" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:303 +# unordered list +msgid "* Try converting the column `plot_id` to floats using `surveys_df.plot_id.astype(\"float\")`." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:304 +msgid "Then, try converting the contents of the `weight` column to an integer type.\n" +"What error messages does Pandas give you? What do these errors mean?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:307 +msgid "Pandas cannot convert types from float to int if the column contains NaN values." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:309 +# header +msgid "### Challenge - Counting" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:311 +# unordered list +msgid "* Count the number of missing values per column. Hint: The method `.count()` gives you the number of" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:312 +msgid " non-NA observations per column. Try looking to the `.isnull()` method." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:314 +# code block +msgid "~~~\n" +"surveys_df.isnull()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:319 +msgid "If the students have trouble generating the output, or anything happens with that, the folder\n" +"`sample_output` in this repository contains the file `surveys_complete.csv` with the data they\n" +"should generate." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:323 +# header +msgid "## 05-merging-data" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:325 +# unordered list +msgid "* In the data folder, there are two survey data files: survey2001.csv and survey2002.csv. Read the" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:326 +msgid " data into Python and combine the files to make one new data frame. Create a plot of average plot\n" +" weight by year grouped by sex. Export your results as a CSV and make sure it reads back into\n" +" Python properly." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:330 +# code block +msgid "~~~\n" +"# read the files:\n" +"survey2001 = pd.read_csv(\"data/survey2001.csv\")\n" +"survey2002 = pd.read_csv(\"data/survey2002.csv\")\n" +"# concatenate\n" +"survey_all = pd.concat([survey2001, survey2002], axis=0)\n" +"# get the weight for each year, grouped by sex:\n" +"weight_year = survey_all.groupby(['year', 'sex']).mean()[\"wgt\"].unstack()\n" +"# plot:\n" +"weight_year.plot(kind=\"bar\")\n" +"plt.tight_layout() # tip(!)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:342 +msgid "{: .language-python}\n" +"![average weight for each year, grouped by sex](../fig/04_chall_weight_year.png)\n" +"~~~\n" +"# writing to file:\n" +"weight_year.to_csv(\"weight_for_year.csv\")\n" +"# reading it back in:\n" +"pd.read_csv(\"weight_for_year.csv\", index_col=0)\n" +"~~~\n" +"{: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:352 +# unordered list +msgid "* Create a new DataFrame by joining the contents of the surveys.csv and species.csv tables." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:354 +# code block +msgid "~~~\n" +"merged_left = pd.merge(left=surveys_df,right=species_df, how='left', on=\"species_id\")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:359 +msgid "Then calculate and plot the distribution of:" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:361 +msgid "**1. taxa per plot** (number of species of each taxa per plot):" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:363 +msgid "Species distribution (number of taxa for each plot) can be derived as follows:\n" +"~~~\n" +"merged_left.groupby([\"plot_id\"])[\"taxa\"].nunique().plot(kind='bar')\n" +"~~~\n" +"{: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:369 +msgid "![taxa per plot](../fig/04_chall_ntaxa_per_site.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:371 +msgid "*Suggestion*: It is also possible to plot the number of individuals for each taxa in each plot\n" +"(stacked bar chart):\n" +"~~~\n" +"merged_left.groupby([\"plot_id\", \"taxa\"]).count()[\"record_id\"].unstack().plot(kind='bar', stacked=True)\n" +"plt.legend(loc='upper center', ncol=3, bbox_to_anchor=(0.5, 1.05))\n" +"~~~\n" +"{: .language-python}\n" +"(the legend otherwise overlaps the bar plot)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:380 +msgid "![taxa per plot](../fig/04_chall_taxa_per_site.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:382 +msgid "**2. taxa by sex by plot**:\n" +"Providing the Nan values with the M|F values (can also already be changed to 'x'):\n" +"~~~\n" +"merged_left.loc[merged_left[\"sex\"].isnull(), \"sex\"] = 'M|F'\n" +"~~~\n" +"{: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:389 +msgid "Number of taxa for each plot/sex combination:\n" +"~~~\n" +"ntaxa_sex_site= merged_left.groupby([\"plot_id\", \"sex\"])[\"taxa\"].nunique().reset_index(level=1)\n" +"ntaxa_sex_site = ntaxa_sex_site.pivot_table(values=\"taxa\", columns=\"sex\", index=ntaxa_sex_site.index)\n" +"ntaxa_sex_site.plot(kind=\"bar\", legend=False)\n" +"plt.legend(loc='upper center', ncol=3, bbox_to_anchor=(0.5, 1.08),\n" +" fontsize='small', frameon=False)\n" +"~~~\n" +"{: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:399 +msgid "![taxa per plot per sex](../fig/04_chall_ntaxa_per_site_sex.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:401 +msgid "*Suggestion (for discussion only)*:" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:403 +msgid "The number of individuals for each taxa in each plot per sex can be derived as well." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:405 +# code block +msgid "~~~\n" +"sex_taxa_site = merged_left.groupby([\"plot_id\", \"taxa\", \"sex\"]).count()['record_id']\n" +"sex_taxa_site.unstack(level=[1, 2]).plot(kind='bar', logy=True)\n" +"plt.legend(loc='upper center', ncol=3, bbox_to_anchor=(0.5, 1.15),\n" +" fontsize='small', frameon=False)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:413 +msgid "![taxa per plot per sex](../fig/04_chall_sex_taxa_site_intro.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:415 +msgid "This is not really the best plot choice: not readable,... A first option to make this better, is to\n" +"make facets. However, pandas/matplotlib do not provide this by default. Just as a pure matplotlib\n" +"example (`M|F` if for not-defined sex records):" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:419 +# code block +msgid "~~~\n" +"fig, axs = plt.subplots(3, 1)\n" +"for sex, ax in zip([\"M\", \"F\", \"M|F\"], axs):\n" +" sex_taxa_site[sex_taxa_site[\"sex\"] == sex].plot(kind='bar', ax=ax, legend=False)\n" +" ax.set_ylabel(sex)\n" +" if not ax.is_last_row():\n" +" ax.set_xticks([])\n" +" ax.set_xlabel(\"\")\n" +"axs[0].legend(loc='upper center', ncol=5, bbox_to_anchor=(0.5, 1.3),\n" +" fontsize='small', frameon=False)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:432 +msgid "![taxa per plot per sex](../fig/04_chall_sex_taxa_site.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:434 +msgid "However, it would be better to link to [Seaborn][seaborn] and [Altair][altair] for its kind of\n" +"multivariate visualisations." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:437 +# unordered list +msgid "* In the data folder, there is a plot CSV that contains information about the type associated with" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:438 +msgid "each plot. Use that data to summarize the number of plots by plot type." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:440 +# code block +msgid "~~~\n" +"plot_info = pd.read_csv(\"data/plots.csv\")\n" +"plot_info.groupby(\"plot_type\").count()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:446 +# unordered list +msgid "* Calculate a diversity index of your choice for control vs rodent exclosure plots. The index should" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:447 +msgid "consider both species abundance and number of species. You might choose the simple biodiversity\n" +"index described here which calculates diversity as `the number of species in the plot / the total\n" +"number of individuals in the plot = Biodiversity index.`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:451 +# code block +msgid "~~~\n" +"merged_site_type = pd.merge(merged_left, plot_info, on='plot_id')\n" +"# For each plot, get the number of species for each plot\n" +"nspecies_site = merged_site_type.groupby([\"plot_id\"])[\"species\"].nunique().rename(\"nspecies\")\n" +"# For each plot, get the number of individuals\n" +"nindividuals_site = merged_site_type.groupby([\"plot_id\"]).count()['record_id'].rename(\"nindiv\")\n" +"# combine the two series\n" +"diversity_index = pd.concat([nspecies_site, nindividuals_site], axis=1)\n" +"# calculate the diversity index\n" +"diversity_index['diversity'] = diversity_index['nspecies']/diversity_index['nindiv']\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:464 +msgid "Making a bar chart:" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:466 +# code block +msgid "~~~\n" +"diversity_index['diversity'].plot(kind=\"barh\")\n" +"plt.xlabel(\"Diversity index\")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:472 +msgid "![taxa per plot per sex](../fig/04_chall_diversity_index.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:475 +# header +msgid "## 06-loops-and-functions" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:477 +# header +msgid "### Basic Loop Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:479 +# unordered list +msgid "* What happens if we do not include the `pass` statement?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:481 +msgid " `SyntaxError:`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:483 +# unordered list +msgid "* Rewrite the loop so that the animals are separated by commas, not new lines (Hint: You can" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:484 +msgid "concatenate strings using a plus sign. For example, `print(string1 + string2)` outputs\n" +"'string1string2')." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:487 +# code block +msgid "~~~\n" +"for creature in animals:\n" +" print(creature+',', end='')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:493 +msgid "This loop also adds a comma after the last animal. A better, loop-free solution would be:\n" +"`','.join(animals)`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:496 +# header +msgid "### Looping Over Dataframe Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:498 +# unordered list +msgid "* Some of the surveys you saved are missing data (they have null values that show up as NaN - Not A" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:499 +msgid "Number - in the DataFrames and do not show up in the text files). Modify the for loop so that the\n" +"entries with null values are not included in the yearly files." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:502 +# code block +msgid "~~~\n" +"surveys_year = surveys_df[surveys_df.year == year].dropna()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:507 +# unordered list +msgid "* Let's say you only want to look at data from a given multiple of years. How would you modify your" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:508 +msgid "loop in order to generate a data file for only every 5th year, starting from 1977?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:510 +msgid "You could just make a list manually, however, why not check the first and last year making use of\n" +"the code itself?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:513 +# code block +msgid "~~~\n" +"n_year = 5 # better overview by making variable from it\n" +"first_year = surveys_df['year'].min()\n" +"last_year = surveys_df['year'].max()\n" +"\n" +"for year in range(first_year, last_year, n_year):\n" +" print(year)\n" +"\n" +" # Select data for the year\n" +" surveys_year = surveys_df[surveys_df.year == year].dropna()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:526 +# unordered list +msgid "* Instead of splitting out the data by years, a colleague wants to do analyses each species" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:527 +msgid "separately. How would you write a unique csv file for each species?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:529 +msgid "Similar to previous example, but use the `species_id` column. `surveys_df['species_id'].unique()`.\n" +"However, the species names would improve interpretation of the file naming. A join with the species:\n" +"`merged_left = pd.merge(left=surveys,right=species, how='left', on=\"species_id\")` and using the\n" +"`species` column." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:534 +# header +msgid "### Functions Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:536 +# unordered list +msgid "* Change the values of the arguments in the function and check its output." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:537 +# unordered list +msgid "* Try calling the function by giving it the wrong number of arguments (not 2), or not assigning the" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:538 +msgid "function call to a variable (no `product_of_inputs =`).\n" +"* Declare a variable inside the function and test to see where it exists (Hint: can you print it\n" +"from outside the function?).\n" +"* Explore what happens when a variable both inside and outside the function have the same name. What\n" +"happens to the global variable when you change the value of the local variable?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:544 +msgid "Show these in a debugging environment to make this more clear!" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:546 +# header +msgid "### Additional Functions Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:548 +# unordered list +msgid "* Add two arguments to the functions we wrote that take the path of the directory where the files" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:549 +msgid "will be written and the root of the file name. Create a new set of files with a different name in\n" +"a different directory." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:552 +# code block +msgid "~~~\n" +"def one_year_csv_writer(this_year, all_data, folder_to_save, root_name):\n" +" \"\"\"\n" +" Writes a csv file for data from a given year.\n" +"\n" +" Parameters\n" +" ---------\n" +" this_year : int\n" +" year for which data is extracted\n" +" all_data: pd.DataFrame\n" +" DataFrame with multi-year data\n" +" folder_to_save : str\n" +" folder to save the data files\n" +" root_name: str\n" +" root of the filenames to save the data\n" +" \"\"\"\n" +"\n" +" # Select data for the year\n" +" surveys_year = all_data[all_data.year == this_year]\n" +"\n" +" # Write the new DataFrame to a csv file\n" +" filename = os.path.join(folder_to_save, ''.join([root_name, str(this_year), '.csv']))\n" +" surveys_year.to_csv(filename)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:576 +msgid "{: .language-python}\n" +"Also adapt function `yearly_data_csv_writer` with the additional inputs." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:579 +# unordered list +msgid "* How could you use the function `yearly_data_csv_writer` to create a csv file for only one year?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:580 +msgid "(Hint: think about the syntax for `range`)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:582 +msgid "Adapt the input arguments, e.g. 1978, 1979." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:584 +# header +msgid "### Output Management Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:586 +# unordered list +msgid "* Make the functions return a list of the files they have written. There are many ways you can do" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:587 +msgid "this (and you should try them all!):\n" +" * either of the functions can print to screen,\n" +" just add `print(\"year \" + str(this_year)+ \" written to disk\")` statement\n" +" * either can use a return statement to give back numbers or strings to their function call,\n" +" * or you can use some combination of the two.\n" +" * You could also try using the os library to list the contents of directories.\n" +" `os.listdir`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:595 +msgid "Implementation inside the function:\n" +"~~~\n" +"filenames = []\n" +"for year in range(start_year, end_year+1):\n" +" filenames.append(one_year_csv_writer(year, all_data, folder_to_save, root_name))\n" +"return filenames\n" +"~~~\n" +"{: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:604 +# unordered list +msgid "* Explore what happens when variables are declared inside each of the functions versus in the main" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:605 +msgid "(non-indented) body of your code. What is the scope of the variables (where are they visible)?\n" +"What happens when they have the same name but are given different values?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:608 +# unordered list +msgid "* What type of object corresponds to a variable declared as `None`? (Hint: create a variable set to" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:609 +msgid "`None` and use the function `type()`)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:611 +# code block +msgid "~~~\n" +"NoneType\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:616 +# unordered list +msgid "* Compare the behavior of the function `yearly_data_arg_test` when the arguments have `None` as a" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:617 +msgid "default and when they do not have default values." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:619 +# unordered list +msgid "* What happens if you only include a value for `start_year` in the function call? Can you write the" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:620 +msgid "function call with only a value for `end_year`? (Hint: think about how the function must be\n" +"assigning values to each of the arguments - this is related to the need to put the arguments\n" +"without default values before those with default values in the function definition!)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:624 +# code block +msgid "~~~\n" +"yearly_data_arg_test(surveys_df, end_year=2001)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:629 +# header +msgid "### Functions Modifications Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:631 +# unordered list +msgid "* Rewrite the `one_year_csv_writer` and `yearly_data_csv_writer` functions to have keyword arguments" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:632 +msgid "with default values." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:634 +# code block +msgid "~~~\n" +"def one_year_csv_writer(this_year, all_data, folder_to_save='./', root_name='survey'):\n" +" \"\"\"\n" +" Writes a csv file for data from a given year.\n" +"\n" +" Parameters\n" +" ---------\n" +" this_year : int\n" +" year for which data is extracted\n" +" all_data: pd.DataFrame\n" +" DataFrame with multi-year data\n" +" folder_to_save : str\n" +" folder to save the data files\n" +" root_name: str\n" +" root of the filenames to save the data\n" +" \"\"\"\n" +"\n" +" # Select data for the year\n" +" surveys_year = all_data[all_data.year == this_year]\n" +"\n" +" # Write the new DataFrame to a csv file\n" +" filename = os.path.join(folder_to_save, ''.join([root_name, str(this_year), '.csv']))\n" +" surveys_year.to_csv(filename)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:660 +# unordered list +msgid "* Modify the functions so that they do not create yearly files if there is no data for a given year" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:661 +msgid "and display an alert to the user (Hint: use `for` loops and conditional statements to do this. For\n" +"an extra challenge, use `try` statements!)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:664 +# code block +msgid "~~~\n" +" # Write the new DataFrame to a csv file\n" +" if len(surveys_year) > 0:\n" +" filename = os.path.join(folder_to_save, ''.join([root_name, str(this_year), '.csv']))\n" +" surveys_year.to_csv(filename)\n" +" else:\n" +" print(\"No data for year \" + str(this_year))\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:674 +# unordered list +msgid "* The code that you have written so far to loop through the years is good, however, it is not" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:675 +msgid "necessarily reproducible with different datasets. For instance, what happens to the code if we\n" +"have additional years of data in our CSV files? Using the tools that you learned in the previous\n" +"activities, make a list of all years represented in the data. Then create a loop to process your\n" +"data, that begins at the earliest year and ends at the latest year using that list." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:680 +# code block +msgid "~~~\n" +"def yearly_data_csv_writer(all_data, yearcolumn=\"year\",\n" +" folder_to_save='./', root_name='survey'):\n" +" \"\"\"\n" +" Writes separate csv files for each year of data.\n" +"\n" +" all_data --- DataFrame with multi-year data\n" +" yearcolumn --- column name containing the year of the data\n" +" folder_to_save --- folder name to store files\n" +" root_name --- start of the file names stored\n" +" \"\"\"\n" +" years = all_data[\"year\"].unique()\n" +"\n" +" # \"end_year\" is the last year of data we want to pull, so we loop to end_year+1\n" +" filenames = []\n" +" for year in years:\n" +" filenames.append(one_year_csv_writer(year, all_data, folder_to_save, root_name))\n" +" return filenames\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:701 +# header +msgid "## 07-visualization-ggplot-python" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:703 +msgid "If the students have trouble generating the output, or anything happens with that, there is a file\n" +"called \"sample output\" that contains the data file they should have generated in lesson 3." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:706 +msgid "iPython notebooks for plotting can be viewed in the `_extras` folder" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:708 +# header +msgid "## 08-putting-it-all-together" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:710 +msgid "Scientists often operate on mathematical equations. Being able to use them in their graphics has a\n" +"lot of added value. Luckily, Matplotlib provides powerful tools for text control. One of them is the\n" +"ability to use LaTeX mathematical notation, whenever text is used (you can learn more about LaTeX\n" +"math notation here: ). To use mathematical\n" +"notation, surround your text using the dollar sign (\"$\"). LaTeX uses the backslash character (\"\\\\\")\n" +"a lot. Since backslash has a special meaning in the Python strings, you should replace all the\n" +"LaTeX-related backslashes with two backslashes." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:718 +# code block +msgid "~~~\n" +"plt.plot(t, t, 'r--', label='$y=x$')\n" +"plt.plot(t, t**2 , 'bs-', label='$y=x^2$')\n" +"plt.plot(t, (t - 5)**2 + 5 * t - 0.5, 'g^:', label='$y=(x - 5)^2 + 5 x - \\\\frac{1}{2}$') # note the double backslash\n" +"\n" +"plt.legend(loc='upper left', shadow=True, fontsize='x-large')\n" +"\n" +"# Note the double backslashes in the line below.\n" +"plt.xlabel('This is the x axis. It can also contain math such as $\\\\bar{x}=\\\\frac{\\\\sum_{i=1}^{n} {x}} {N}$')\n" +"plt.ylabel('This is the y axis')\n" +"plt.title('This is the figure title')\n" +"\n" +"plt.show()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:734 +# header +msgid "## 09-working-with-sql" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:736 +msgid "FIXME" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:739 +msgid "[This page][matplotlib-mathtext] contains more information." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:741 +msgid "[seaborn]: https://stanford.edu/~mwaskom/software/seaborn\n" +"[altair]: https://github.com/ellisonbg/altair\n" +"[matplotlib-mathtext]: https://matplotlib.org/users/mathtext.html" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:1 +# Front Matter +msgid "---\n" +"layout: page\n" +"title: \"Overview of Jupyter Notebooks\"\n" +"permalink: /jupyter_notebooks/\n" +"---" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:7 +msgid "![Example Jupyter Notebook](../fig/00_0_jupyter_notebook_example.jpg)\n" +"*Screenshot of a [Jupyter Notebook on quantum mechanics](https://github.com/jrjohansson/qutip-lectures) by Robert Johansson*" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:10 +# header +msgid "### How the Jupyter notebook works" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:12 +msgid "After typing the command `jupyter notebook`, the following happens:" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:14 +# unordered list +msgid "* A Jupyter Notebook server is automatically created on your local machine." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:15 +# unordered list +msgid "* The Jupyter Notebook server runs locally on your machine only and does not" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:16 +msgid " use an internet connection.\n" +"* The Jupyter Notebook server opens the Jupyter notebook client, also known\n" +" as the notebook user interface, in your default web browser." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:20 +msgid " ![Jupyter notebook file browser](../fig/00_1_jupyter_file_browser.png)\n" +" *The Jupyter notebook file browser*" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:23 +# unordered list +msgid "* To create a new Python notebook select the \"New\" dropdown on the upper" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:24 +msgid " right of the screen." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:26 +msgid " ![Jupyter notebook file browser](../fig/00_2_jupyter_new_notebook.png)\n" +" *The Jupyter notebook file browser*" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:29 +# unordered list +msgid "* When you can create a new notebook and type code into the browser, the web" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:30 +msgid " browser and the Jupyter notebook server communicate with each other." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:32 +msgid " ![new Jupyter notebook](../fig/00_3_jupyter_blank_notebook.png)\n" +" *A new, blank Jupyter notebook*" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:35 +# unordered list +msgid "* Under the \"help\" menu, take a quick interactive tour of how to" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:36 +msgid " use the notebook. Help on Jupyter and key workshop packages is\n" +" available here too." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:39 +msgid " ![Jupyter tour and help](../fig/00_4_jupyter_tour_help.png)\n" +" *User interface tour and Help*" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:42 +# unordered list +msgid "* The Jupyter Notebook server does the work and calculations, and the web" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:43 +msgid " browser renders the notebook.\n" +"* The web browser then displays the updated notebook to you." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:46 +# unordered list +msgid "* For example, click in the first cell and type some Python code." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:48 +msgid " ![Code cell](../fig/00_5_jupyter_code_before.png)\n" +" *A Code cell*" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:51 +# unordered list +msgid "* This is a **Code** cell (see the cell type dropdown with the word **Code**)." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:52 +msgid " To run the cell, type Shift+Return." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:54 +msgid " ![Code cell and its output](../fig/00_6_jupyter_code_after.png)\n" +" *A Code cell and its output*" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:57 +# unordered list +msgid "* Let's look at a **Markdown** cell. Markdown is a text manipulation" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:58 +msgid " language that is readable yet offers additional formatting. Don't forget\n" +" to select **Markdown** from the cell type dropdown. Click in the cell and\n" +" enter the markdown text." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:62 +msgid " ![markdown input cell](../fig/00_7_jupyter_markdown_before.png)\n" +" *A markdown input cell*" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:65 +# unordered list +msgid "* To run the cell, type Shift+Return." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:67 +msgid " ![rendered markdown cell](../fig/00_8_jupyter_markdown_after.png)\n" +" *A rendered markdown cell*" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:71 +msgid "This workflow has several advantages:" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:73 +# unordered list +msgid "- You can easily type, edit, and copy and paste blocks of code." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:74 +# unordered list +msgid "- Tab completion allows you to easily access the names of things you are using" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:75 +msgid " and learn more about them.\n" +"- It allows you to annotate your code with links, different sized text,\n" +" bullets, etc. to make information more accessible to you and your\n" +" collaborators.\n" +"- It allows you to display figures next to the code that produces them\n" +" to tell a complete story of the analysis." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:82 +# header +msgid "### How the notebook is stored" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:84 +# unordered list +msgid "* The notebook file is stored in a format called JSON and has the suffix" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:85 +msgid " `.ipynb`.\n" +"* Just like HTML for a webpage, what's saved in a notebook file looks\n" +" different from what you see in your browser.\n" +"* But this format allows Jupyter to mix software (in several languages) with\n" +" documentation and graphics, all in one file." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:91 +# header +msgid "### Notebook modes: Control and Edit" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:93 +msgid "The notebook has two modes of operation: Control and Edit. Control mode lets\n" +"you edit notebook level features; while, Edit mode lets you change the\n" +"contents of a notebook cell. Remember a notebook is made up of a number of\n" +"cells which can contain code, markdown, html, visualizations, and more." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:98 +# header +msgid "### Help and more information" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:100 +msgid "Use the **Help** menu and its options when needed." +msgstr "" + +#: python-ecology-lesson/aio.md:1 +# Front Matter +msgid "---\n" +"layout: page\n" +"permalink: /aio/\n" +"---" +msgstr "" + +#: python-ecology-lesson/aio.md:8 +# inline html +msgid "" +msgstr "" + +#: python-ecology-lesson/aio.md:34 +msgid "{% comment %}\n" +"Create an anchor for every episode.\n" +"{% endcomment %}\n" +"{% for episode in site.episodes %}\n" +"
\n" +"{% endfor %}" +msgstr "" + +#: python-ecology-lesson/index.md:1 +# Front Matter +msgid "---\n" +"layout: lesson\n" +"root: .\n" +"\n" +"maintainers:\n" +" - April Wright\n" +" - Tania Allard\n" +" - Maxim Belkin\n" +"---" +msgstr "" + +#: python-ecology-lesson/index.md:11 +msgid "**Lesson Maintainers:** {{ page.maintainers | join: ', ' }}" +msgstr "" + +#: python-ecology-lesson/index.md:13 +msgid "Python is a general purpose programming language that is useful for writing scripts to work effectively and reproducibly with data." +msgstr "" + +#: python-ecology-lesson/index.md:15 +msgid "This is an introduction to Python designed for participants with no programming experience. These lessons can be taught in a day (~ 6 hours). They start with some basic information about Python syntax, the Jupyter notebook interface, and move through how to import CSV files, using the pandas package to work with data frames, how to calculate summary information from a data frame, and a brief introduction to plotting. The last lesson demonstrates how to work with databases directly from Python." +msgstr "" + +#: python-ecology-lesson/index.md:17 +# blockquote, which can be cascaded +msgid "> ## Getting Started" +msgstr "" + +#: python-ecology-lesson/index.md:18 +msgid ">\n" +"> Data Carpentry's teaching is hands-on, so participants are encouraged to use\n" +"> their own computers to ensure the proper setup of tools for an efficient\n" +"> workflow.
**These lessons assume no prior knowledge of the skills or tools.**\n" +">\n" +"> To get started, follow the directions in the \"[Setup][lesson-setup]\" tab to\n" +"> download data to your computer and follow any installation instructions.\n" +">\n" +"> #### Prerequisites\n" +">\n" +"> This lesson requires a working copy of **Python**.\n" +">
To most effectively use these materials, please make sure to install\n" +"> everything *before* working through this lesson." +msgstr "" + +#: python-ecology-lesson/index.md:31 +#: python-ecology-lesson/index.md:36 +#: python-ecology-lesson/setup.md:24 +#: python-ecology-lesson/setup.md:42 +# SC/DC Template label +msgid "{: .prereq}" +msgstr "" + +#: python-ecology-lesson/index.md:33 +# blockquote, which can be cascaded +msgid "> ## For Instructors" +msgstr "" + +#: python-ecology-lesson/index.md:34 +# blockquote, which can be cascaded +msgid "> If you are teaching this lesson in a workshop, please see the" +msgstr "" + +#: python-ecology-lesson/index.md:35 +# blockquote, which can be cascaded +msgid "> [Instructor notes](guide)." +msgstr "" + +#: python-ecology-lesson/reference.md:1 +# Front Matter +msgid "---\n" +"layout: reference\n" +"---" +msgstr "" + +#: python-ecology-lesson/reference.md:5 +# header +msgid "## Glossary" +msgstr "" + +#: python-ecology-lesson/reference.md:7 +msgid "{:auto_ids}\n" +"0-based indexing\n" +": is a way of assigning indices to elements in a sequential, ordered data structure\n" +" starting from 0, i.e. where the first element of the sequence has index 0." +msgstr "" + +#: python-ecology-lesson/reference.md:12 +msgid "CSV (file)\n" +": is an acronym which stands for Comma-Separated Values file. CSV files store\n" +" tabular data, either numbers, strings, or a combination of the two, in plain\n" +" text with columns separated by a comma and rows by the carriage return character." +msgstr "" + +#: python-ecology-lesson/reference.md:17 +msgid "database\n" +": is an organized collection of data." +msgstr "" + +#: python-ecology-lesson/reference.md:20 +msgid "dataframe\n" +": is a two-dimensional labeled data structure with columns of (potentially)\n" +" different type." +msgstr "" + +#: python-ecology-lesson/reference.md:24 +msgid "data structure\n" +": is a particular way of organizing data in memory." +msgstr "" + +#: python-ecology-lesson/reference.md:27 +msgid "data type\n" +": is a particular kind of item that can be assigned to a variable, defined by\n" +" by the values it can take, the programming language in use and the operations\n" +" that can be performed on it." +msgstr "" + +#: python-ecology-lesson/reference.md:32 +msgid "dictionary\n" +": is an unordered Python data structure designed to contain key-value pairs, where both\n" +" the key and the value can be integers, floats or strings. Elements of a dictionary\n" +" can be accessed by their key and can be modified." +msgstr "" + +#: python-ecology-lesson/reference.md:37 +msgid "docstring\n" +": is an optional documentation string to describe what a Python function does." +msgstr "" + +#: python-ecology-lesson/reference.md:40 +msgid "faceting\n" +": is the act of plotting relationships between set variables in multiple subsets\n" +" of the data with the results appearing as different panels in the same figure." +msgstr "" + +#: python-ecology-lesson/reference.md:44 +msgid "float\n" +": is a Python data type designed to store positive and negative decimal numbers\n" +" by means of a floating point representation." +msgstr "" + +#: python-ecology-lesson/reference.md:48 +msgid "function\n" +": is a group of related statements that perform a specific task." +msgstr "" + +#: python-ecology-lesson/reference.md:51 +msgid "integer\n" +": is a Python data type designed to store positive and negative integer numbers." +msgstr "" + +#: python-ecology-lesson/reference.md:54 +msgid "interactive mode\n" +": is an online mode of operation in which the user writes the commands directly\n" +" on the command line one-by-one and execute them immediately by pressing a button\n" +" on the keyword, usually Return." +msgstr "" + +#: python-ecology-lesson/reference.md:59 +msgid "join key\n" +": is a variable or an array representing the column names over which pandas.DataFrame.join()\n" +" merge together columns of different data sets." +msgstr "" + +#: python-ecology-lesson/reference.md:63 +msgid "library\n" +": is a set of functions and methods grouped together to perform some specific\n" +" sort of tasks." +msgstr "" + +#: python-ecology-lesson/reference.md:67 +msgid "list\n" +": is a Python data structure designed to contain sequences of integers, floats,\n" +" strings and any combination of the previous. The sequence is ordered and indexed\n" +" by integers, starting from 0. Elements of a list can be accessed by their index\n" +" and can be modified." +msgstr "" + +#: python-ecology-lesson/reference.md:73 +msgid "loop\n" +": is a sequence of instructions that is continually repeated until a condition\n" +" is satisfied." +msgstr "" + +#: python-ecology-lesson/reference.md:77 +msgid "NaN\n" +": is an acronym for Not-a-Number and represents that either a value is missing or\n" +" the calculation cannot output any meaningful result." +msgstr "" + +#: python-ecology-lesson/reference.md:81 +msgid "None\n" +": is an object that represents no value." +msgstr "" + +#: python-ecology-lesson/reference.md:84 +msgid "scripting mode\n" +": is an offline mode of operation in which the user writes the commands to be\n" +" executed in a text file (with .py extension for Python) which is then compiled\n" +" or interpreted to run the program. Notes that Python interprets script on\n" +" run-time and compiles a binary version of the program to speed up the execution time." +msgstr "" + +#: python-ecology-lesson/reference.md:90 +msgid "Sequential (data structure)\n" +": is an ordered group of objects stored in memory which can be accessed specifying\n" +" their index, i.e. their position, in the structure." +msgstr "" + +#: python-ecology-lesson/reference.md:94 +msgid "SQL\n" +": or Structured Query Language, is a domain-specific language for managing data\n" +" stored in a relational database management system (RDBMS)." +msgstr "" + +#: python-ecology-lesson/reference.md:98 +msgid "SQLite\n" +": is a self-contained, public domain SQL database engine." +msgstr "" + +#: python-ecology-lesson/reference.md:101 +msgid "string\n" +": is a Python data type designed to store sequences of characters." +msgstr "" + +#: python-ecology-lesson/reference.md:104 +msgid "tuple\n" +": is a Python data structure designed to contain sequences of integers, floats,\n" +" strings and any combination of the previous. The sequence is ordered and indexed\n" +" by integers, starting from 0. Elements of a tuple can be accessed by their index\n" +" but cannot be modified." +msgstr "" + +#: python-ecology-lesson/setup.md:1 +# Front Matter +msgid "---\n" +"layout: page\n" +"title: Setup\n" +"---" +msgstr "" + +#: python-ecology-lesson/setup.md:6 +# blockquote, which can be cascaded +msgid "> ## Data" +msgstr "" + +#: python-ecology-lesson/setup.md:7 +# blockquote, which can be cascaded +msgid "> Data for this lesson is from the Portal Project Teaching Database -" +msgstr "" + +#: python-ecology-lesson/setup.md:8 +# blockquote, which can be cascaded +msgid "> [available on FigShare](https://figshare.com/articles/Portal_Project_Teaching_Database/1314459)." +msgstr "" + +#: python-ecology-lesson/setup.md:9 +msgid ">\n" +"> We will use the six files listed below for the data in this lesson.\n" +"> Download these files to your computer either by clicking\n" +"> [this link](https://github.com/weecology/portal-teachingdb/archive/master.zip),\n" +"> which will give you everything in a single compressed file.\n" +"> You'll need to unzip this file after downloading it.\n" +">\n" +"> Or download each file indvidually with the following links:\n" +">\n" +"> - [surveys.csv](https://ndownloader.figshare.com/files/10717177)\n" +"> - [species.csv](https://ndownloader.figshare.com/files/3299483)\n" +"> - [speciesSubset.csv]({{ page.root }}/data/speciesSubset.csv)\n" +"> - [plots.csv](https://ndownloader.figshare.com/files/3299474)\n" +"> - [bouldercreek_09_2013.txt]({{ page.root }}/data/bouldercreek_09_2013.txt)\n" +"> - [SQL Database](https://ndownloader.figshare.com/files/11188550)" +msgstr "" + +#: python-ecology-lesson/setup.md:28 +# blockquote, which can be cascaded +msgid "> ## Software" +msgstr "" + +#: python-ecology-lesson/setup.md:29 +# blockquote, which can be cascaded +msgid "> [Python](http://python.org) is a popular language for" +msgstr "" + +#: python-ecology-lesson/setup.md:30 +# blockquote, which can be cascaded +msgid "> scientific computing, and great for general-purpose programming as" +msgstr "" + +#: python-ecology-lesson/setup.md:31 +# blockquote, which can be cascaded +msgid "> well. Installing all of its scientific packages individually can be" +msgstr "" + +#: python-ecology-lesson/setup.md:32 +# blockquote, which can be cascaded +msgid "> a bit difficult, so we recommend an all-in-one installer." +msgstr "" + +#: python-ecology-lesson/setup.md:33 +msgid ">\n" +"> For this workshop we use Python version 3.x.\n" +">\n" +"> ### Required Python Packages for this workshop\n" +">\n" +"> * [Pandas](http://pandas.pydata.org/)\n" +"> * [Jupyter notebook](http://jupyter.org/)\n" +"> * [Numpy](http://www.numpy.org/)\n" +"> * [Matplotlib](http://matplotlib.org/)" +msgstr "" + +#: python-ecology-lesson/setup.md:44 +# header +msgid "## Install the workshop packages" +msgstr "" + +#: python-ecology-lesson/setup.md:46 +msgid "For installing these packages we will use Anaconda or Miniconda.\n" +"They both use [Conda](http://conda.pydata.org/docs/), the main difference is\n" +"that Anaconda comes with a lot of packages pre-installed.\n" +"With Miniconda you will need to install the required packages." +msgstr "" + +#: python-ecology-lesson/setup.md:51 +# header +msgid "### Anaconda installation" +msgstr "" + +#: python-ecology-lesson/setup.md:53 +msgid "Anaconda will install the workshop packages for you." +msgstr "" + +#: python-ecology-lesson/setup.md:55 +# header +msgid "#### Download and install Anaconda" +msgstr "" + +#: python-ecology-lesson/setup.md:57 +msgid "Download and install [Anaconda](https://www.anaconda.com/distribution/#download-section).\n" +"Remember to download and install the installer for Python 3.x." +msgstr "" + +#: python-ecology-lesson/setup.md:60 +# header +msgid "#### Download plotting package" +msgstr "" + +#: python-ecology-lesson/setup.md:62 +msgid "The plotting package plotnine is not installed by default. From the terminal,\n" +"type:" +msgstr "" + +#: python-ecology-lesson/setup.md:65 +# code block +msgid "~~~\n" +"conda install -c conda-forge plotnine\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/setup.md:70 +# header +msgid "### Miniconda installation" +msgstr "" + +#: python-ecology-lesson/setup.md:72 +msgid "Miniconda is a \"light\" version of Anaconda. If you install and use Miniconda\n" +"you will also need to install the workshop packages." +msgstr "" + +#: python-ecology-lesson/setup.md:75 +# header +msgid "#### Download and install Miniconda" +msgstr "" + +#: python-ecology-lesson/setup.md:77 +msgid "Download and install [Miniconda](https://docs.conda.io/en/latest/miniconda.html)\n" +"following the instructions. Remember to download and run the installer for\n" +"Python 3.x." +msgstr "" + +#: python-ecology-lesson/setup.md:81 +# header +msgid "#### Check the installation of Miniconda" +msgstr "" + +#: python-ecology-lesson/setup.md:83 +#: python-ecology-lesson/setup.md:92 +msgid "From the terminal, type:" +msgstr "" + +#: python-ecology-lesson/setup.md:85 +# code block +msgid "~~~\n" +"conda list\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/setup.md:90 +# header +msgid "### Install the required workshop packages with conda" +msgstr "" + +#: python-ecology-lesson/setup.md:94 +# code block +msgid "~~~\n" +"conda install -y numpy pandas matplotlib jupyter\n" +"conda install -c conda-forge plotnine\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/setup.md:100 +# header +msgid "## Launch a Jupyter notebook" +msgstr "" + +#: python-ecology-lesson/setup.md:102 +msgid "After installing either Anaconda or Miniconda and the workshop packages,\n" +"launch a Jupyter notebook by typing this command from the terminal:" +msgstr "" + +#: python-ecology-lesson/setup.md:105 +# code block +msgid "~~~\n" +"jupyter notebook\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/setup.md:110 +msgid "The notebook should open automatically in your browser. If it does not or you\n" +"wish to use a different browser, open this link: ." +msgstr "" + +#: python-ecology-lesson/setup.md:113 +msgid "For a bried introduction to Jupyter Notebooks, please consult with our\n" +"[Introduction to Jupyter Notebooks](jupyter_notebooks) page." +msgstr "" + diff --git a/po/LINGUAS b/po/LINGUAS index 93656dd7..83767da0 100644 --- a/po/LINGUAS +++ b/po/LINGUAS @@ -1 +1 @@ -es ja +es ja ${locale} diff --git a/po/POTFILES.in b/po/POTFILES.in index 87052900..c2e8f1af 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,6 +1,29 @@ README.md README_en.md tmp.md +bioc-rnaseq/CODE_OF_CONDUCT.md +bioc-rnaseq/CONTRIBUTING.md +bioc-rnaseq/LICENSE.md +bioc-rnaseq/README.md +bioc-rnaseq/_extras/about.md +bioc-rnaseq/_extras/discuss.md +bioc-rnaseq/_extras/figures.md +bioc-rnaseq/_extras/guide.md +bioc-rnaseq/_includes/links.md +bioc-rnaseq/aio.md +bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md +bioc-rnaseq/bin/boilerplate/README.md +bioc-rnaseq/bin/boilerplate/_episodes/01-introduction.md +bioc-rnaseq/bin/boilerplate/_extras/about.md +bioc-rnaseq/bin/boilerplate/_extras/discuss.md +bioc-rnaseq/bin/boilerplate/_extras/figures.md +bioc-rnaseq/bin/boilerplate/_extras/guide.md +bioc-rnaseq/bin/boilerplate/index.md +bioc-rnaseq/bin/boilerplate/reference.md +bioc-rnaseq/bin/boilerplate/setup.md +bioc-rnaseq/index.md +bioc-rnaseq/reference.md +bioc-rnaseq/setup.md docs/CultureNotes.md docs/TranslatorGuidelines.md docs/Translators.md diff --git a/po/bioc-rnaseq.ja.po b/po/bioc-rnaseq.ja.po new file mode 100644 index 00000000..5d994dfd --- /dev/null +++ b/po/bioc-rnaseq.ja.po @@ -0,0 +1,1100 @@ +# Japanese translation of the Software Carpentry Incubator RNA-seq analysis with Bioconductor Lesson +# Copyright (C) 2021 Software Carpentry Foundation; Japanese Translation Team +# This file is distributed under the same license as the po4gitbook package. +# Software-Carpentry Japanese-Team , 2019, 2020, 2021. +# +msgid "" +msgstr "" +"Project-Id-Version: i18n\n" +"Report-Msgid-Bugs-To: https://github.com/haiwen/seafile-docs/issues\n" +"POT-Creation-Date: 2021-08-10 23:44:51+0900\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: Software-Carpentry Japanese-Team \n" +"Language-Team: Japanese \n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +# Front Matter +#: bioc-rnaseq/CODE_OF_CONDUCT.md:1 +msgid "" +"---\n" +"layout: page\n" +"title: \"Contributor Code of Conduct\"\n" +"---" +msgstr "" + +#: bioc-rnaseq/CODE_OF_CONDUCT.md:5 +msgid "" +"As contributors and maintainers of this project,\n" +"we pledge to follow the [Carpentry Code of Conduct][coc]." +msgstr "" + +#: bioc-rnaseq/CODE_OF_CONDUCT.md:8 +msgid "" +"Instances of abusive, harassing, or otherwise unacceptable behavior\n" +"may be reported by following our [reporting guidelines][coc-reporting]." +msgstr "" + +#: bioc-rnaseq/CODE_OF_CONDUCT.md:11 bioc-rnaseq/_extras/discuss.md:6 +#: bioc-rnaseq/_extras/figures.md:79 bioc-rnaseq/_extras/guide.md:6 +#: bioc-rnaseq/bin/boilerplate/_episodes/01-introduction.md:14 +#: bioc-rnaseq/bin/boilerplate/_extras/discuss.md:6 +#: bioc-rnaseq/bin/boilerplate/_extras/figures.md:79 +#: bioc-rnaseq/bin/boilerplate/_extras/guide.md:6 +#: bioc-rnaseq/bin/boilerplate/index.md:17 +#: bioc-rnaseq/bin/boilerplate/reference.md:9 +#: bioc-rnaseq/bin/boilerplate/setup.md:7 bioc-rnaseq/index.md:19 +#: bioc-rnaseq/reference.md:9 bioc-rnaseq/setup.md:7 +msgid "{% include links.md %}" +msgstr "" + +# header +#: bioc-rnaseq/CONTRIBUTING.md:1 bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:1 +msgid "# Contributing" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:3 +msgid "" +"[The Carpentries][c-site],\n" +"([Software Carpentry][swc-site],\n" +"[Data Carpentry][dc-site],\n" +"and [Library Carpentry][lc-site]) are open source projects,\n" +"and we welcome contributions of all kinds:\n" +"new lessons,\n" +"fixes to existing material,\n" +"bug reports,\n" +"and reviews of proposed changes are all welcome." +msgstr "" + +# header +#: bioc-rnaseq/CONTRIBUTING.md:13 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:10 +msgid "## Contributor Agreement" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:15 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:12 +msgid "" +"By contributing,\n" +"you agree that we may redistribute your work under [our license](LICENSE." +"md).\n" +"In exchange,\n" +"we will address your issues and/or assess your change proposal as promptly " +"as we can,\n" +"and help you become a member of our community.\n" +"Everyone involved in [The Carpentries][c-site]\n" +"agrees to abide by our [code of conduct](CODE_OF_CONDUCT.md)." +msgstr "" + +# header +#: bioc-rnaseq/CONTRIBUTING.md:23 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:20 +msgid "## How to Contribute" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:25 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:22 +msgid "" +"The easiest way to get started is to file an issue\n" +"to tell us about a spelling mistake,\n" +"some awkward wording,\n" +"or a factual error.\n" +"This is a good way to introduce yourself\n" +"and to meet some of our community members." +msgstr "" + +# ordered list +#: bioc-rnaseq/CONTRIBUTING.md:32 +msgid "1. If you have a [GitHub][github] account," +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:33 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:35 +msgid "" +" or are willing to [create one][github-join],\n" +" but do not know how to use Git,\n" +" you can report problems or suggest improvements by [creating an issue]" +"[issues].\n" +" This allows us to assign the item to someone\n" +" and to respond to it in a threaded discussion." +msgstr "" + +# ordered list +#: bioc-rnaseq/CONTRIBUTING.md:39 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:41 +msgid "3. If you are comfortable with Git," +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:40 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:42 +msgid "" +" and would like to add or change material,\n" +" you can submit a pull request (PR).\n" +" Instructions for doing this are [included below](#using-github)." +msgstr "" + +# header +#: bioc-rnaseq/CONTRIBUTING.md:44 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:46 +msgid "## Where to Contribute" +msgstr "" + +# ordered list +#: bioc-rnaseq/CONTRIBUTING.md:46 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:48 +msgid "1. If you wish to change this lesson," +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:47 +msgid "" +" please work in ,\n" +" which can be viewed at ." +msgstr "" + +# ordered list +#: bioc-rnaseq/CONTRIBUTING.md:50 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:52 +msgid "2. If you wish to change the example lesson," +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:51 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:53 +msgid "" +" please work in ,\n" +" which documents the format of our lessons\n" +" and can be viewed at ." +msgstr "" + +# ordered list +#: bioc-rnaseq/CONTRIBUTING.md:55 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:57 +msgid "3. If you wish to change the template used for workshop websites," +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:56 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:58 +msgid "" +" please work in .\n" +" The home page of that repository explains how to set up workshop " +"websites,\n" +" while the extra pages in \n" +" provide more background on our design choices." +msgstr "" + +# ordered list +#: bioc-rnaseq/CONTRIBUTING.md:61 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:63 +msgid "4. If you wish to change CSS style files, tools," +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:62 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:64 +msgid "" +" or HTML boilerplate for lessons or workshops stored in `_includes` or " +"`_layouts`,\n" +" please work in ." +msgstr "" + +# header +#: bioc-rnaseq/CONTRIBUTING.md:65 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:67 +msgid "## What to Contribute" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:67 +msgid "" +"This is a new lesson under active development.\n" +"We welcome contributions of any kind at this early stage of the process." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:70 +msgid "" +"There are many ways to contribute,\n" +"from writing new exercises and improving existing ones,\n" +"through adding lesson content and visual aids,\n" +"to updating or filling in the documentation\n" +"and submitting [bug reports][issues]\n" +"about things that don't work, aren't clear, or are missing.\n" +"If you are looking for ideas, please see\n" +"[the 'Issues' tab][repo-issues]\n" +"for a list of issues associated with this repository,\n" +"or you may also look at the issues for [Data Carpentry][dc-issues],\n" +"[Software Carpentry][swc-issues], and [Library Carpentry][lc-issues] " +"projects." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:82 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:79 +msgid "" +"Comments on issues and reviews of pull requests are just as welcome:\n" +"we are smarter together than we are on our own.\n" +"Reviews from novices and newcomers are particularly valuable:\n" +"it's easy for people who have been using these lessons for a while\n" +"to forget how impenetrable some of this material can be,\n" +"so fresh eyes are always welcome." +msgstr "" + +# header +#: bioc-rnaseq/CONTRIBUTING.md:89 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:86 +msgid "## What *Not* to Contribute" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:91 +msgid "" +"We are not looking for exercises or other material that only run on one " +"platform.\n" +"Our workshops typically contain a mixture of Windows, macOS, and Linux " +"users;\n" +"in order to be usable,\n" +"our lessons must run equally well on all three." +msgstr "" + +# header +#: bioc-rnaseq/CONTRIBUTING.md:96 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:102 +msgid "## Using GitHub" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:98 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:104 +msgid "" +"If you choose to contribute via GitHub, you may want to look at\n" +"[How to Contribute to an Open Source Project on GitHub][how-contribute].\n" +"To manage changes, we follow [GitHub flow][github-flow].\n" +"Each lesson has two maintainers who review issues and pull requests or " +"encourage others to do so.\n" +"The maintainers are community volunteers and have final say over what gets " +"merged into the lesson.\n" +"To use the web interface for contributing to a lesson:" +msgstr "" + +# ordered list +#: bioc-rnaseq/CONTRIBUTING.md:105 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:111 +msgid "1. Fork the originating repository to your GitHub profile." +msgstr "" + +# ordered list +#: bioc-rnaseq/CONTRIBUTING.md:106 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:112 +msgid "" +"2. Within your version of the forked repository, move to the `gh-pages` " +"branch and" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:107 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:113 +msgid "" +"create a new branch for each significant change being made.\n" +"3. Navigate to the file(s) you wish to change within the new branches and " +"make revisions as required.\n" +"4. Commit all changed files within the appropriate branches.\n" +"5. Create individual pull requests from each of your changed branches\n" +"to the `gh-pages` branch within the originating repository.\n" +"6. If you receive feedback, make changes using your issue-specific branches " +"of the forked\n" +"repository and the pull requests will update automatically.\n" +"7. Repeat as needed until all feedback has been addressed." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:116 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:122 +msgid "" +"When starting work, please make sure your clone of the originating `gh-" +"pages` branch is up-to-date\n" +"before creating your own revision-specific branch(es) from there.\n" +"Additionally, please only work from your newly-created branch(es) and *not*\n" +"your clone of the originating `gh-pages` branch.\n" +"Lastly, published copies of all the lessons are available in the `gh-pages` " +"branch of the originating\n" +"repository for reference while revising." +msgstr "" + +# header +#: bioc-rnaseq/CONTRIBUTING.md:123 +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:129 +msgid "## Other Resources" +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:125 +msgid "" +"General discussion of [The Carpentries][c-site]\n" +"happens on the [discussion mailing list][discuss-list],\n" +"which everyone is welcome to join.\n" +"You can also [join the `bioconductor-teaching` Google Group][bioc-teaching]\n" +"to join discussion of this and other Bioconductor lessons in\n" +"The Carpentries Incubator." +msgstr "" + +#: bioc-rnaseq/CONTRIBUTING.md:132 +msgid "" +"[bioc-teaching]: https://groups.google.com/g/bioconductor-teaching\n" +"[dc-issues]: https://github.com/issues?q=user%3Adatacarpentry\n" +"[dc-lessons]: http://datacarpentry.org/lessons/\n" +"[dc-site]: http://datacarpentry.org/\n" +"[discuss-list]: http://lists.software-carpentry.org/listinfo/discuss\n" +"[github]: https://github.com\n" +"[github-flow]: https://guides.github.com/introduction/flow/\n" +"[github-join]: https://github.com/join\n" +"[how-contribute]: https://egghead.io/series/how-to-contribute-to-an-open-" +"source-project-on-github\n" +"[issues]: https://guides.github.com/features/issues/\n" +"[swc-issues]: https://github.com/issues?q=user%3Aswcarpentry\n" +"[swc-lessons]: https://software-carpentry.org/lessons/\n" +"[swc-site]: https://software-carpentry.org/\n" +"[c-site]: https://carpentries.org/\n" +"[lc-site]: https://librarycarpentry.org/\n" +"[lc-issues]: https://github.com/issues?q=user%3Alibrarycarpentry\n" +"[repo-issues]: https://github.com/carpentries-incubator/bioc-rnaseq/issues" +msgstr "" + +# Front Matter +#: bioc-rnaseq/LICENSE.md:1 +msgid "" +"---\n" +"layout: page\n" +"title: \"Licenses\"\n" +"root: .\n" +"---" +msgstr "" + +# header +#: bioc-rnaseq/LICENSE.md:6 +msgid "## Instructional Material" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:8 +msgid "" +"All Software Carpentry, Data Carpentry, and Library Carpentry instructional " +"material is\n" +"made available under the [Creative Commons Attribution\n" +"license][cc-by-human]. The following is a human-readable summary of\n" +"(and not a substitute for) the [full legal text of the CC BY 4.0\n" +"license][cc-by-legal]." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:14 +msgid "You are free:" +msgstr "" + +# unordered list +#: bioc-rnaseq/LICENSE.md:16 +msgid "" +"* to **Share**---copy and redistribute the material in any medium or format" +msgstr "" + +# unordered list +#: bioc-rnaseq/LICENSE.md:17 +msgid "* to **Adapt**---remix, transform, and build upon the material" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:19 +msgid "for any purpose, even commercially." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:21 +msgid "" +"The licensor cannot revoke these freedoms as long as you follow the\n" +"license terms." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:24 +msgid "Under the following terms:" +msgstr "" + +# unordered list +#: bioc-rnaseq/LICENSE.md:26 +msgid "* **Attribution**---You must give appropriate credit (mentioning that" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:27 +msgid "" +" your work is derived from work that is Copyright © Software\n" +" Carpentry and, where practical, linking to\n" +" http://software-carpentry.org/), provide a [link to the\n" +" license][cc-by-human], and indicate if changes were made. You may do\n" +" so in any reasonable manner, but not in any way that suggests the\n" +" licensor endorses you or your use." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:34 +msgid "" +"**No additional restrictions**---You may not apply legal terms or\n" +"technological measures that legally restrict others from doing\n" +"anything the license permits. With the understanding that:" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:38 +msgid "Notices:" +msgstr "" + +# unordered list +#: bioc-rnaseq/LICENSE.md:40 +msgid "* You do not have to comply with the license for elements of the" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:41 +msgid "" +" material in the public domain or where your use is permitted by an\n" +" applicable exception or limitation.\n" +"* No warranties are given. The license may not give you all of the\n" +" permissions necessary for your intended use. For example, other\n" +" rights such as publicity, privacy, or moral rights may limit how you\n" +" use the material." +msgstr "" + +# header +#: bioc-rnaseq/LICENSE.md:48 +msgid "## Software" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:50 +msgid "" +"Except where otherwise noted, the example programs and other software\n" +"provided by Software Carpentry and Data Carpentry are made available under " +"the\n" +"[OSI][osi]-approved\n" +"[MIT license][mit-license]." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:55 +msgid "" +"Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:63 +msgid "" +"The above copyright notice and this permission notice shall be\n" +"included in all copies or substantial portions of the Software." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:66 +msgid "" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" +"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" +"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" +"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" +"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." +msgstr "" + +# header +#: bioc-rnaseq/LICENSE.md:74 +msgid "## Trademark" +msgstr "" + +#: bioc-rnaseq/LICENSE.md:76 +msgid "" +"\"Software Carpentry\" and \"Data Carpentry\" and their respective logos\n" +"are registered trademarks of [Community Initiatives][CI]." +msgstr "" + +#: bioc-rnaseq/LICENSE.md:79 +msgid "" +"[cc-by-human]: https://creativecommons.org/licenses/by/4.0/\n" +"[cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode\n" +"[mit-license]: https://opensource.org/licenses/mit-license.html\n" +"[ci]: http://communityin.org/\n" +"[osi]: https://opensource.org" +msgstr "" + +# header +#: bioc-rnaseq/README.md:1 +msgid "# RNA-seq analysis with Bioconductor" +msgstr "" + +#: bioc-rnaseq/README.md:3 bioc-rnaseq/bin/boilerplate/README.md:3 +msgid "" +"[![Create a Slack Account with us](https://img.shields.io/badge/" +"Create_Slack_Account-The_Carpentries-071159.svg)](https://swc-slack-invite." +"herokuapp.com/)" +msgstr "" + +# header +#: bioc-rnaseq/README.md:6 bioc-rnaseq/bin/boilerplate/README.md:7 +msgid "## Contributing" +msgstr "" + +#: bioc-rnaseq/README.md:8 bioc-rnaseq/bin/boilerplate/README.md:9 +msgid "" +"We welcome all contributions to improve the lesson! Maintainers will do " +"their best to help you if you have any\n" +"questions, concerns, or experience any difficulties along the way." +msgstr "" + +#: bioc-rnaseq/README.md:11 bioc-rnaseq/bin/boilerplate/README.md:12 +msgid "" +"We'd like to ask you to familiarize yourself with our [Contribution Guide]" +"(CONTRIBUTING.md) and have a look at\n" +"the [more detailed guidelines][lesson-example] on proper formatting, ways to " +"render the lesson locally, and even\n" +"how to write new episodes." +msgstr "" + +#: bioc-rnaseq/README.md:15 +msgid "" +"Please see the current list of [issues][FIXME] for ideas for contributing to " +"this\n" +"repository. For making your contribution, we use the GitHub flow, which is\n" +"nicely explained in the chapter [Contributing to a Project](http://git-scm." +"com/book/en/v2/GitHub-Contributing-to-a-Project) in Pro Git\n" +"by Scott Chacon.\n" +"Look for the tag ![good_first_issue](https://img.shields.io/badge/-good" +"%20first%20issue-gold.svg). This indicates that the maintainers will welcome " +"a pull request fixing this issue." +msgstr "" + +# header +#: bioc-rnaseq/README.md:22 +msgid "## Useful links" +msgstr "" + +# unordered list +#: bioc-rnaseq/README.md:24 +msgid "" +"* [ ] If you're going to be developing lesson material for the first time" +msgstr "" + +#: bioc-rnaseq/README.md:25 +msgid "" +" according to our design principles,\n" +" consider reading the [Carpentries Curriculum Development Handbook][cdh]\n" +"* [ ] Consult the [Lesson Example][lesson-example] website to find out more " +"about\n" +" working with the lesson template" +msgstr "" + +# header +#: bioc-rnaseq/README.md:31 bioc-rnaseq/bin/boilerplate/README.md:23 +msgid "## Maintainer(s)" +msgstr "" + +#: bioc-rnaseq/README.md:33 +msgid "Current maintainers of this lesson are" +msgstr "" + +# unordered list +#: bioc-rnaseq/README.md:35 +msgid "* Charlotte Soneson" +msgstr "" + +# unordered list +#: bioc-rnaseq/README.md:36 +msgid "* Jenny Drnevich" +msgstr "" + +# unordered list +#: bioc-rnaseq/README.md:37 +msgid "* Laurent Gatto" +msgstr "" + +# unordered list +#: bioc-rnaseq/README.md:38 +msgid "* Robert Castelo" +msgstr "" + +# header +#: bioc-rnaseq/README.md:41 bioc-rnaseq/bin/boilerplate/README.md:32 +msgid "## Authors" +msgstr "" + +#: bioc-rnaseq/README.md:43 bioc-rnaseq/bin/boilerplate/README.md:34 +msgid "A list of contributors to the lesson can be found in [AUTHORS](AUTHORS)" +msgstr "" + +# header +#: bioc-rnaseq/README.md:45 bioc-rnaseq/bin/boilerplate/README.md:36 +msgid "## Citation" +msgstr "" + +#: bioc-rnaseq/README.md:47 bioc-rnaseq/bin/boilerplate/README.md:38 +msgid "To cite this lesson, please consult with [CITATION](CITATION)" +msgstr "" + +#: bioc-rnaseq/README.md:49 +msgid "" +"[cdh]: https://cdh.carpentries.org\n" +"[community-lessons]: https://carpentries.org/community-lessons\n" +"[lesson-example]: https://carpentries.github.io/lesson-example" +msgstr "" + +# Front Matter +#: bioc-rnaseq/_extras/about.md:1 +#: bioc-rnaseq/bin/boilerplate/_extras/about.md:1 +msgid "" +"---\n" +"title: About\n" +"---" +msgstr "" + +#: bioc-rnaseq/_extras/about.md:4 +#: bioc-rnaseq/bin/boilerplate/_extras/about.md:4 +msgid "" +"{% include carpentries.html %}\n" +"{% include links.md %}" +msgstr "" + +# Front Matter +#: bioc-rnaseq/_extras/discuss.md:1 +#: bioc-rnaseq/bin/boilerplate/_extras/discuss.md:1 +msgid "" +"---\n" +"title: Discussion\n" +"---" +msgstr "" + +#: bioc-rnaseq/_extras/discuss.md:4 bioc-rnaseq/_extras/guide.md:4 +#: bioc-rnaseq/bin/boilerplate/_episodes/01-introduction.md:12 +#: bioc-rnaseq/bin/boilerplate/_extras/discuss.md:4 +#: bioc-rnaseq/bin/boilerplate/_extras/guide.md:4 +#: bioc-rnaseq/bin/boilerplate/reference.md:7 +#: bioc-rnaseq/bin/boilerplate/setup.md:4 bioc-rnaseq/reference.md:7 +#: bioc-rnaseq/setup.md:4 +msgid "FIXME" +msgstr "" + +# Front Matter +#: bioc-rnaseq/_extras/figures.md:1 +#: bioc-rnaseq/bin/boilerplate/_extras/figures.md:1 +msgid "" +"---\n" +"title: Figures\n" +"---" +msgstr "" + +#: bioc-rnaseq/_extras/figures.md:5 +#: bioc-rnaseq/bin/boilerplate/_extras/figures.md:5 +msgid "" +"{% include base_path.html %}\n" +"{% include manual_episode_order.html %}" +msgstr "" + +# inline html +#: bioc-rnaseq/_extras/figures.md:8 +#: bioc-rnaseq/bin/boilerplate/_extras/figures.md:8 +msgid "" +"" +msgstr "" + +#: bioc-rnaseq/_extras/figures.md:68 +#: bioc-rnaseq/bin/boilerplate/_extras/figures.md:68 +msgid "" +"{% comment %} Create anchor for each one of the episodes. {% endcomment %}" +msgstr "" + +#: bioc-rnaseq/_extras/figures.md:70 +#: bioc-rnaseq/bin/boilerplate/_extras/figures.md:70 +msgid "" +"{% for lesson_episode in lesson_episodes %}\n" +" {% if site.episode_order %}\n" +" {% assign episode = site.episodes | where: \"slug\", lesson_episode | " +"first %}\n" +" {% else %}\n" +" {% assign episode = lesson_episode %}\n" +" {% endif %}\n" +"
\n" +"{% endfor %}" +msgstr "" + +# Front Matter +#: bioc-rnaseq/_extras/guide.md:1 +#: bioc-rnaseq/bin/boilerplate/_extras/guide.md:1 +msgid "" +"---\n" +"title: \"Instructor Notes\"\n" +"---" +msgstr "" + +#: bioc-rnaseq/_includes/links.md:1 +msgid "" +"{% include base_path.html %}\n" +"[cc-by-human]: https://creativecommons.org/licenses/by/4.0/\n" +"[cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode\n" +"[ci]: http://communityin.org/\n" +"[coc-reporting]: https://docs.carpentries.org/topic_folders/policies/" +"incident-reporting.html\n" +"[coc]: https://docs.carpentries.org/topic_folders/policies/code-of-conduct." +"html\n" +"[concept-maps]: https://carpentries.github.io/instructor-training/05-" +"memory/\n" +"[contrib-covenant]: https://contributor-covenant.org/\n" +"[contributing]: {{ repo_url }}/blob/{{ source_branch }}/CONTRIBUTING.md\n" +"[cran-checkpoint]: https://cran.r-project.org/package=checkpoint\n" +"[cran-knitr]: https://cran.r-project.org/package=knitr\n" +"[cran-stringr]: https://cran.r-project.org/package=stringr\n" +"[dc-lessons]: http://www.datacarpentry.org/lessons/\n" +"[email]: mailto:team@carpentries.org\n" +"[github-importer]: https://import.github.com/\n" +"[importer]: https://github.com/new/import\n" +"[jekyll-collection]: https://jekyllrb.com/docs/collections/\n" +"[jekyll-install]: https://jekyllrb.com/docs/installation/\n" +"[jekyll-windows]: http://jekyll-windows.juthilo.com/\n" +"[jekyll]: https://jekyllrb.com/\n" +"[jupyter]: https://jupyter.org/\n" +"[kramdown]: https://kramdown.gettalong.org/\n" +"[lc-lessons]: https://librarycarpentry.org/lessons/\n" +"[lesson-aio]: {{ relative_root_path }}{% link aio.md %}\n" +"[lesson-coc]: {{ relative_root_path }}{% link CODE_OF_CONDUCT.md %}\n" +"[lesson-example]: https://carpentries.github.io/lesson-example/\n" +"[lesson-license]: {{ relative_root_path }}{% link LICENSE.md %}\n" +"[lesson-mainpage]: {{ relative_root_path }}{% link index.md %}\n" +"[lesson-reference]: {{ relative_root_path }}{% link reference.md %}\n" +"[lesson-setup]: {{ relative_root_path }}{% link setup.md %}\n" +"[mit-license]: https://opensource.org/licenses/mit-license.html\n" +"[morea]: https://morea-framework.github.io/\n" +"[numfocus]: https://numfocus.org/\n" +"[osi]: https://opensource.org\n" +"[pandoc]: https://pandoc.org/\n" +"[paper-now]: https://github.com/PeerJ/paper-now\n" +"[python-gapminder]: https://swcarpentry.github.io/python-novice-gapminder/\n" +"[pyyaml]: https://pypi.org/project/PyYAML/\n" +"[r-markdown]: https://rmarkdown.rstudio.com/\n" +"[rstudio]: https://www.rstudio.com/\n" +"[ruby-install-guide]: https://www.ruby-lang.org/en/downloads/\n" +"[ruby-installer]: https://rubyinstaller.org/\n" +"[rubygems]: https://rubygems.org/pages/download/\n" +"[styles]: https://github.com/carpentries/styles/\n" +"[swc-lessons]: https://software-carpentry.org/lessons/\n" +"[swc-releases]: https://github.com/swcarpentry/swc-releases\n" +"[training]: https://carpentries.github.io/instructor-training/\n" +"[workshop-repo]: {{ site.workshop_repo }}\n" +"[yaml]: http://yaml.org/" +msgstr "" + +# Front Matter +#: bioc-rnaseq/aio.md:1 +msgid "" +"---\n" +"permalink: /aio/index.html\n" +"---" +msgstr "" + +#: bioc-rnaseq/aio.md:5 +msgid "" +"{% comment %}\n" +"As a maintainer, you don't need to edit this file.\n" +"If you notice that something doesn't work, please \n" +"open an issue: https://github.com/carpentries/styles/issues/new\n" +"{% endcomment %}" +msgstr "" + +#: bioc-rnaseq/aio.md:11 +msgid "{% include base_path.html %}" +msgstr "" + +#: bioc-rnaseq/aio.md:13 +msgid "{% include aio-script.md %}" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:3 +msgid "" +"[The Carpentries][c-site] ([Software Carpentry][swc-site], [Data Carpentry]" +"[dc-site], and [Library Carpentry][lc-site]) are open source projects,\n" +"and we welcome contributions of all kinds:\n" +"new lessons,\n" +"fixes to existing material,\n" +"bug reports,\n" +"and reviews of proposed changes are all welcome." +msgstr "" + +# ordered list +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:29 +msgid "1. If you do not have a [GitHub][github] account," +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:30 +msgid "" +" you can [send us comments by email][email].\n" +" However,\n" +" we will be able to respond more quickly if you use one of the other " +"methods described below." +msgstr "" + +# ordered list +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:34 +msgid "2. If you have a [GitHub][github] account," +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:49 +msgid "" +" please work in ,\n" +" which can be viewed at ." +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:69 +msgid "" +"There are many ways to contribute,\n" +"from writing new exercises and improving existing ones\n" +"to updating or filling in the documentation\n" +"and submitting [bug reports][issues]\n" +"about things that don't work, aren't clear, or are missing.\n" +"If you are looking for ideas, please see the 'Issues' tab for\n" +"a list of issues associated with this repository,\n" +"or you may also look at the issues for [Data Carpentry][dc-issues], \n" +"[Software Carpentry][swc-issues], and [Library Carpentry][lc-issues] " +"projects." +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:88 +msgid "" +"Our lessons already contain more material than we can cover in a typical " +"workshop,\n" +"so we are usually *not* looking for more concepts or tools to add to them.\n" +"As a rule,\n" +"if you want to introduce a new idea,\n" +"you must (a) estimate how long it will take to teach\n" +"and (b) explain what you would take out to make room for it.\n" +"The first encourages contributors to be honest about requirements;\n" +"the second, to think hard about priorities." +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:97 +msgid "" +"We are also not looking for exercises or other material that only run on one " +"platform.\n" +"Our workshops typically contain a mixture of Windows, macOS, and Linux " +"users;\n" +"in order to be usable,\n" +"our lessons must run equally well on all three." +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:131 +msgid "" +"General discussion of [Software Carpentry][swc-site] and [Data Carpentry][dc-" +"site]\n" +"happens on the [discussion mailing list][discuss-list],\n" +"which everyone is welcome to join.\n" +"You can also [reach us by email][email]." +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/CONTRIBUTING.md:136 +msgid "" +"[email]: mailto:admin@software-carpentry.org\n" +"[dc-issues]: https://github.com/issues?q=user%3Adatacarpentry\n" +"[dc-lessons]: http://datacarpentry.org/lessons/\n" +"[dc-site]: http://datacarpentry.org/\n" +"[discuss-list]: http://lists.software-carpentry.org/listinfo/discuss\n" +"[github]: https://github.com\n" +"[github-flow]: https://guides.github.com/introduction/flow/\n" +"[github-join]: https://github.com/join\n" +"[how-contribute]: https://egghead.io/series/how-to-contribute-to-an-open-" +"source-project-on-github\n" +"[issues]: https://guides.github.com/features/issues/\n" +"[swc-issues]: https://github.com/issues?q=user%3Aswcarpentry\n" +"[swc-lessons]: https://software-carpentry.org/lessons/\n" +"[swc-site]: https://software-carpentry.org/\n" +"[c-site]: https://carpentries.org/\n" +"[lc-site]: https://librarycarpentry.org/\n" +"[lc-issues]: https://github.com/issues?q=user%3Alibrarycarpentry" +msgstr "" + +# header +#: bioc-rnaseq/bin/boilerplate/README.md:1 +msgid "# FIXME Lesson title" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/README.md:5 +msgid "" +"This repository generates the corresponding lesson website from [The " +"Carpentries](https://carpentries.org/) repertoire of lessons. " +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/README.md:16 +msgid "" +"Please see the current list of [issues][FIXME] for ideas for contributing to " +"this\n" +"repository. For making your contribution, we use the GitHub flow, which is\n" +"nicely explained in the chapter [Contributing to a Project](http://git-scm." +"com/book/en/v2/GitHub-Contributing-to-a-Project) in Pro Git\n" +"by Scott Chacon.\n" +"Look for the tag ![good_first_issue](https://img.shields.io/badge/-good" +"%20first%20issue-gold.svg). This indicates that the maintainers will welcome " +"a pull request fixing this issue. " +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/README.md:25 +msgid "Current maintainers of this lesson are " +msgstr "" + +# unordered list +#: bioc-rnaseq/bin/boilerplate/README.md:27 +#: bioc-rnaseq/bin/boilerplate/README.md:28 +#: bioc-rnaseq/bin/boilerplate/README.md:29 +msgid "* FIXME" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/README.md:40 +msgid "[lesson-example]: https://carpentries.github.io/lesson-example" +msgstr "" + +# Front Matter +#: bioc-rnaseq/bin/boilerplate/_episodes/01-introduction.md:1 +msgid "" +"---\n" +"title: \"Introduction\"\n" +"teaching: 0\n" +"exercises: 0\n" +"questions:\n" +"- \"Key question (FIXME)\"\n" +"objectives:\n" +"- \"First learning objective. (FIXME)\"\n" +"keypoints:\n" +"- \"First key point. Brief Answer to questions. (FIXME)\"\n" +"---" +msgstr "" + +# Front Matter +#: bioc-rnaseq/bin/boilerplate/index.md:1 bioc-rnaseq/index.md:1 +msgid "" +"---\n" +"layout: lesson\n" +"root: . # Is the only page that doesn't follow the pattern /:path/index." +"html\n" +"permalink: index.html # Is the only page that doesn't follow the pattern /:" +"path/index.html\n" +"---" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/index.md:6 +msgid "FIXME: home page introduction" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/index.md:8 bioc-rnaseq/index.md:8 +msgid "" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/index.md:10 bioc-rnaseq/index.md:10 +msgid "{% comment %} This is a comment in Liquid {% endcomment %}" +msgstr "" + +# blockquote, which can be cascaded +#: bioc-rnaseq/bin/boilerplate/index.md:12 bioc-rnaseq/index.md:12 +msgid "> ## Prerequisites" +msgstr "" + +#: bioc-rnaseq/bin/boilerplate/index.md:13 +msgid "" +">\n" +"> FIXME" +msgstr "" + +# SC/DC Template label +#: bioc-rnaseq/bin/boilerplate/index.md:15 bioc-rnaseq/index.md:17 +msgid "{: .prereq}" +msgstr "" + +# Front Matter +#: bioc-rnaseq/bin/boilerplate/reference.md:1 bioc-rnaseq/reference.md:1 +msgid "" +"---\n" +"layout: reference\n" +"---" +msgstr "" + +# header +#: bioc-rnaseq/bin/boilerplate/reference.md:5 bioc-rnaseq/reference.md:5 +msgid "## Glossary" +msgstr "" + +# Front Matter +#: bioc-rnaseq/bin/boilerplate/setup.md:1 bioc-rnaseq/setup.md:1 +msgid "" +"---\n" +"title: Setup\n" +"---" +msgstr "" + +#: bioc-rnaseq/index.md:6 +msgid "" +"FIXME: This lesson introduces the learner to RNA-seq analysis with " +"[Bioconductor](https://bioconductor.org/). " +msgstr "" + +#: bioc-rnaseq/index.md:13 +msgid "" +">\n" +"> - Familiarity with R, for example corresponding to the ['Introduction to " +"R'](https://carpentries-incubator.github.io/bioc-intro/) module.\n" +"> - Familiarity with statistical hypothesis testing (e.g., t-tests) and p-" +"values.\n" +"> - Familiarity with the biological basics of gene expression and RNA " +"sequencing." +msgstr "" diff --git a/po/lc-open-refine.ja.po b/po/lc-open-refine.ja.po index a1ec070d..7c253bbe 100644 --- a/po/lc-open-refine.ja.po +++ b/po/lc-open-refine.ja.po @@ -1,7 +1,7 @@ -# Japanese translation of the Software Carpentry ${repo} Lesson -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the git4pobook package. -# ${git_user} <${git_email}>, ${year}. +# Japanese translation of the Library Carpentry OpenRefine Lesson +# Copyright (C) 2021 Software Carpentry Foundation; Japanese Translation Team +# This file is distributed under the same license as the po4gitbook package. +# Software-Carpentry Japanese-Team , 2019, 2020, 2021. # msgid "" msgstr "" @@ -9,13 +9,13 @@ msgstr "" "Report-Msgid-Bugs-To: https://github.com/haiwen/seafile-docs/issues\n" "POT-Creation-Date: 2021-05-10 11:22:14+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: ${locale} -" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"Last-Translator: \n" +"Language-Team: Japanese \n" +"Language: ja\n" #: lc-open-refine/CODE_OF_CONDUCT.md:1 # Front Matter diff --git a/po/python-ecology-lesson.ja.po b/po/python-ecology-lesson.ja.po new file mode 100644 index 00000000..a85e7cc3 --- /dev/null +++ b/po/python-ecology-lesson.ja.po @@ -0,0 +1,11307 @@ +# Japanese translation of the Data Carpentry Python Lessons with Ecological Data +# Copyright (C) 2021 Software Carpentry Foundation; Japanese Translation Team +# This file is distributed under the same license as the po4gitbook package. +# Software-Carpentry Japanese-Team , 2019, 2020, 2021. +# +msgid "" +msgstr "" +"Project-Id-Version: i18n\n" +"Report-Msgid-Bugs-To: https://github.com/haiwen/seafile-docs/issues\n" +"POT-Creation-Date: 2021-08-10 23:50:45+0900\n" +"Last-Translator: \n" +"Language-Team: Japanese \n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"POT-Revision-Date: 2021-08-10 23:44:51+0900\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Poedit 3.0\n" + +# Front Matter +#: python-ecology-lesson/CODE_OF_CONDUCT.md:1 +msgid "" +"---\n" +"layout: page\n" +"title: \"Contributor Code of Conduct\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/CODE_OF_CONDUCT.md:6 +msgid "" +"As contributors and maintainers of this project,\n" +"we pledge to follow the [Carpentry Code of Conduct][coc]." +msgstr "" + +#: python-ecology-lesson/CODE_OF_CONDUCT.md:9 +msgid "" +"Instances of abusive, harassing, or otherwise unacceptable behavior\n" +"may be reported by following our [reporting guidelines][coc-reporting]." +msgstr "" + +#: python-ecology-lesson/CODE_OF_CONDUCT.md:12 +#: python-ecology-lesson/_episodes/00-before-we-start.md:257 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:481 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:541 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:376 +#: python-ecology-lesson/_episodes/05-merging-data.md:424 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:695 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:596 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:375 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:161 +#: python-ecology-lesson/_extras/figures.md:68 +#: python-ecology-lesson/_extras/guide.md:745 python-ecology-lesson/index.md:38 +msgid "{% include links.md %}" +msgstr "" + +# header +#: python-ecology-lesson/CONTRIBUTING.md:1 +msgid "# Contributing" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:3 +msgid "" +"[The Carpentries][c-site] ([Software Carpentry][swc-site], [Data Carpentry]" +"[dc-site], and [Library Carpentry][lc-site]) are open source projects,\n" +"and we welcome contributions of all kinds:\n" +"new lessons,\n" +"fixes to existing material,\n" +"bug reports,\n" +"and reviews of proposed changes are all welcome." +msgstr "" + +# header +#: python-ecology-lesson/CONTRIBUTING.md:10 +msgid "## Contributor Agreement" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:12 +msgid "" +"By contributing,\n" +"you agree that we may redistribute your work under [our license](LICENSE." +"md).\n" +"In exchange,\n" +"we will address your issues and/or assess your change proposal as promptly " +"as we can,\n" +"and help you become a member of our community.\n" +"Everyone involved in [The Carpentries][c-site]\n" +"agrees to abide by our [code of conduct](CODE_OF_CONDUCT.md)." +msgstr "" + +# header +#: python-ecology-lesson/CONTRIBUTING.md:20 +msgid "## How to Contribute" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:22 +msgid "" +"The easiest way to get started is to file an issue\n" +"to tell us about a spelling mistake,\n" +"some awkward wording,\n" +"or a factual error.\n" +"This is a good way to introduce yourself\n" +"and to meet some of our community members." +msgstr "" + +# ordered list +#: python-ecology-lesson/CONTRIBUTING.md:29 +msgid "1. If you do not have a [GitHub][github] account," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:30 +msgid "" +" you can [send us comments by email][email].\n" +" However,\n" +" we will be able to respond more quickly if you use one of the other " +"methods described below." +msgstr "" + +# ordered list +#: python-ecology-lesson/CONTRIBUTING.md:34 +msgid "2. If you have a [GitHub][github] account," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:35 +msgid "" +" or are willing to [create one][github-join],\n" +" but do not know how to use Git,\n" +" you can report problems or suggest improvements by [creating an issue]" +"[issues].\n" +" This allows us to assign the item to someone\n" +" and to respond to it in a threaded discussion." +msgstr "" + +# ordered list +#: python-ecology-lesson/CONTRIBUTING.md:41 +msgid "3. If you are comfortable with Git," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:42 +msgid "" +" and would like to add or change material,\n" +" you can submit a pull request (PR).\n" +" Instructions for doing this are [included below](#using-github)." +msgstr "" + +# header +#: python-ecology-lesson/CONTRIBUTING.md:46 +msgid "## Where to Contribute" +msgstr "" + +# ordered list +#: python-ecology-lesson/CONTRIBUTING.md:48 +msgid "1. If you wish to change this lesson," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:49 +msgid "" +" please work in ,\n" +" which can be viewed at ." +msgstr "" + +# ordered list +#: python-ecology-lesson/CONTRIBUTING.md:52 +msgid "2. If you wish to change the example lesson," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:53 +msgid "" +" please work in ,\n" +" which documents the format of our lessons\n" +" and can be viewed at ." +msgstr "" + +# ordered list +#: python-ecology-lesson/CONTRIBUTING.md:57 +msgid "3. If you wish to change the template used for workshop websites," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:58 +msgid "" +" please work in .\n" +" The home page of that repository explains how to set up workshop " +"websites,\n" +" while the extra pages in \n" +" provide more background on our design choices." +msgstr "" + +# ordered list +#: python-ecology-lesson/CONTRIBUTING.md:63 +msgid "4. If you wish to change CSS style files, tools," +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:64 +msgid "" +" or HTML boilerplate for lessons or workshops stored in `_includes` or " +"`_layouts`,\n" +" please work in ." +msgstr "" + +# header +#: python-ecology-lesson/CONTRIBUTING.md:67 +msgid "## What to Contribute" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:69 +msgid "" +"There are many ways to contribute,\n" +"from writing new exercises and improving existing ones\n" +"to updating or filling in the documentation\n" +"and submitting [bug reports][issues]\n" +"about things that don't work, aren't clear, or are missing.\n" +"If you are looking for ideas, please see the 'Issues' tab for\n" +"a list of issues associated with this repository,\n" +"or you may also look at the issues for [Data Carpentry][dc-issues],\n" +"[Software Carpentry][swc-issues], and [Library Carpentry][lc-issues] " +"projects." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:79 +msgid "" +"Comments on issues and reviews of pull requests are just as welcome:\n" +"we are smarter together than we are on our own.\n" +"Reviews from novices and newcomers are particularly valuable:\n" +"it's easy for people who have been using these lessons for a while\n" +"to forget how impenetrable some of this material can be,\n" +"so fresh eyes are always welcome." +msgstr "" + +# header +#: python-ecology-lesson/CONTRIBUTING.md:86 +msgid "## What *Not* to Contribute" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:88 +msgid "" +"Our lessons already contain more material than we can cover in a typical " +"workshop,\n" +"so we are usually *not* looking for more concepts or tools to add to them.\n" +"As a rule,\n" +"if you want to introduce a new idea,\n" +"you must (a) estimate how long it will take to teach\n" +"and (b) explain what you would take out to make room for it.\n" +"The first encourages contributors to be honest about requirements;\n" +"the second, to think hard about priorities." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:97 +msgid "" +"We are also not looking for exercises or other material that only run on one " +"platform.\n" +"Our workshops typically contain a mixture of Windows, macOS, and Linux " +"users;\n" +"in order to be usable,\n" +"our lessons must run equally well on all three." +msgstr "" + +# header +#: python-ecology-lesson/CONTRIBUTING.md:102 +msgid "## Using GitHub" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:104 +msgid "" +"If you choose to contribute via GitHub, you may want to look at\n" +"[How to Contribute to an Open Source Project on GitHub][how-contribute].\n" +"To manage changes, we follow [GitHub flow][github-flow].\n" +"Each lesson has two maintainers who review issues and pull requests or " +"encourage others to do so.\n" +"The maintainers are community volunteers and have final say over what gets " +"merged into the lesson.\n" +"To use the web interface for contributing to a lesson:" +msgstr "" + +# ordered list +#: python-ecology-lesson/CONTRIBUTING.md:111 +msgid "1. Fork the originating repository to your GitHub profile." +msgstr "" + +# ordered list +#: python-ecology-lesson/CONTRIBUTING.md:112 +msgid "" +"2. Within your version of the forked repository, move to the `gh-pages` " +"branch and" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:113 +msgid "" +"create a new branch for each significant change being made.\n" +"3. Navigate to the file(s) you wish to change within the new branches and " +"make revisions as required.\n" +"4. Commit all changed files within the appropriate branches.\n" +"5. Create individual pull requests from each of your changed branches\n" +"to the `gh-pages` branch within the originating repository.\n" +"6. If you receive feedback, make changes using your issue-specific branches " +"of the forked\n" +"repository and the pull requests will update automatically.\n" +"7. Repeat as needed until all feedback has been addressed." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:122 +msgid "" +"When starting work, please make sure your clone of the originating `gh-" +"pages` branch is up-to-date\n" +"before creating your own revision-specific branch(es) from there.\n" +"Additionally, please only work from your newly-created branch(es) and *not*\n" +"your clone of the originating `gh-pages` branch.\n" +"Lastly, published copies of all the lessons are available in the `gh-pages` " +"branch of the originating\n" +"repository for reference while revising." +msgstr "" + +# header +#: python-ecology-lesson/CONTRIBUTING.md:129 +msgid "## Other Resources" +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:131 +msgid "" +"General discussion of [Software Carpentry][swc-site] and [Data Carpentry][dc-" +"site]\n" +"happens on the [discussion mailing list][discuss-list],\n" +"which everyone is welcome to join.\n" +"You can also [reach us by email][email]." +msgstr "" + +#: python-ecology-lesson/CONTRIBUTING.md:136 +msgid "" +"[email]: mailto:admin@software-carpentry.org\n" +"[dc-issues]: https://github.com/issues?q=user%3Adatacarpentry\n" +"[dc-lessons]: http://datacarpentry.org/lessons/\n" +"[dc-site]: http://datacarpentry.org/\n" +"[discuss-list]: http://lists.software-carpentry.org/listinfo/discuss\n" +"[github]: https://github.com\n" +"[github-flow]: https://guides.github.com/introduction/flow/\n" +"[github-join]: https://github.com/join\n" +"[how-contribute]: https://egghead.io/series/how-to-contribute-to-an-open-" +"source-project-on-github\n" +"[issues]: https://guides.github.com/features/issues/\n" +"[swc-issues]: https://github.com/issues?q=user%3Aswcarpentry\n" +"[swc-lessons]: https://software-carpentry.org/lessons/\n" +"[swc-site]: https://software-carpentry.org/\n" +"[c-site]: https://carpentries.org/\n" +"[lc-site]: https://librarycarpentry.org/\n" +"[lc-issues]: https://github.com/issues?q=user%3Alibrarycarpentry" +msgstr "" + +# Front Matter +#: python-ecology-lesson/LICENSE.md:1 +msgid "" +"---\n" +"layout: page\n" +"title: \"Licenses\"\n" +"root: .\n" +"---" +msgstr "" + +# header +#: python-ecology-lesson/LICENSE.md:6 +msgid "## Instructional Material" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:8 +msgid "" +"All Software Carpentry, Data Carpentry, and Library Carpentry instructional " +"material is\n" +"made available under the [Creative Commons Attribution\n" +"license][cc-by-human]. The following is a human-readable summary of\n" +"(and not a substitute for) the [full legal text of the CC BY 4.0\n" +"license][cc-by-legal]." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:14 +msgid "You are free:" +msgstr "" + +# unordered list +#: python-ecology-lesson/LICENSE.md:16 +msgid "" +"* to **Share**---copy and redistribute the material in any medium or format" +msgstr "" + +# unordered list +#: python-ecology-lesson/LICENSE.md:17 +msgid "* to **Adapt**---remix, transform, and build upon the material" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:19 +msgid "for any purpose, even commercially." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:21 +msgid "" +"The licensor cannot revoke these freedoms as long as you follow the\n" +"license terms." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:24 +msgid "Under the following terms:" +msgstr "" + +# unordered list +#: python-ecology-lesson/LICENSE.md:26 +msgid "* **Attribution**---You must give appropriate credit (mentioning that" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:27 +msgid "" +" your work is derived from work that is Copyright © Software\n" +" Carpentry and, where practical, linking to\n" +" http://software-carpentry.org/), provide a [link to the\n" +" license][cc-by-human], and indicate if changes were made. You may do\n" +" so in any reasonable manner, but not in any way that suggests the\n" +" licensor endorses you or your use." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:34 +msgid "" +"**No additional restrictions**---You may not apply legal terms or\n" +"technological measures that legally restrict others from doing\n" +"anything the license permits. With the understanding that:" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:38 +msgid "Notices:" +msgstr "" + +# unordered list +#: python-ecology-lesson/LICENSE.md:40 +msgid "* You do not have to comply with the license for elements of the" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:41 +msgid "" +" material in the public domain or where your use is permitted by an\n" +" applicable exception or limitation.\n" +"* No warranties are given. The license may not give you all of the\n" +" permissions necessary for your intended use. For example, other\n" +" rights such as publicity, privacy, or moral rights may limit how you\n" +" use the material." +msgstr "" + +# header +#: python-ecology-lesson/LICENSE.md:48 +msgid "## Software" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:50 +msgid "" +"Except where otherwise noted, the example programs and other software\n" +"provided by Software Carpentry and Data Carpentry are made available under " +"the\n" +"[OSI][osi]-approved\n" +"[MIT license][mit-license]." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:55 +msgid "" +"Permission is hereby granted, free of charge, to any person obtaining\n" +"a copy of this software and associated documentation files (the\n" +"\"Software\"), to deal in the Software without restriction, including\n" +"without limitation the rights to use, copy, modify, merge, publish,\n" +"distribute, sublicense, and/or sell copies of the Software, and to\n" +"permit persons to whom the Software is furnished to do so, subject to\n" +"the following conditions:" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:63 +msgid "" +"The above copyright notice and this permission notice shall be\n" +"included in all copies or substantial portions of the Software." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:66 +msgid "" +"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" +"EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" +"MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" +"NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\n" +"LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n" +"OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\n" +"WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE." +msgstr "" + +# header +#: python-ecology-lesson/LICENSE.md:74 +msgid "## Trademark" +msgstr "" + +#: python-ecology-lesson/LICENSE.md:76 +msgid "" +"\"Software Carpentry\" and \"Data Carpentry\" and their respective logos\n" +"are registered trademarks of [Community Initiatives][CI]." +msgstr "" + +#: python-ecology-lesson/LICENSE.md:79 +msgid "" +"[cc-by-human]: https://creativecommons.org/licenses/by/4.0/\n" +"[cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode\n" +"[mit-license]: https://opensource.org/licenses/mit-license.html\n" +"[ci]: http://communityin.org/\n" +"[osi]: https://opensource.org" +msgstr "" + +#: python-ecology-lesson/README.md:1 +msgid "" +"[![Create a Slack Account with us](https://img.shields.io/badge/" +"Create_Slack_Account-The_Carpentries-071159.svg)](https://swc-slack-invite." +"herokuapp.com/)\n" +"[![Slack Status](https://img.shields.io/badge/Slack_Channel-dc--ecology--py-" +"E01563.svg)](https://swcarpentry.slack.com/messages/C9X44HCDS)" +msgstr "" + +# header +#: python-ecology-lesson/README.md:5 +msgid "## Data Carpentry Python Lessons with Ecological Data" +msgstr "" + +#: python-ecology-lesson/README.md:7 +msgid "" +"This repository contains the Data Carpentry Python material based on " +"ecological\n" +"data. Please see our [contribution guidelines](CONTRIBUTING.md) for " +"information\n" +"on how to contribute updates, bug fixes, or other corrections." +msgstr "" + +# header +#: python-ecology-lesson/README.md:11 +msgid "### Maintainers" +msgstr "" + +# unordered list +#: python-ecology-lesson/README.md:13 +msgid "- April Wright ([@wrightaprilm](https://github.com/wrightaprilm))" +msgstr "" + +# unordered list +#: python-ecology-lesson/README.md:14 +msgid "- Tania Allard ([@trallard](https://github.com/trallard))" +msgstr "" + +# unordered list +#: python-ecology-lesson/README.md:15 +msgid "- Maxim Belkin ([@maxim-belkin](https://github.com/maxim-belkin))" +msgstr "" + +# Front Matter +#: python-ecology-lesson/_episodes/00-before-we-start.md:1 +msgid "" +"---\n" +"title: Before we start\n" +"teaching: 30\n" +"exercises: 0\n" +"questions:\n" +" - \"What is Python and why should I learn it?\"\n" +"objectives:\n" +" - \"Describe the purpose of the editor, console, help, variable explorer " +"and file explorer panes in\n" +" Spyder.\"\n" +" - \"Organize files and directories for a set of analyses as a Python " +"project, and understand the\n" +" purpose of the working directory.\"\n" +" - \"Know where to find help.\"\n" +" - \"Demonstrate how to provide sufficient information for troubleshooting " +"with the Python user\n" +" community.\"\n" +"keypoints:\n" +" - \"Python is an open source and platform independent programming language." +"\"\n" +" - \"SciPy ecosystem for Python provides the tools necessary for scientific " +"computing.\"\n" +" - \"Jupyter Notebook and the Spyder IDE are great tools to code in and " +"interact with Python. With\n" +" the large Python community it is easy to find help in the internet.\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:22 +msgid "" +"
\n" +"## What is Python?\n" +"Python is a general purpose programming language that supports rapid " +"development of data analytics\n" +"applications. The word \"Python\" is used to refer to both, the programming " +"language and the tool\n" +"that executes the scripts written in Python language." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:28 +msgid "Its main advantages are:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:30 +msgid "* Free" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:31 +msgid "* Open-source" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:32 +msgid "* Available on all major platforms (macOS, Linux, Windows)" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:33 +msgid "* Supported by Python Software Foundation" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:34 +msgid "* Supports multiple programming paradigms" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:35 +msgid "* Has large community" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:36 +msgid "* Rich ecosystem of third-party packages" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:38 +msgid "*So, why do you need Python for data analysis?*" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:40 +msgid "- **Easy to learn:**" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:41 +msgid "" +"Python is easier to learn than other programming languages. This is " +"important because lower barriers\n" +"mean it is easier for new members of the community to get up to speed." +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:44 +msgid "- **Reproducibility:**" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:45 +msgid "" +"Reproducibility is the ability to obtain the same results using the same " +"dataset(s) and analysis." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:47 +msgid "" +"Data analysis written as a Python script can be reproduced on any platform. " +"Moreover, if you\n" +"collect more or correct existing data, you can quickly and easily re-run " +"your analysis!" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:50 +msgid "" +"An increasing number of journals and funding agencies expect analyses to be " +"reproducible,\n" +"so knowing Python will give you an edge with these requirements." +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:53 +msgid "- **Versatility:**" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:54 +msgid "" +"Python is a versatile language that integrates with many existing " +"applications to enable something\n" +"completely amazing. For example, one can use Python to generate " +"manuscripts, so that if you need to\n" +"update your data, analysis procedure, or change something else, you can " +"quickly regenerate all the\n" +"figures and your manuscript will be updated automatically." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:59 +msgid "" +"Python can read text files, connect to databases, and many other data " +"formats, on your computer or\n" +"on the web." +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:62 +msgid "- **Interdisciplinary and extensible:**" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:63 +msgid "" +"Python provides a framework that allows anyone to combine approaches from " +"different research\n" +"(but not only) disciplines to best suit your analysis needs." +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:66 +msgid "- **Python has a large and welcoming community:**" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:67 +msgid "" +"Thousands of people use Python daily. Many of them are willing to help you " +"through mailing lists and\n" +"websites, such as [Stack Overflow][stack-overflow] and [Anaconda community\n" +"portal][anaconda-community]." +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:71 +msgid "- **Free and Open-Source Software (FOSS)... and Cross-Platform:**" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:72 +msgid "We know we have already said that but it is worth repeating." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:74 +msgid "" +"
\n" +"## Knowing your way around Anaconda\n" +"[Anaconda][anaconda] distribution of Python includes a lot of its popular " +"packages,\n" +"such as the IPython console, Jupyter Notebook, and Spyder IDE.\n" +"Have a quick look around the Anaconda Navigator. You can launch programs " +"from the Navigator or use the command line." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:80 +msgid "" +"The [Jupyter Notebook](https://jupyter.org) is an open-source web " +"application that allows you to create\n" +"and share documents that allow one to easilty create documents that combine " +"code, graphs, and narrative text.\n" +"[Spyder][spyder-ide] is an **Integrated Development Environment** that\n" +"allows one to write Python scripts and interact with the Python software " +"from within a single interface." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:85 +msgid "" +"Anaconda also comes with a package manager called [conda](https://conda.io/" +"docs/),\n" +"which makes it easy to install and update additional packages." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:88 +msgid "" +"
\n" +"## Research Project: Best Practices\n" +"It is a good idea to keep a set of related data, analyses, and text in a " +"single folder.\n" +"All scripts and text files within this folder can then use relative paths to " +"the data files.\n" +"Working this way makes it a lot easier to move around your project and share " +"it with others." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/00-before-we-start.md:95 +msgid "### Organizing your working directory" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:96 +msgid "" +"Using a consistent folder structure across your projects will help you keep " +"things organized,\n" +"and will also make it easy to find/file things in the future. This can be " +"especially helpful\n" +"when you have multiple projects. In general, you may wish to create separate " +"directories for\n" +"your scripts, data, and documents." +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:101 +msgid "" +"- **`data/`**: Use this folder to store your raw data. For the sake of " +"transparency and provenance," +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:102 +msgid "" +"you should always keep a copy of your **raw data**. If you need to cleanup " +"data, do it\n" +"programmatically (_i.e._ with scripts) and make sure to separate cleaned up " +"data from the raw data.\n" +"For example, you can store raw data in files `./data/raw/` and clean data in " +"`./data/clean/`." +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:106 +msgid "" +"- **`documents/`**: Use this folder to store outlines, drafts, and other " +"text." +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:108 +msgid "" +"- **`scripts/`**: Use this folder to store your (Python) scripts for data " +"cleaning, analysis, and" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:109 +msgid "plotting that you use in this particular project." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:111 +msgid "" +"You may need to create additional directories depending on your project " +"needs, but these should form\n" +"the backbone of your project's directory. For this workshop, we will need a " +"`data/` folder to store\n" +"our raw data, and we will later create a `data_output/` folder when we learn " +"how to export data as\n" +"CSV files." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/00-before-we-start.md:117 +msgid "## What is Programming and Coding?" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:119 +msgid "" +"Programming is the process of writing _\"programs\"_ that a computer can " +"execute and produce some\n" +"(useful) output.\n" +"Programming is a multi-step process that involves the following steps:" +msgstr "" + +# ordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:123 +msgid "" +"1. Identifying the aspects of the real-world problem that can be solved " +"computationally" +msgstr "" + +# ordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:124 +msgid "2. Identifying (the best) computational solution" +msgstr "" + +# ordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:125 +msgid "3. Implementing the solution in a specific computer language" +msgstr "" + +# ordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:126 +msgid "4. Testing, validating, and adjusting implemented solution." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:128 +msgid "" +"While _\"Programming\"_ refers to all of the above steps,\n" +"_\"Coding\"_ refers to step 3 only: _\"Implementing the solution in a " +"specific computer language\"_." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/00-before-we-start.md:131 +msgid "#### If you are working with Jupyter notebook:" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:133 +msgid "" +"You can type Python code into a code cell and then execute the code by " +"pressing\n" +"Shift+Return.\n" +"Output will be printed directly under the input cell.\n" +"You can recognise a code cell by the `In[ ]:` at the beginning of the cell " +"and output by `Out[ ]:`.\n" +"Pressing the __+__ button in the menu bar will add a new cell.\n" +"All your commands as well as any output will be saved with the notebook." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/00-before-we-start.md:140 +msgid "#### If you are working with Spyder:" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:142 +msgid "" +"You can either use the console or use script files (plain text files that " +"contain your code). The\n" +"console pane (in Spyder, the bottom right panel) is the place where commands " +"written in the Python\n" +"language can be typed and executed immediately by the computer. It is also " +"where the results will be\n" +"shown. You can execute commands directly in the console by pressing " +"Return, but they\n" +"will be \"lost\" when you close the session. Spyder uses the [IPython]" +"(http://ipython.org) console by\n" +"default." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:149 +msgid "" +"Since we want our code and workflow to be reproducible, it is better to type " +"the commands in\n" +"the script editor, and save them as a script. This way, there is a complete " +"record of what we did,\n" +"and anyone (including our future selves!) can easily reproduce the results " +"on their computer." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:153 +msgid "" +"Spyder allows you to execute commands directly from the script editor by " +"using the run buttons on\n" +"top. To run the entire script click _Run file_ or press F5, to " +"run the current line\n" +"click _Run selection or current line_ or press F9, other run " +"buttons allow to run script\n" +"cells or go into debug mode. When using F9, the command on the " +"current line in the script\n" +"(indicated by the cursor) or all of the commands in the currently selected " +"text will be sent to the\n" +"console and executed." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:160 +msgid "" +"At some point in your analysis you may want to check the content of a " +"variable or the structure of\n" +"an object, without necessarily keeping a record of it in your script. You " +"can type these commands\n" +"and execute them directly in the console. Spyder provides the\n" +"Ctrl+Shift+E and Ctrl" +"+Shift+I\n" +"shortcuts to allow you to jump between the script and the console panes." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:166 +msgid "" +"If Python is ready to accept commands, the IPython console shows an `In [..]:" +"` prompt with the\n" +"current console line number in `[]`. If it receives a command (by typing, " +"copy-pasting or sent from\n" +"the script editor), Python will execute it, display the results in the `Out " +"[..]:` cell, and come\n" +"back with a new `In [..]:` prompt waiting for new commands." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:171 +msgid "" +"If Python is still waiting for you to enter more data because it isn’t " +"complete yet, the console\n" +"will show a `...:` prompt. It means that you haven’t finished entering a " +"complete command. This can\n" +"be because you have not typed a closing parenthesis (`)`, `]`, or `}`) or " +"quotation mark. When this\n" +"happens, and you thought you finished typing your command, click inside the " +"console window and press\n" +"Esc; this will cancel the incomplete command and return you to " +"the `In [..]:` prompt." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/00-before-we-start.md:177 +msgid "## How to learn more after the workshop?" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:179 +msgid "" +"The material we cover during this workshop will give you an initial taste of " +"how you can use Python\n" +"to analyze data for your own research. However, you will need to learn more " +"to do advanced\n" +"operations such as cleaning your dataset, using statistical methods, or " +"creating beautiful graphics.\n" +"The best way to become proficient and efficient at python, as with any other " +"tool, is to use it to\n" +"address your actual research questions. As a beginner, it can feel daunting " +"to have to write a\n" +"script from scratch, and given that many people make their code available " +"online, modifying existing\n" +"code to suit your purpose might make it easier for you to get started." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/00-before-we-start.md:187 +msgid "## Seeking help" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:189 +msgid "* check under the _Help_ menu" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:190 +msgid "* type `help()`" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:191 +msgid "* type `?object` or `help(object)` to get information about an object" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:192 +msgid "* [Python documentation][python-docs]" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:194 +msgid "" +"Finally, a generic Google or internet search \"Python task\" will often " +"either send you to the\n" +"appropriate module documentation or a helpful forum where someone else has " +"already asked your\n" +"question." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:198 +msgid "" +"I am stuck... I get an error message that I don’t understand.\n" +"Start by googling the error message. However, this doesn’t always work very " +"well, because often,\n" +"package developers rely on the error catching provided by python. You end up " +"with general error\n" +"messages that might not be very helpful to diagnose a problem (e.g. " +"\"subscript out of bounds\"). If\n" +"the message is very generic, you might also include the name of the function " +"or package you’re using\n" +"in your query." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:205 +msgid "" +"However, you should check Stack Overflow. Search using the `python` tag. " +"Most questions have already\n" +"been answered, but the challenge is to use the right words in the search to " +"find the answers:\n" +"" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/00-before-we-start.md:209 +msgid "### Asking for help" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:211 +msgid "" +"The key to receiving help from someone is for them to rapidly grasp your " +"problem. You should make it\n" +"as easy as possible to pinpoint where the issue might be." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:214 +msgid "" +"Try to use the correct words to describe your problem. For instance, a " +"package is not the same thing\n" +"as a library. Most people will understand what you meant, but others have " +"really strong feelings\n" +"about the difference in meaning. The key point is that it can make things " +"confusing for people\n" +"trying to help you. Be as precise as possible when describing your problem." +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:219 +msgid "" +"If possible, try to reduce what doesn’t work to a simple reproducible " +"example. If you can reproduce\n" +"the problem using a very small data frame instead of your 50,000 rows and " +"10,000 columns one,\n" +"provide the small one with the description of your problem. When " +"appropriate, try to generalize what\n" +"you are doing so even people who are not in your field can understand the " +"question. For instance,\n" +"instead of using a subset of your real dataset, create a small (3 columns, 5 " +"rows) generic one." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/00-before-we-start.md:225 +msgid "### Where to ask for help?" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:227 +msgid "" +"* The person sitting next to you during the workshop. Don’t hesitate to talk " +"to your neighbor during" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:228 +msgid "" +"the workshop, compare your answers, and ask for help. You might also be " +"interested in organizing\n" +"regular meetings following the workshop to keep learning from each other.\n" +"* Your friendly colleagues: if you know someone with more experience than " +"you, they might be able and\n" +"willing to help you.\n" +"* [Stack Overflow][so-python]: if your question hasn’t been answered before " +"and is well crafted,\n" +"chances are you will get an answer in less than 5 min. Remember to follow " +"their guidelines on how to\n" +"ask a good question.\n" +"* [Python mailing lists][python-mailing-lists]" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/00-before-we-start.md:237 +msgid "## More resources" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:239 +msgid "- [PyPI - the Python Package Index][pypi]" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:241 +msgid "- [The Hitchhiker's Guide to Python][python-guide]" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/00-before-we-start.md:243 +msgid "- [Dive into Python 3][dive-into-python3]" +msgstr "" + +#: python-ecology-lesson/_episodes/00-before-we-start.md:246 +msgid "" +"[anaconda]: https://www.anaconda.com\n" +"[anaconda-community]: https://www.anaconda.com/community\n" +"[dive-into-python3]: https://finderiko.com/python-book\n" +"[pypi]: https://pypi.python.org/pypi\n" +"[python-docs]: https://www.python.org/doc\n" +"[python-guide]: https://docs.python-guide.org\n" +"[python-mailing-lists]: https://www.python.org/community/lists\n" +"[stack-overflow]: https://stackoverflow.com\n" +"[so-python]: https://stackoverflow.com/questions/tagged/python\n" +"[spyder-ide]: https://www.spyder-ide.org" +msgstr "" + +# Front Matter +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:1 +msgid "" +"---\n" +"title: Short Introduction to Programming in Python\n" +"teaching: 0\n" +"exercises: 0\n" +"questions:\n" +" - \"What is Python?\"\n" +" - \"Why should I learn Python?\"\n" +"objectives:\n" +" - \"Describe the advantages of using programming vs. completing " +"repetitive tasks by hand.\"\n" +" - \"Define the following data types in Python: strings, integers, and " +"floats.\"\n" +" - \"Perform mathematical operations in Python using basic operators.\"\n" +" - \"Define the following as it relates to Python: lists, tuples, and " +"dictionaries.\"\n" +"keypoints:\n" +" - \"Python is an interpreted language which can be used interactively " +"(executing one command at a time) or in scripting mode (executing a series " +"of commands saved in file).\"\n" +" - \"One can assign a value to a variable in Python. Those variables can " +"be of several types, such as string, integer, floating point and complex " +"numbers.\"\n" +" - \"Lists and tuples are similar in that they are ordered lists of " +"elements; they differ in that a tuple is immutable (cannot be changed).\"\n" +" - \"Dictionaries are unordered data structures that provide mappings " +"between keys and values.\"\n" +"---" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:20 +msgid "## Interpreter" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:22 +msgid "Python is an interpreted language which can be used in two ways:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:24 +msgid "" +"* \"Interactively\": when you use it as an \"advanced calculator\" executing" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:25 +msgid "" +" one command at a time. To start Python in this mode, simply execute " +"`python`\n" +" on the command line:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:28 +msgid "" +"~~~\n" +"$ python\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:31 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:69 +#: python-ecology-lesson/_extras/guide.md:27 python-ecology-lesson/setup.md:68 +#: python-ecology-lesson/setup.md:88 python-ecology-lesson/setup.md:98 +#: python-ecology-lesson/setup.md:108 +msgid "{: .language-bash}" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:33 +msgid "" +"~~~\n" +"Python 3.5.1 (default, Oct 23 2015, 18:05:06)\n" +"[GCC 4.8.3] on linux2\n" +"Type \"help\", \"copyright\", \"credits\" or \"license\" for more " +"information.\n" +">>>\n" +"~~~" +msgstr "" + +# SC/DC Template label +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:39 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:52 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:61 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:74 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:100 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:112 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:121 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:130 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:145 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:153 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:181 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:202 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:211 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:219 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:227 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:242 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:251 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:260 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:269 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:287 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:304 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:326 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:341 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:378 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:393 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:404 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:420 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:436 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:450 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:479 +#: python-ecology-lesson/_episodes/02-starting-with-data.md:88 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:291 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:340 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:101 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:115 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:128 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:223 +#: python-ecology-lesson/_episodes/05-merging-data.md:279 +#: python-ecology-lesson/_episodes/05-merging-data.md:358 +#: python-ecology-lesson/_episodes/05-merging-data.md:381 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:47 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:62 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:81 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:91 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:138 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:190 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:204 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:242 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:350 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:360 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:516 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:554 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:608 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:659 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:94 +#: python-ecology-lesson/_extras/guide.md:61 +#: python-ecology-lesson/_extras/guide.md:71 +#: python-ecology-lesson/_extras/guide.md:614 +msgid "{: .output}" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:41 +msgid "" +"Chevrons `>>>` indicate an interactive prompt in Python, meaning that it is " +"waiting for your\n" +"input." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:44 +msgid "" +"~~~\n" +"2 + 2\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:47 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:87 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:197 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:297 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:321 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:357 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:429 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:53 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:76 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:85 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:103 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:124 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:169 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:182 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:200 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:219 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:230 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:262 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:281 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:309 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:326 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:333 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:372 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:392 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:399 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:406 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:465 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:487 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:501 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:510 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:522 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:89 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:96 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:110 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:123 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:137 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:175 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:188 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:205 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:218 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:280 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:290 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:300 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:308 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:344 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:359 +#: python-ecology-lesson/_episodes/05-merging-data.md:68 +#: python-ecology-lesson/_episodes/05-merging-data.md:91 +#: python-ecology-lesson/_episodes/05-merging-data.md:109 +#: python-ecology-lesson/_episodes/05-merging-data.md:128 +#: python-ecology-lesson/_episodes/05-merging-data.md:138 +#: python-ecology-lesson/_episodes/05-merging-data.md:194 +#: python-ecology-lesson/_episodes/05-merging-data.md:221 +#: python-ecology-lesson/_episodes/05-merging-data.md:256 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:42 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:53 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:77 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:86 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:120 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:159 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:259 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:271 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:333 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:345 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:355 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:395 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:406 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:411 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:437 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:454 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:510 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:601 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:52 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:87 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:104 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:120 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:163 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:175 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:188 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:203 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:220 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:235 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:253 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:292 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:307 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:357 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:367 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:380 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:394 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:415 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:444 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:525 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:542 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:560 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:588 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:57 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:78 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:107 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:116 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:159 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:166 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:186 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:210 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:241 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:263 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:336 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:54 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:82 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:103 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:150 +#: python-ecology-lesson/_extras/guide.md:66 +#: python-ecology-lesson/_extras/guide.md:132 +#: python-ecology-lesson/_extras/guide.md:139 +#: python-ecology-lesson/_extras/guide.md:155 +#: python-ecology-lesson/_extras/guide.md:247 +#: python-ecology-lesson/_extras/guide.md:317 +#: python-ecology-lesson/_extras/guide.md:357 +#: python-ecology-lesson/_extras/guide.md:411 +#: python-ecology-lesson/_extras/guide.md:430 +#: python-ecology-lesson/_extras/guide.md:444 +#: python-ecology-lesson/_extras/guide.md:462 +#: python-ecology-lesson/_extras/guide.md:470 +#: python-ecology-lesson/_extras/guide.md:491 +#: python-ecology-lesson/_extras/guide.md:505 +#: python-ecology-lesson/_extras/guide.md:524 +#: python-ecology-lesson/_extras/guide.md:627 +#: python-ecology-lesson/_extras/guide.md:658 +#: python-ecology-lesson/_extras/guide.md:672 +#: python-ecology-lesson/_extras/guide.md:699 +#: python-ecology-lesson/_extras/guide.md:732 +msgid "{: .language-python}" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:49 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:199 +msgid "" +"~~~\n" +"4\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:54 +msgid "" +"~~~\n" +"print(\"Hello World\")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:57 +msgid "" +"{: .language-python}\n" +"~~~\n" +"Hello World\n" +"~~~" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:63 +msgid "" +"* \"Scripting\" Mode: executing a series of \"commands\" saved in text file," +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:64 +msgid " usually with a `.py` extension after the name of your file:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:66 +msgid "" +"~~~\n" +"$ python my_script.py\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:71 +msgid "" +"~~~\n" +"Hello World\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:76 +msgid "## Introduction to Python built-in data types" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:78 +msgid "### Strings, integers, and floats" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:80 +msgid "" +"One of the most basic things we can do in Python is assign values to " +"variables:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:82 +msgid "" +"~~~\n" +"text = \"Data Carpentry\" # An example of a string\n" +"number = 42 # An example of an integer\n" +"pi_value = 3.1415 # An example of a float\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:89 +msgid "" +"Here we've assigned data to the variables `text`, `number` and `pi_value`,\n" +"using the assignment operator `=`. To review the value of a variable, we\n" +"can type the name of the variable into the interpreter and press " +"Return:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:93 +msgid "" +"~~~\n" +"text\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:96 +msgid "" +"{: .language-python}\n" +"~~~\n" +"\"Data Carpentry\"\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:102 +msgid "" +"Everything in Python has a type. To get the type of something, we can pass " +"it\n" +"to the built-in function `type`:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:105 +msgid "" +"~~~\n" +"type(text)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:108 +msgid "" +"{: .language-python}\n" +"~~~\n" +"\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:114 +msgid "" +"~~~\n" +"type(number)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:117 +msgid "" +"{: .language-python}\n" +"~~~\n" +"\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:123 +msgid "" +"~~~\n" +"type(pi_value)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:126 +msgid "" +"{: .language-python}\n" +"~~~\n" +"\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:132 +msgid "" +"The variable `text` is of type `str`, short for \"string\". Strings hold\n" +"sequences of characters, which can be letters, numbers, punctuation\n" +"or more exotic forms of text (even emoji!)." +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:136 +msgid "" +"We can also see the value of something using another built-in function, " +"`print`:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:138 +msgid "" +"~~~\n" +"print(text)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:141 +msgid "" +"{: .language-python}\n" +"~~~\n" +"Data Carpentry\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:146 +msgid "" +"~~~\n" +"print(number)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:149 +msgid "" +"{: .language-python}\n" +"~~~\n" +"11\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:155 +msgid "" +"This may seem redundant, but in fact it's the only way to display output in " +"a script:" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:157 +msgid "" +"*example.py*\n" +"~~~\n" +"# A Python script file\n" +"# Comments in Python start with #\n" +"# The next line assigns the string \"Data Carpentry\" to the variable \"text" +"\".\n" +"text = \"Data Carpentry\"" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:164 +msgid "# The next line does nothing!" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:165 +msgid "text" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:167 +msgid "" +"# The next line uses the print function to print out the value we assigned " +"to \"text\"" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:168 +msgid "" +"print(text)\n" +"~~~\n" +"{: .language-python}" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:172 +msgid "" +"*Running the script*\n" +"~~~\n" +"$ python example.py\n" +"~~~\n" +"{: .language-bash}" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:178 +msgid "" +"~~~\n" +"Data Carpentry\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:183 +msgid "Notice that \"Data Carpentry\" is printed only once." +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:185 +msgid "" +"**Tip**: `print` and `type` are built-in functions in Python. Later in this\n" +"lesson, we will introduce methods and user-defined functions. The Python\n" +"documentation is excellent for reference on the differences between them." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:189 +msgid "### Operators" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:191 +msgid "" +"We can perform mathematical calculations in Python using the basic " +"operators\n" +" `+, -, /, *, %`:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:194 +msgid "" +"~~~\n" +"2 + 2 # Addition\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:204 +msgid "" +"~~~\n" +"6 * 7 # Multiplication\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:207 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:475 +msgid "" +"{: .language-python}\n" +"~~~\n" +"42\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:212 +msgid "" +"~~~\n" +"2 ** 16 # Power\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:215 +msgid "" +"{: .language-python}\n" +"~~~\n" +"65536\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:220 +msgid "" +"~~~\n" +"13 % 5 # Modulo\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:223 +msgid "" +"{: .language-python}\n" +"~~~\n" +"3\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:229 +msgid "" +"We can also use comparison and logic operators:\n" +"`<, >, ==, !=, <=, >=` and statements of identity such as\n" +"`and, or, not`. The data type returned by this is\n" +"called a _boolean_." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:235 +msgid "" +"~~~\n" +"3 > 4\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:238 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:265 +msgid "" +"{: .language-python}\n" +"~~~\n" +"False\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:244 +msgid "" +"~~~\n" +"True and True\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:247 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:256 +msgid "" +"{: .language-python}\n" +"~~~\n" +"True\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:253 +msgid "" +"~~~\n" +"True or False\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:262 +msgid "" +"~~~\n" +"True and False\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:271 +msgid "## Sequences: Lists and Tuples" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:273 +msgid "### Lists" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:275 +msgid "" +"**Lists** are a common data structure to hold an ordered sequence of\n" +"elements. Each element can be accessed by an index. Note that Python\n" +"indexes start with 0 instead of 1:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:279 +msgid "" +"~~~\n" +"numbers = [1, 2, 3]\n" +"numbers[0]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:283 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:374 +msgid "" +"{: .language-python}\n" +"~~~\n" +"1\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:289 +msgid "" +"A `for` loop can be used to access the elements in a list or other Python " +"data\n" +"structure one at a time:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:292 +msgid "" +"~~~\n" +">>> for num in numbers:\n" +"... print(num)\n" +"...\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:299 +msgid "" +"~~~\n" +"1\n" +"2\n" +"3\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:306 +msgid "" +"**Indentation** is very important in Python. Note that the second line in " +"the\n" +"example above is indented. Just like three chevrons `>>>` indicate an\n" +"interactive prompt in Python, the three dots `...` are Python's prompt for\n" +"multiple lines. This is Python's way of marking a block of code. [Note: you\n" +"do not type `>>>` or `...`.]" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:312 +msgid "" +"To add elements to the end of a list, we can use the `append` method. " +"Methods\n" +"are a way to interact with an object (a list, for example). We can invoke a\n" +"method using the dot `.` followed by the method name and a list of " +"arguments\n" +"in parentheses. Let's look at an example using `append`:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:317 +msgid "" +"~~~\n" +"numbers.append(4)\n" +"print(numbers)\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:323 +msgid "" +"~~~\n" +"[1, 2, 3, 4]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:328 +msgid "" +"To find out what methods are available for an\n" +"object, we can use the built-in `help` command:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:331 +msgid "" +"~~~\n" +"help(numbers)\n" +"\n" +"Help on list object:\n" +"\n" +"class list(object)\n" +" | list() -> new empty list\n" +" | list(iterable) -> new list initialized from iterable's items\n" +" ...\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:343 +msgid "### Tuples" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:345 +msgid "" +"A tuple is similar to a list in that it's an ordered sequence of elements.\n" +"However, tuples can not be changed once created (they are \"immutable\"). " +"Tuples\n" +"are created by placing comma-separated values inside parentheses `()`." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:349 +msgid "" +"~~~\n" +"# Tuples use parentheses\n" +"a_tuple = (1, 2, 3)\n" +"another_tuple = ('blue', 'green', 'red')\n" +"\n" +"# Note: lists use square brackets\n" +"a_list = [1, 2, 3]\n" +"~~~" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:359 +msgid "> ## Tuples _vs._ Lists" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:360 +msgid "> 1. What happens when you execute `a_list[1] = 5`?" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:361 +msgid "> 2. What happens when you execute `a_tuple[2] = 5`?" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:362 +msgid "> 3. What does `type(a_tuple)` tell you about `a_tuple`?" +msgstr "" + +# SC/DC Template label +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:363 +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:458 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:154 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:361 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:444 +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:539 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:236 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:324 +#: python-ecology-lesson/_episodes/05-merging-data.md:146 +#: python-ecology-lesson/_episodes/05-merging-data.md:408 +#: python-ecology-lesson/_episodes/05-merging-data.md:422 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:104 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:298 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:372 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:480 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:575 +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:693 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:141 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:276 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:345 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:486 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:506 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:573 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:218 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:327 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:357 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:373 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:124 +#: python-ecology-lesson/_episodes/09-working-with-sql.md:159 +#: python-ecology-lesson/_extras/extra_challenges.md:46 +msgid "{: .challenge}" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:366 +msgid "## Dictionaries" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:368 +msgid "" +"A **dictionary** is a container that holds pairs of objects - keys and " +"values." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:370 +msgid "" +"~~~\n" +"translation = {'one': 1, 'two': 2}\n" +"translation['one']\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:380 +msgid "" +"Dictionaries work a lot like lists - except that you index them with " +"*keys*.\n" +"You can think about a key as a name for or a unique identifier for a set of " +"values\n" +"in the dictionary. Keys can only have particular types - they have to be\n" +"\"hashable\". Strings and numeric types are acceptable, but lists aren't." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:385 +msgid "" +"~~~\n" +"rev = {1: 'one', 2: 'two'}\n" +"rev[1]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:389 +msgid "" +"{: .language-python}\n" +"~~~\n" +"'one'\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:395 +msgid "" +"~~~\n" +"bad = {[1, 2, 3]: 3}\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:398 +msgid "" +"{: .language-python}\n" +"~~~\n" +"Traceback (most recent call last):\n" +" File \"\", line 1, in \n" +"TypeError: unhashable type: 'list'\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:406 +msgid "" +"In Python, a \"Traceback\" is an multi-line error block printed out for the\n" +"user." +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:409 +msgid "To add an item to the dictionary we assign a value to a new key:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:411 +msgid "" +"~~~\n" +"rev = {1: 'one', 2: 'two'}\n" +"rev[3] = 'three'\n" +"rev\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:416 +#: python-ecology-lesson/_extras/guide.md:57 +msgid "" +"{: .language-python}\n" +"~~~\n" +"{1: 'one', 2: 'two', 3: 'three'}\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:422 +msgid "" +"Using `for` loops with dictionaries is a little more complicated. We can do\n" +"this in two ways:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:425 +msgid "" +"~~~\n" +"for key, value in rev.items():\n" +" print(key, '->', value)\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:431 +msgid "" +"~~~\n" +"1 -> one\n" +"2 -> two\n" +"3 -> three\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:438 +msgid "or" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:440 +msgid "" +"~~~\n" +"for key in rev.keys():\n" +" print(key, '->', rev[key])\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:444 +msgid "" +"{: .language-python}\n" +"~~~\n" +"1 -> one\n" +"2 -> two\n" +"3 -> three\n" +"~~~" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:452 +msgid "> ## Changing dictionaries" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:453 +msgid "" +">\n" +"> 1. First, print the value of the `rev` dictionary to the screen.\n" +"> 2. Reassign the value that corresponds to the key `2` so that it no " +"longer\n" +"> reads \"two\" but instead \"apple-sauce\".\n" +"> 3. Print the value of `rev` to the screen again to see if the value has " +"changed." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:461 +msgid "## Functions" +msgstr "" + +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:463 +msgid "" +"Defining a section of code as a function in Python is done using the `def`\n" +"keyword. For example a function that takes two arguments and returns their " +"sum\n" +"can be defined as:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/01-short-introduction-to-Python.md:467 +msgid "" +"~~~\n" +"def add_function(a, b):\n" +" result = a + b\n" +" return result\n" +"\n" +"z = add_function(20, 22)\n" +"print(z)\n" +"~~~" +msgstr "" + +# Front Matter +#: python-ecology-lesson/_episodes/02-starting-with-data.md:1 +msgid "" +"---\n" +"title: Starting With Data\n" +"teaching: 30\n" +"exercises: 30\n" +"questions:\n" +" - \"How can I import data in Python?\"\n" +" - \"What is Pandas?\"\n" +" - \"Why should I use Pandas to work with data?\"\n" +"objectives:\n" +" - \"Navigate the workshop directory and download a dataset.\"\n" +" - \"Explain what a library is and what libraries are used for.\"\n" +" - \"Describe what the Python Data Analysis Library (Pandas) is.\"\n" +" - \"Load the Python Data Analysis Library (Pandas).\"\n" +" - \"Use `read_csv` to read tabular data into Python.\"\n" +" - \"Describe what a DataFrame is in Python.\"\n" +" - \"Access and summarize data stored in a DataFrame.\"\n" +" - \"Define indexing as it relates to data structures.\"\n" +" - \"Perform basic mathematical operations and summary statistics on data " +"in a Pandas DataFrame.\"\n" +" - \"Create simple plots.\"\n" +"keypoints:\n" +" - \"Libraries enable us to extend the functionality of Python.\" \n" +" - \"Pandas is a popular library for working with data.\"\n" +" - \"A Dataframe is a Pandas data structure that allows one to access " +"data by column (name or index) or row.\"\n" +" - \"Aggregating data using the `groupby()` function enables you to " +"generate useful summaries of data quickly.\"\n" +" - \"Plots can be created from DataFrames or subsets of data that have " +"been generated with `groupby()`.\"\n" +"---" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/02-starting-with-data.md:28 +msgid "# Working With Pandas DataFrames in Python" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:30 +msgid "" +"We can automate the process of performing data manipulations in Python. It's " +"efficient to spend time\n" +"building the code to perform these tasks because once it's built, we can use " +"it\n" +"over and over on different datasets that use a similar format. This makes " +"our\n" +"methods easily reproducible. We can also easily share our code with " +"colleagues\n" +"and they can replicate the same analysis." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/02-starting-with-data.md:36 +msgid "### Starting in the same spot" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:38 +msgid "" +"To help the lesson run smoothly, let's ensure everyone is in the same " +"directory.\n" +"This should help us avoid path and file name issues. At this time please\n" +"navigate to the workshop directory. If you working in IPython Notebook be " +"sure\n" +"that you start your notebook in the workshop directory." +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:43 +msgid "" +"A quick aside that there are Python libraries like [OS Library][os-lib] that " +"can work with our\n" +"directory structure, however, that is not our focus today." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/02-starting-with-data.md:46 +msgid "### Our Data" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:48 +msgid "" +"For this lesson, we will be using the Portal Teaching data, a subset of the " +"data\n" +"from Ernst et al\n" +"[Long-term monitoring and experimental manipulation of a Chihuahuan Desert " +"ecosystem near Portal,\n" +"Arizona, USA][ernst]." +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:53 +msgid "" +"We will be using files from the [Portal Project Teaching Database][pptd].\n" +"This section will use the `surveys.csv` file that can be downloaded here:\n" +"[https://ndownloader.figshare.com/files/2292172][figshare-ndownloader]" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:57 +msgid "" +"We are studying the species and weight of animals caught in sites in our " +"study\n" +"area. The dataset is stored as a `.csv` file: each row holds information for " +"a\n" +"single animal, and the columns represent:" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:61 +msgid "" +"| Column | Description |\n" +"|------------------|------------------------------------|\n" +"| record_id | Unique id for the observation |\n" +"| month | month of observation |\n" +"| day | day of observation |\n" +"| year | year of observation |\n" +"| plot_id | ID of a particular site |\n" +"| species_id | 2-letter code |\n" +"| sex | sex of animal (\"M\", \"F\") |\n" +"| hindfoot_length | length of the hindfoot in mm |\n" +"| weight | weight of the animal in grams |" +msgstr "" + +#: python-ecology-lesson/_episodes/02-starting-with-data.md:74 +msgid "The first few rows of our first file look like this:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/02-starting-with-data.md:76 +msgid "" +"~~~\n" +"record_id,month,day,year,plot_id,species_id,sex,hindfoot_length,weight\n" +"1,7,16,1977,2,NL,M,32,\n" +"2,7,16,1977,3,NL,M,33,\n" +"3,7,16,1977,2,DM,F,37,\n" +"4,7,16,1977,7,DM,M,36,\n" +"5,7,16,1977,3,DM,M,35,\n" +"6,7,16,1977,1,PF,M,14,\n" +"7,7,16,1977,2,PE,F,,\n" +"8,7,16,1977,1,DM,M,37,\n" +"9,7,16,1977,1,DM,F,34,\n" +"~~~" +msgstr "" + +# Front Matter +#: python-ecology-lesson/_episodes/02-starting-with-data.md:90 +msgid "" +"---\n" +"\n" +"## About Libraries\n" +"A library in Python contains a set of tools (called functions) that perform\n" +"tasks on our data. Importing a library is like getting a piece of lab " +"equipment\n" +"out of a storage locker and setting it up on the bench for use in a " +"project.\n" +"Once a library is set up, it can be used or called to perform many tasks.\n" +"\n" +"## Pandas in Python\n" +"One of the best options for working with tabular data in Python is to use " +"the\n" +"[Python Data Analysis Library][pandas] (a.k.a. Pandas). The\n" +"Pandas library provides data structures, produces high quality plots with\n" +"[matplotlib][matplotlib] and integrates nicely with other libraries\n" +"that use [NumPy][numpy] (which is another Python library) arrays.\n" +"\n" +"Python doesn't load all of the libraries available to it by default. We have " +"to\n" +"add an `import` statement to our code in order to use library functions. To " +"import\n" +"a library, we use the syntax `import libraryName`. If we want to give the\n" +"library a nickname to shorten the command, we can add `as nickNameHere`. " +"An\n" +"example of importing the pandas library using the common nickname `pd` is " +"below.\n" +"\n" +"\n" +"~~~\n" +"import pandas as pd\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"Each time we call a function that's in a library, we use the syntax\n" +"`LibraryName.FunctionName`. Adding the library name with a `.` before the\n" +"function name tells Python where to find the function. In the example above, " +"we\n" +"have imported Pandas as `pd`. This means we don't have to type out `pandas` " +"each\n" +"time we call a Pandas function.\n" +"\n" +"\n" +"# Reading CSV Data Using Pandas\n" +"\n" +"We will begin by locating and reading our survey data which are in CSV " +"format. CSV stands for\n" +"Comma-Separated Values and is a common way store formatted data. Other " +"symbols may also be used, so\n" +"you might see tab-separated, colon-separated or space separated files. It is " +"quite easy to replace\n" +"one separator with another, to match your application. The first line in the " +"file often has headers\n" +"to explain what is in each column. CSV (and other separators) make it easy " +"to share data, and can be\n" +"imported and exported from many applications, including Microsoft Excel. For " +"more details on CSV\n" +"files, see the [Data Organisation in Spreadsheets][spreadsheet-lesson5] " +"lesson.\n" +"We can use Pandas' `read_csv` function to pull the file directly into a " +"[DataFrame][pd-dataframe].\n" +"\n" +"## So What's a DataFrame?\n" +"\n" +"A DataFrame is a 2-dimensional data structure that can store data of " +"different\n" +"types (including characters, integers, floating point values, factors and " +"more)\n" +"in columns. It is similar to a spreadsheet or an SQL table or the `data." +"frame` in\n" +"R. A DataFrame always has an index (0-based). An index refers to the " +"position of\n" +"an element in the data structure.\n" +"\n" +"~~~\n" +"# Note that pd.read_csv is used because we imported pandas as pd\n" +"pd.read_csv(\"data/surveys.csv\")\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"The above command yields the **output** below:\n" +"\n" +"~~~\n" +"record_id month day year plot_id species_id sex hindfoot_length " +"weight\n" +"0 1 7 16 1977 2 NL M 32 " +"NaN\n" +"1 2 7 16 1977 3 NL M 33 " +"NaN\n" +"2 3 7 16 1977 2 DM F 37 " +"NaN\n" +"3 4 7 16 1977 7 DM M 36 " +"NaN\n" +"4 5 7 16 1977 3 DM M 35 " +"NaN\n" +"...\n" +"35544 35545 12 31 2002 15 AH NaN NaN " +"NaN\n" +"35545 35546 12 31 2002 15 AH NaN NaN " +"NaN\n" +"35546 35547 12 31 2002 10 RM F 15 " +"14\n" +"35547 35548 12 31 2002 7 DO M 36 " +"51\n" +"35548 35549 12 31 2002 5 NaN NaN NaN " +"NaN\n" +"\n" +"[35549 rows x 9 columns]\n" +"~~~\n" +"{: .output}\n" +"\n" +"We can see that there were 35,549 rows parsed. Each row has 9\n" +"columns. The first column is the index of the DataFrame. The index is used " +"to\n" +"identify the position of the data, but it is not an actual column of the " +"DataFrame.\n" +"It looks like the `read_csv` function in Pandas read our file properly. " +"However,\n" +"we haven't saved any data to memory so we can work with it. We need to " +"assign the\n" +"DataFrame to a variable. Remember that a variable is a name for a value, " +"such as `x`,\n" +"or `data`. We can create a new object with a variable name by assigning a " +"value to it using `=`.\n" +"\n" +"Let's call the imported survey data `surveys_df`:\n" +"\n" +"~~~\n" +"surveys_df = pd.read_csv(\"data/surveys.csv\")\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"Notice when you assign the imported DataFrame to a variable, Python does " +"not\n" +"produce any output on the screen. We can view the value of the `surveys_df`\n" +"object by typing its name into the Python command prompt.\n" +"\n" +"~~~\n" +"surveys_df\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"which prints contents like above.\n" +"\n" +"Note: if the output is too wide to print on your narrow terminal window, you " +"may see something\n" +"slightly different as the large set of data scrolls past. You may see simply " +"the last column\n" +"of data:\n" +"~~~\n" +"17 NaN\n" +"18 NaN\n" +"19 NaN\n" +"20 NaN\n" +"21 NaN\n" +"22 NaN\n" +"23 NaN\n" +"24 NaN\n" +"25 NaN\n" +"26 NaN\n" +"27 NaN\n" +"28 NaN\n" +"29 NaN\n" +"... ...\n" +"35519 36.0\n" +"35520 48.0\n" +"35521 45.0\n" +"35522 44.0\n" +"35523 27.0\n" +"35524 26.0\n" +"35525 24.0\n" +"35526 43.0\n" +"35527 NaN\n" +"35528 25.0\n" +"35529 NaN\n" +"35530 NaN\n" +"35531 43.0\n" +"35532 48.0\n" +"35533 56.0\n" +"35534 53.0\n" +"35535 42.0\n" +"35536 46.0\n" +"35537 31.0\n" +"35538 68.0\n" +"35539 23.0\n" +"35540 31.0\n" +"35541 29.0\n" +"35542 34.0\n" +"35543 NaN\n" +"35544 NaN\n" +"35545 NaN\n" +"35546 14.0\n" +"35547 51.0\n" +"35548 NaN\n" +"\n" +"[35549 rows x 9 columns]\n" +"~~~\n" +"{: .output}\n" +"\n" +"Never fear, all the data is there, if you scroll up. Selecting just a few " +"rows, so it is\n" +"easier to fit on one window, you can see that pandas has neatly formatted " +"the data to fit\n" +"our screen:\n" +"\n" +"~~~\n" +"surveys_df.head() # The head() method displays the first several lines of a " +"file. It\n" +" # is discussed below.\n" +"~~~\n" +"{: .language-python}\n" +"~~~\n" +" record_id month day year plot_id species_id sex hindfoot_length \\\n" +"5 6 7 16 1977 1 PF M 14.0\n" +"6 7 7 16 1977 2 PE F NaN\n" +"7 8 7 16 1977 1 DM M 37.0\n" +"8 9 7 16 1977 1 DM F 34.0\n" +"9 10 7 16 1977 6 PF F 20.0\n" +"\n" +" weight\n" +"5 NaN\n" +"6 NaN\n" +"7 NaN\n" +"8 NaN\n" +"9 NaN\n" +"~~~\n" +"{: .output}\n" +"\n" +"## Exploring Our Species Survey Data\n" +"\n" +"Again, we can use the `type` function to see what kind of thing `surveys_df` " +"is:\n" +"\n" +"~~~\n" +"type(surveys_df)\n" +"~~~\n" +"{: .language-python}\n" +"~~~\n" +"\n" +"~~~\n" +"{: .output}\n" +"\n" +"As expected, it's a DataFrame (or, to use the full name that Python uses to " +"refer\n" +"to it internally, a `pandas.core.frame.DataFrame`).\n" +"\n" +"What kind of things does `surveys_df` contain? DataFrames have an attribute\n" +"called `dtypes` that answers this:\n" +"\n" +"~~~\n" +"surveys_df.dtypes\n" +"~~~\n" +"{: .language-python}\n" +"~~~\n" +"record_id int64\n" +"month int64\n" +"day int64\n" +"year int64\n" +"plot_id int64\n" +"species_id object\n" +"sex object\n" +"hindfoot_length float64\n" +"weight float64\n" +"dtype: object\n" +"~~~\n" +"{: .output}\n" +"\n" +"All the values in a column have the same type. For example, months have " +"type\n" +"`int64`, which is a kind of integer. Cells in the month column cannot have\n" +"fractional values, but the weight and hindfoot_length columns can, because " +"they\n" +"have type `float64`. The `object` type doesn't have a very helpful name, but " +"in\n" +"this case it represents strings (such as 'M' and 'F' in the case of sex).\n" +"\n" +"We'll talk a bit more about what the different formats mean in a different " +"lesson.\n" +"\n" +"### Useful Ways to View DataFrame objects in Python\n" +"\n" +"There are many ways to summarize and access the data stored in DataFrames,\n" +"using attributes and methods provided by the DataFrame object.\n" +"\n" +"To access an attribute, use the DataFrame object name followed by the " +"attribute\n" +"name `df_object.attribute`. Using the DataFrame `surveys_df` and attribute\n" +"`columns`, an index of all the column names in the DataFrame can be " +"accessed\n" +"with `surveys_df.columns`.\n" +"\n" +"Methods are called in a similar fashion using the syntax `df_object." +"method()`.\n" +"As an example, `surveys_df.head()` gets the first few rows in the DataFrame\n" +"`surveys_df` using **the `head()` method**. With a method, we can supply " +"extra\n" +"information in the parens to control behaviour.\n" +"\n" +"Let's look at the data using these.\n" +"\n" +"> ## Challenge - DataFrames\n" +">\n" +"> Using our DataFrame `surveys_df`, try out the attributes & methods below " +"to see\n" +"> what they return.\n" +">\n" +"> 1. `surveys_df.columns`\n" +"> 2. `surveys_df.shape` Take note of the output of `shape` - what format " +"does it\n" +"> return the shape of the DataFrame in?\n" +">\n" +"> HINT: [More on tuples, here][python-datastructures].\n" +"> 3. `surveys_df.head()` Also, what does `surveys_df.head(15)` do?\n" +"> 4. `surveys_df.tail()`\n" +"{: .challenge}\n" +"\n" +"\n" +"## Calculating Statistics From Data In A Pandas DataFrame\n" +"\n" +"We've read our data into Python. Next, let's perform some quick summary\n" +"statistics to learn more about the data that we're working with. We might " +"want\n" +"to know how many animals were collected in each site, or how many of each\n" +"species were caught. We can perform summary stats quickly using groups. But\n" +"first we need to figure out what we want to group by.\n" +"\n" +"Let's begin by exploring our data:\n" +"\n" +"~~~\n" +"# Look at the column names\n" +"surveys_df.columns\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"which **returns**:\n" +"\n" +"~~~\n" +"Index(['record_id', 'month', 'day', 'year', 'plot_id', 'species_id', 'sex',\n" +" 'hindfoot_length', 'weight'],\n" +" dtype='object')\n" +"~~~\n" +"{: .output}\n" +"\n" +"Let's get a list of all the species. The `pd.unique` function tells us all " +"of\n" +"the unique values in the `species_id` column.\n" +"\n" +"~~~\n" +"pd.unique(surveys_df['species_id'])\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"which **returns**:\n" +"\n" +"~~~\n" +"array(['NL', 'DM', 'PF', 'PE', 'DS', 'PP', 'SH', 'OT', 'DO', 'OX', 'SS',\n" +" 'OL', 'RM', nan, 'SA', 'PM', 'AH', 'DX', 'AB', 'CB', 'CM', 'CQ',\n" +" 'RF', 'PC', 'PG', 'PH', 'PU', 'CV', 'UR', 'UP', 'ZL', 'UL', 'CS',\n" +" 'SC', 'BA', 'SF', 'RO', 'AS', 'SO', 'PI', 'ST', 'CU', 'SU', 'RX',\n" +" 'PB', 'PL', 'PX', 'CT', 'US'], dtype=object)\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"> ## Challenge - Statistics\n" +">\n" +"> 1. Create a list of unique site ID's (\"plot_id\") found in the surveys " +"data. Call it\n" +"> `site_names`. How many unique sites are there in the data? How many " +"unique\n" +"> species are in the data?\n" +">\n" +"> 2. What is the difference between `len(site_names)` and " +"`surveys_df['plot_id'].nunique()`?\n" +"{: .challenge}\n" +"\n" +"# Groups in Pandas\n" +"\n" +"We often want to calculate summary statistics grouped by subsets or " +"attributes\n" +"within fields of our data. For example, we might want to calculate the " +"average\n" +"weight of all individuals per site.\n" +"\n" +"We can calculate basic statistics for all records in a single column using " +"the\n" +"syntax below:\n" +"\n" +"~~~\n" +"surveys_df['weight'].describe()\n" +"~~~\n" +"{: .language-python}\n" +"gives **output**\n" +"\n" +"~~~\n" +"count 32283.000000\n" +"mean 42.672428\n" +"std 36.631259\n" +"min 4.000000\n" +"25% 20.000000\n" +"50% 37.000000\n" +"75% 48.000000\n" +"max 280.000000\n" +"Name: weight, dtype: float64\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"We can also extract one specific metric if we wish:\n" +"\n" +"~~~\n" +"surveys_df['weight'].min()\n" +"surveys_df['weight'].max()\n" +"surveys_df['weight'].mean()\n" +"surveys_df['weight'].std()\n" +"surveys_df['weight'].count()\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"But if we want to summarize by one or more variables, for example sex, we " +"can\n" +"use **Pandas' `.groupby` method**. Once we've created a groupby DataFrame, " +"we\n" +"can quickly calculate summary statistics by a group of our choice.\n" +"\n" +"~~~\n" +"# Group data by sex\n" +"grouped_data = surveys_df.groupby('sex')\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"The **pandas function `describe`** will return descriptive stats including: " +"mean,\n" +"median, max, min, std and count for a particular column in the data. " +"Pandas'\n" +"`describe` function will only return summary values for columns containing\n" +"numeric data.\n" +"\n" +"~~~\n" +"# Summary statistics for all numeric columns by sex\n" +"grouped_data.describe()\n" +"# Provide the mean for each numeric column by sex\n" +"grouped_data.mean()\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"`grouped_data.mean()` **OUTPUT:**\n" +"\n" +"~~~\n" +" record_id month day year plot_id \\\n" +"sex\n" +"F 18036.412046 6.583047 16.007138 1990.644997 11.440854\n" +"M 17754.835601 6.392668 16.184286 1990.480401 11.098282\n" +"\n" +" hindfoot_length weight\n" +"sex\n" +"F 28.836780 42.170555\n" +"M 29.709578 42.995379\n" +"\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"The `groupby` command is powerful in that it allows us to quickly generate\n" +"summary stats.\n" +"\n" +"> ## Challenge - Summary Data\n" +">\n" +"> 1. How many recorded individuals are female `F` and how many male `M`\n" +"> 2. What happens when you group by two columns using the following syntax " +"and\n" +"> then grab mean values:\n" +"> - `grouped_data2 = surveys_df.groupby(['plot_id','sex'])`\n" +"> - `grouped_data2.mean()`\n" +"> 3. Summarize weight values for each site in your data. HINT: you can use " +"the\n" +"> following syntax to only create summary statistics for one column in " +"your data\n" +"> `by_site['weight'].describe()`\n" +">\n" +">\n" +">> ## Did you get #3 right?\n" +">> **A Snippet of the Output from challenge 3 looks like:**\n" +">>\n" +">> ~~~\n" +">> site\n" +">> 1 count 1903.000000\n" +">> mean 51.822911\n" +">> std 38.176670\n" +">> min 4.000000\n" +">> 25% 30.000000\n" +">> 50% 44.000000\n" +">> 75% 53.000000\n" +">> max 231.000000\n" +">> ...\n" +">> ~~~\n" +">> {: .output}\n" +"> {: .solution}\n" +"{: .challenge}\n" +"\n" +"## Quickly Creating Summary Counts in Pandas\n" +"\n" +"Let's next count the number of samples for each species. We can do this in a " +"few\n" +"ways, but we'll use `groupby` combined with **a `count()` method**.\n" +"\n" +"\n" +"~~~\n" +"# Count the number of samples by species\n" +"species_counts = surveys_df.groupby('species_id')['record_id'].count()\n" +"print(species_counts)\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"Or, we can also count just the rows that have the species \"DO\":\n" +"\n" +"~~~\n" +"surveys_df.groupby('species_id')['record_id'].count()['DO']\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"> ## Challenge - Make a list\n" +">\n" +"> What's another way to create a list of species and associated `count` of " +"the\n" +"> records in the data? Hint: you can perform `count`, `min`, etc functions " +"on\n" +"> groupby DataFrames in the same way you can perform them on regular " +"DataFrames.\n" +"{: .challenge}\n" +"\n" +"## Basic Math Functions\n" +"\n" +"If we wanted to, we could perform math on an entire column of our data. For\n" +"example let's multiply all weight values by 2. A more practical use of this " +"might\n" +"be to normalize the data according to a mean, area, or some other value\n" +"calculated from our data.\n" +"\n" +"~~~\n" +"# Multiply all weight values by 2\n" +"surveys_df['weight']*2\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"# Quick & Easy Plotting Data Using Pandas\n" +"\n" +"We can plot our summary stats using Pandas, too.\n" +"\n" +"~~~\n" +"# Make sure figures appear inline in Ipython Notebook\n" +"%matplotlib inline\n" +"# Create a quick bar chart\n" +"species_counts.plot(kind='bar');\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"![Weight by Species Site](../fig/countPerSpecies.png)\n" +"Count per species site\n" +"\n" +"We can also look at how many animals were captured in each site:\n" +"\n" +"~~~\n" +"total_count = surveys_df.groupby('plot_id')['record_id'].nunique()\n" +"# Let's plot that too\n" +"total_count.plot(kind='bar');\n" +"~~~\n" +"{: .language-python}\n" +"\n" +"> ## Challenge - Plots\n" +">\n" +"> 1. Create a plot of average weight across all species per site.\n" +"> 2. Create a plot of total males versus total females for the entire " +"dataset.\n" +"{: .challenge}\n" +"\n" +"> ## Summary Plotting Challenge\n" +">\n" +"> Create a stacked bar plot, with weight on the Y axis, and the stacked " +"variable\n" +"> being sex. The plot should show total weight by sex for each site. Some\n" +"> tips are below to help you solve this challenge:\n" +">\n" +"> * For more on Pandas plots, visit this [link][pandas-plot].\n" +"> * You can use the code that follows to create a stacked bar plot but the " +"data to stack\n" +"> need to be in individual columns. Here's a simple example with some data " +"where\n" +"> 'a', 'b', and 'c' are the groups, and 'one' and 'two' are the subgroups.\n" +">\n" +"> ~~~\n" +"> d = {'one' : pd.Series([1., 2., 3.], index=['a', 'b', 'c']),'two' : pd." +"Series([1., 2., 3., 4.], index=['a', 'b', 'c', 'd'])}\n" +"> pd.DataFrame(d)\n" +"> ~~~\n" +"> {: .language-python }\n" +">\n" +"> shows the following data\n" +">\n" +"> ~~~\n" +"> one two\n" +"> a 1 1\n" +"> b 2 2\n" +"> c 3 3\n" +"> d NaN 4\n" +"> ~~~\n" +"> {: .output}\n" +">\n" +"> We can plot the above with\n" +">\n" +"> ~~~\n" +"> # Plot stacked data so columns 'one' and 'two' are stacked\n" +"> my_df = pd.DataFrame(d)\n" +"> my_df.plot(kind='bar',stacked=True,title=\"The title of my graph\")\n" +"> ~~~\n" +"> {: .language-python }\n" +">\n" +"> ![Stacked Bar Plot](../fig/stackedBar1.png)\n" +">\n" +"> * You can use the `.unstack()` method to transform grouped data into " +"columns\n" +"> for each plotting. Try running `.unstack()` on some DataFrames above and " +"see\n" +"> what it yields.\n" +">\n" +"> Start by transforming the grouped data (by site and sex) into an unstacked " +"layout, then create\n" +"> a stacked plot.\n" +">\n" +">\n" +">> ## Solution to Summary Challenge\n" +">>\n" +">> First we group data by site and by sex, and then calculate a total for " +"each site.\n" +">>\n" +">> ~~~\n" +">> by_site_sex = surveys_df.groupby(['plot_id','sex'])\n" +">> site_sex_count = by_site_sex['weight'].sum()\n" +">> ~~~\n" +">> {: .language-python}\n" +">>\n" +">> This calculates the sums of weights for each sex within each site as a " +"table\n" +">>\n" +">> ~~~\n" +">> site sex\n" +">> plot_id sex\n" +">> 1 F 38253\n" +">> M 59979\n" +">> 2 F 50144\n" +">> M 57250\n" +">> 3 F 27251\n" +">> M 28253\n" +">> 4 F 39796\n" +">> M 49377\n" +">> \n" +">> ~~~\n" +">> {: .output}\n" +">>\n" +">> Below we'll use `.unstack()` on our grouped data to figure out the total " +"weight that each sex contributed to each site.\n" +">>\n" +">> ~~~\n" +">> by_site_sex = surveys_df.groupby(['plot_id','sex'])\n" +">> site_sex_count = by_site_sex['weight'].sum()\n" +">> site_sex_count.unstack()\n" +">> ~~~\n" +">> {: .language-python }\n" +">>\n" +">> The `unstack` method above will display the following output:\n" +">>\n" +">> ~~~\n" +">> sex F M\n" +">> plot_id\n" +">> 1 38253 59979\n" +">> 2 50144 57250\n" +">> 3 27251 28253\n" +">> 4 39796 49377\n" +">> \n" +">> ~~~\n" +">> {: .output}\n" +">>\n" +">> Now, create a stacked bar plot with that data where the weights for each " +"sex are stacked by site.\n" +">>\n" +">> Rather than display it as a table, we can plot the above data by stacking " +"the values of each sex as follows:\n" +">>\n" +">> ~~~\n" +">> by_site_sex = surveys_df.groupby(['plot_id','sex'])\n" +">> site_sex_count = by_site_sex['weight'].sum()\n" +">> spc = site_sex_count.unstack()\n" +">> s_plot = spc.plot(kind='bar',stacked=True,title=\"Total weight by site " +"and sex\")\n" +">> s_plot.set_ylabel(\"Weight\")\n" +">> s_plot.set_xlabel(\"Plot\")\n" +">> ~~~\n" +">> {: .language-python}\n" +">>\n" +">> ![Stacked Bar Plot](../fig/stackedBar.png)\n" +"> {: .solution}\n" +"{: .challenge}\n" +"\n" +"[ernst]: http://www.esapubs.org/archive/ecol/E090/118/default.htm\n" +"[figshare-ndownloader]: https://ndownloader.figshare.com/files/2292172\n" +"[os-lib]: https://docs.python.org/3/library/os.html\n" +"[matplotlib]: https://matplotlib.org\n" +"[numpy]: https://www.numpy.org/\n" +"[pandas]: https://pandas.pydata.org\n" +"[pandas-plot]: http://pandas.pydata.org/pandas-docs/stable/user_guide/" +"visualization.html#basic-plotting-plot\n" +"[pd-dataframe]: https://pandas.pydata.org/pandas-docs/stable/getting_started/" +"dsintro.html#dataframe\n" +"[pptd]: https://figshare.com/articles/" +"Portal_Project_Teaching_Database/1314459\n" +"[python-datastructures]: https://docs.python.org/3/tutorial/datastructures." +"html#tuples-and-sequences\n" +"[spreadsheet-lesson5]: http://www.datacarpentry.org/spreadsheet-ecology-" +"lesson/05-exporting-data\n" +"\n" +"{% include links.md %}\n" +msgstr "" + +# Front Matter +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:1 +msgid "" +"---\n" +"title: Indexing, Slicing and Subsetting DataFrames in Python\n" +"teaching: 30\n" +"exercises: 30\n" +"questions:\n" +" - \"How can I access specific data within my data set?\"\n" +" - \"How can Python and Pandas help me to analyse my data?\"\n" +"objectives:\n" +" - \"Describe what 0-based indexing is.\"\n" +" - \"Manipulate and extract data using column headings and index " +"locations.\"\n" +" - \"Employ slicing to select sets of data from a DataFrame.\"\n" +" - \"Employ label and integer-based indexing to select ranges of data in " +"a dataframe.\"\n" +" - \"Reassign values within subsets of a DataFrame.\"\n" +" - \"Create a copy of a DataFrame.\"\n" +" - \"Query / select a subset of data using a set of criteria using the " +"following operators:\n" +" `=`, `!=`, `>`, `<`, `>=`, `<=`.\"\n" +" - \"Locate subsets of data using masks.\"\n" +" - \"Describe BOOLEAN objects in Python and manipulate data using " +"BOOLEANs.\"\n" +"keypoints:\n" +" - \"In Python, portions of data can be accessed using indices, slices, " +"column headings, and\n" +" condition-based subsetting.\"\n" +" - \"Python uses 0-based indexing, in which the first element in a list, " +"tuple or any other data\n" +" structure has an index of 0.\"\n" +" - \"Pandas enables common data exploration steps such as data indexing, " +"slicing and conditional\n" +" subsetting.\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:28 +msgid "" +"In the first episode of this lesson, we read a CSV file into a pandas' " +"DataFrame. We learned how to:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:30 +msgid "- save a DataFrame to a named object," +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:31 +msgid "- perform basic math on data," +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:32 +msgid "- calculate summary statistics, and" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:33 +msgid "- create plots based on the data we loaded into pandas." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:35 +msgid "" +"In this lesson, we will explore ways to access different parts of the data " +"using:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:37 +msgid "- indexing," +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:38 +msgid "- slicing, and" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:39 +msgid "- subsetting." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:41 +msgid "## Loading our data" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:43 +msgid "" +"We will continue to use the surveys dataset that we worked with in the last\n" +"episode. Let's reopen and read in the data again:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:46 +msgid "" +"~~~\n" +"# Make sure pandas is loaded\n" +"import pandas as pd\n" +"\n" +"# Read in the survey CSV\n" +"surveys_df = pd.read_csv(\"data/surveys.csv\")\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:55 +msgid "## Indexing and Slicing in Python" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:57 +msgid "" +"We often want to work with subsets of a **DataFrame** object. There are\n" +"different ways to accomplish this including: using labels (column " +"headings),\n" +"numeric ranges, or specific x,y index locations." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:62 +msgid "## Selecting data using Labels (Column Headings)" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:64 +msgid "" +"We use square brackets `[]` to select a subset of a Python object. For " +"example,\n" +"we can select all data from a column named `species_id` from the " +"`surveys_df`\n" +"DataFrame by name. There are two ways to do this:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:68 +msgid "" +"~~~\n" +"# TIP: use the .head() method we saw earlier to make output shorter\n" +"# Method 1: select a 'subset' of the data using the column name\n" +"surveys_df['species_id']\n" +"\n" +"# Method 2: use the column name as an 'attribute'; gives the same output\n" +"surveys_df.species_id\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:78 +msgid "" +"We can also create a new object that contains only the data within the\n" +"`species_id` column as follows:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:81 +msgid "" +"~~~\n" +"# Creates an object, surveys_species, that only contains the `species_id` " +"column\n" +"surveys_species = surveys_df['species_id']\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:87 +msgid "" +"We can pass a list of column names too, as an index to select columns in " +"that\n" +"order. This is useful when we need to reorganize our data." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:90 +msgid "" +"**NOTE:** If a column name is not contained in the DataFrame, an exception\n" +"(error) will be raised." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:93 +msgid "" +"~~~\n" +"# Select the species and plot columns from the DataFrame\n" +"surveys_df[['species_id', 'plot_id']]\n" +"\n" +"# What happens when you flip the order?\n" +"surveys_df[['plot_id', 'species_id']]\n" +"\n" +"# What happens if you ask for a column that doesn't exist?\n" +"surveys_df['speciess']\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:105 +msgid "" +"Python tells us what type of error it is in the traceback, at the bottom it " +"says\n" +"`KeyError: 'speciess'` which means that `speciess` is not a valid column " +"name (nor a valid key in\n" +"the related Python data type dictionary)." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:109 +msgid "## Extracting Range based Subsets: Slicing" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:111 +msgid "> ## Reminder" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:112 +msgid "> Python uses 0-based indexing." +msgstr "" + +# SC/DC Template label +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:113 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:129 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:139 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:177 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:343 +#: python-ecology-lesson/_extras/guide.md:79 +msgid "{: .callout}" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:115 +msgid "" +"Let's remind ourselves that Python uses 0-based\n" +"indexing. This means that the first element in an object is located at " +"position\n" +"0. This is different from other tools like R and Matlab that index elements\n" +"within objects starting at 1." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:120 +msgid "" +"~~~\n" +"# Create a list of numbers:\n" +"a = [1, 2, 3, 4, 5]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:126 +msgid "" +"![indexing diagram](../fig/slicing-indexing.png)\n" +"![slicing diagram](../fig/slicing-slicing.png)" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:130 +msgid "> ## Challenge - Extracting data" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:131 +msgid "" +">\n" +"> 1. What value does the code below return?\n" +">\n" +"> ~~~\n" +"> a[0]\n" +"> ~~~\n" +"> {: .language-python }\n" +">\n" +"> 2. How about this:\n" +">\n" +"> ~~~\n" +"> a[5]\n" +"> ~~~\n" +"> {: .language-python }\n" +">\n" +"> 3. In the example above, calling `a[5]` returns an error. Why is that?\n" +">\n" +"> 4. What about?\n" +">\n" +"> ~~~\n" +"> a[len(a)]\n" +"> ~~~\n" +"> {: .language-python }" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:157 +msgid "## Slicing Subsets of Rows in Python" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:159 +msgid "" +"Slicing using the `[]` operator selects a set of rows and/or columns from a\n" +"DataFrame. To slice out a set of rows, you use the following syntax:\n" +"`data[start:stop]`. When slicing in pandas the start bound is included in " +"the\n" +"output. The stop bound is one step BEYOND the row you want to select. So if " +"you\n" +"want to select rows 0, 1 and 2 your code would look like this:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:165 +msgid "" +"~~~\n" +"# Select rows 0, 1, 2 (row 3 is not selected)\n" +"surveys_df[0:3]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:171 +msgid "" +"The stop bound in Python is different from what you might be used to in\n" +"languages like Matlab and R." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:174 +msgid "" +"~~~\n" +"# Select the first 5 rows (rows 0, 1, 2, 3, 4)\n" +"surveys_df[:5]\n" +"\n" +"# Select the last element in the list\n" +"# (the slice starts at the last element, and ends at the end of the list)\n" +"surveys_df[-1:]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:184 +msgid "We can also reassign values within subsets of our DataFrame." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:186 +msgid "" +"But before we do that, let's look at the difference between the concept of\n" +"copying objects and the concept of referencing objects in Python." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:189 +msgid "## Copying Objects vs Referencing Objects in Python" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:191 +msgid "Let's start with an example:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:193 +msgid "" +"~~~\n" +"# Using the 'copy() method'\n" +"true_copy_surveys_df = surveys_df.copy()\n" +"\n" +"# Using the '=' operator\n" +"ref_surveys_df = surveys_df\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:202 +msgid "" +"You might think that the code `ref_surveys_df = surveys_df` creates a fresh\n" +"distinct copy of the `surveys_df` DataFrame object. However, using the `=`\n" +"operator in the simple statement `y = x` does **not** create a copy of our\n" +"DataFrame. Instead, `y = x` creates a new variable `y` that references the\n" +"**same** object that `x` refers to. To state this another way, there is " +"only\n" +"**one** object (the DataFrame), and both `x` and `y` refer to it." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:209 +msgid "" +"In contrast, the `copy()` method for a DataFrame creates a true copy of the\n" +"DataFrame." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:212 +msgid "" +"Let's look at what happens when we reassign the values within a subset of " +"the\n" +"DataFrame that references another DataFrame object:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:215 +msgid "" +"~~~\n" +"# Assign the value `0` to the first three rows of data in the DataFrame\n" +"ref_surveys_df[0:3] = 0\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:221 +msgid "Let's try the following code:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:223 +msgid "" +"~~~\n" +"# ref_surveys_df was created using the '=' operator\n" +"ref_surveys_df.head()\n" +"\n" +"# surveys_df is the original dataframe\n" +"surveys_df.head()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:232 +msgid "What is the difference between these two dataframes?" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:234 +msgid "" +"When we assigned the first 3 columns the value of `0` using the\n" +"`ref_surveys_df` DataFrame, the `surveys_df` DataFrame is modified too.\n" +"Remember we created the reference `ref_survey_df` object above when we did\n" +"`ref_survey_df = surveys_df`. Remember `surveys_df` and `ref_surveys_df`\n" +"refer to the same exact DataFrame object. If either one changes the object,\n" +"the other will see the same changes to the reference object." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:241 +msgid "**To review and recap**:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:243 +msgid "- **Copy** uses the dataframe's `copy()` method" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:245 +msgid "" +" ~~~\n" +" true_copy_surveys_df = surveys_df.copy()\n" +" ~~~\n" +" {: .language-python }\n" +"- A **Reference** is created using the `=` operator" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:251 +msgid "" +" ~~~\n" +" ref_surveys_df = surveys_df\n" +" ~~~\n" +" {: .language-python }" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:256 +msgid "" +"Okay, that's enough of that. Let's create a brand new clean dataframe from\n" +"the original data CSV file." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:259 +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:333 +msgid "" +"~~~\n" +"surveys_df = pd.read_csv(\"data/surveys.csv\")\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:264 +msgid "## Slicing Subsets of Rows and Columns in Python" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:266 +msgid "" +"We can select specific ranges of our data in both the row and column " +"directions\n" +"using either label or integer-based indexing." +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:269 +msgid "- `loc` is primarily *label* based indexing. *Integers* may be used but" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:270 +msgid "" +" they are interpreted as a *label*.\n" +"- `iloc` is primarily *integer* based indexing" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:273 +msgid "" +"To select a subset of rows **and** columns from our DataFrame, we can use " +"the\n" +"`iloc` method. For example, we can select month, day and year (columns 2, 3\n" +"and 4 if we start counting at 1), like this:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:277 +msgid "" +"~~~\n" +"# iloc[row slicing, column slicing]\n" +"surveys_df.iloc[0:3, 1:4]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:283 +msgid "which gives the **output**" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:285 +msgid "" +"~~~\n" +" month day year\n" +"0 7 16 1977\n" +"1 7 16 1977\n" +"2 7 16 1977\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:293 +msgid "" +"Notice that we asked for a slice from 0:3. This yielded 3 rows of data. When " +"you\n" +"ask for 0:3, you are actually telling Python to start at index 0 and select " +"rows\n" +"0, 1, 2 **up to but not including 3**." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:297 +msgid "Let's explore some other ways to index and select subsets of data:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:299 +msgid "" +"~~~\n" +"# Select all columns for rows of index values 0 and 10\n" +"surveys_df.loc[[0, 10], :]\n" +"\n" +"# What does this do?\n" +"surveys_df.loc[0, ['species_id', 'plot_id', 'weight']]\n" +"\n" +"# What happens when you type the code below?\n" +"surveys_df.loc[[0, 10, 35549], :]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:311 +msgid "" +"**NOTE**: Labels must be found in the DataFrame or you will get a `KeyError`." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:313 +msgid "" +"Indexing by labels `loc` differs from indexing by integers `iloc`.\n" +"With `loc`, both the start bound and the stop bound are **inclusive**. When " +"using\n" +"`loc`, integers *can* be used, but the integers refer to the\n" +"index label and not the position. For example, using `loc` and select 1:4\n" +"will get a different result than using `iloc` to select rows 1:4." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:319 +msgid "" +"We can also select a specific data value using a row and\n" +"column location within the DataFrame and `iloc` indexing:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:322 +msgid "" +"~~~\n" +"# Syntax for iloc indexing to finding a specific data element\n" +"dat.iloc[row, column]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:328 +msgid "In this `iloc` example," +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:330 +msgid "" +"~~~\n" +"surveys_df.iloc[2, 6]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:335 +msgid "gives the **output**" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:337 +msgid "" +"~~~\n" +"'F'\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:342 +msgid "" +"Remember that Python indexing begins at 0. So, the index location [2, 6]\n" +"selects the element that is 3 rows down and 7 columns over in the DataFrame." +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:347 +msgid "> ## Challenge - Range" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:348 +msgid "" +">\n" +"> 1. What happens when you execute:\n" +">\n" +"> - `surveys_df[0:1]`\n" +"> - `surveys_df[:4]`\n" +"> - `surveys_df[:-1]`\n" +">\n" +"> 2. What happens when you call:\n" +">\n" +"> - `surveys_df.iloc[0:4, 1:4]`\n" +"> - `surveys_df.loc[0:4, 1:4]`\n" +">\n" +"> - How are the two commands different?" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:364 +msgid "## Subsetting Data using Criteria" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:366 +msgid "" +"We can also select a subset of our data using criteria. For example, we can\n" +"select all rows that have a year value of 2002:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:369 +msgid "" +"~~~\n" +"surveys_df[surveys_df.year == 2002]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:374 +msgid "Which produces the following output:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:376 +msgid "" +"~~~\n" +"record_id month day year plot_id species_id sex hindfoot_length " +"weight\n" +"33320 33321 1 12 2002 1 DM M 38 44\n" +"33321 33322 1 12 2002 1 DO M 37 58\n" +"33322 33323 1 12 2002 1 PB M 28 45\n" +"33323 33324 1 12 2002 1 AB NaN NaN NaN\n" +"33324 33325 1 12 2002 1 DO M 35 29\n" +"...\n" +"35544 35545 12 31 2002 15 AH NaN NaN NaN\n" +"35545 35546 12 31 2002 15 AH NaN NaN NaN\n" +"35546 35547 12 31 2002 10 RM F 15 14\n" +"35547 35548 12 31 2002 7 DO M 36 51\n" +"35548 35549 12 31 2002 5 NaN NaN NaN NaN\n" +"\n" +"[2229 rows x 9 columns]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:394 +msgid "Or we can select all rows that do not contain the year 2002:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:396 +msgid "" +"~~~\n" +"surveys_df[surveys_df.year != 2002]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:401 +msgid "We can define sets of criteria too:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:403 +msgid "" +"~~~\n" +"surveys_df[(surveys_df.year >= 1980) & (surveys_df.year <= 1985)]\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:408 +msgid "### Python Syntax Cheat Sheet" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:410 +msgid "" +"We can use the syntax below when querying data by criteria from a " +"DataFrame.\n" +"Experiment with selecting various subsets of the \"surveys\" data." +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:413 +msgid "* Equals: `==`" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:414 +msgid "* Not equals: `!=`" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:415 +msgid "* Greater than, less than: `>` or `<`" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:416 +msgid "* Greater than or equal to `>=`" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:417 +msgid "* Less than or equal to `<=`" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:420 +msgid "> ## Challenge - Queries" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:421 +msgid "" +">\n" +"> 1. Select a subset of rows in the `surveys_df` DataFrame that contain data " +"from\n" +"> the year 1999 and that contain weight values less than or equal to 8. " +"How\n" +"> many rows did you end up with? What did your neighbor get?\n" +">\n" +"> 2. You can use the `isin` command in Python to query a DataFrame based " +"upon a\n" +"> list of values as follows:\n" +">\n" +"> ~~~\n" +"> surveys_df[surveys_df['species_id'].isin([listGoesHere])]\n" +"> ~~~\n" +"> {: .language-python }\n" +">\n" +"> Use the `isin` function to find all plots that contain particular " +"species\n" +"> in the \"surveys\" DataFrame. How many records contain these values?\n" +">\n" +"> 3. Experiment with other queries. Create a query that finds all rows with " +"a\n" +"> weight value > or equal to 0.\n" +">\n" +"> 4. The `~` symbol in Python can be used to return the OPPOSITE of the\n" +"> selection that you specify in Python. It is equivalent to **is not " +"in**.\n" +"> Write a query that selects all rows with sex NOT equal to 'M' or 'F' in\n" +"> the \"surveys\" data." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:447 +msgid "# Using masks to identify a specific condition" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:449 +msgid "" +"A **mask** can be useful to locate where a particular subset of values exist " +"or\n" +"don't exist - for example, NaN, or \"Not a Number\" values. To understand " +"masks,\n" +"we also need to understand `BOOLEAN` objects in Python." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:453 +msgid "Boolean values include `True` or `False`. For example," +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:455 +msgid "" +"~~~\n" +"# Set x to 5\n" +"x = 5\n" +"\n" +"# What does the code below return?\n" +"x > 5\n" +"\n" +"# How about this?\n" +"x == 5\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:467 +msgid "" +"When we ask Python whether `x` is greater than 5, it returns `False`.\n" +"This is Python's way to say \"No\". Indeed, the value of `x` is 5,\n" +"and 5 is not greater than 5." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:471 +msgid "To create a boolean mask:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:473 +msgid "- Set the True / False criteria (e.g. `values > 5 = True`)" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:474 +msgid "" +"- Python will then assess each value in the object to determine whether the" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:475 +msgid "" +" value meets the criteria (True) or not (False).\n" +"- Python creates an output object that is the same shape as the original\n" +" object, but with a `True` or `False` value for each index location." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:479 +msgid "" +"Let's try this out. Let's identify all locations in the survey data that " +"have\n" +"null (missing or NaN) data values. We can use the `isnull` method to do " +"this.\n" +"The `isnull` method will compare each cell with a null value. If an element\n" +"has a null value, it will be assigned a value of `True` in the output " +"object." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:484 +msgid "" +"~~~\n" +"pd.isnull(surveys_df)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:489 +msgid "A snippet of the output is below:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:491 +msgid "" +"~~~\n" +" record_id month day year plot_id species_id sex " +"hindfoot_length weight\n" +"0 False False False False False False False False " +"True\n" +"1 False False False False False False False False " +"True\n" +"2 False False False False False False False False " +"True\n" +"3 False False False False False False False False " +"True\n" +"4 False False False False False False False False " +"True\n" +"\n" +"[35549 rows x 9 columns]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:503 +msgid "" +"To select the rows where there are null values, we can use\n" +"the mask as an index to subset our data as follows:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:506 +msgid "" +"~~~\n" +"# To select just the rows with NaN values, we can use the 'any()' method\n" +"surveys_df[pd.isnull(surveys_df).any(axis=1)]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:512 +msgid "" +"Note that the `weight` column of our DataFrame contains many `null` or " +"`NaN`\n" +"values. We will explore ways of dealing with this in Lesson 03." +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:515 +msgid "" +"We can run `isnull` on a particular column too. What does the code below do?" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:517 +msgid "" +"~~~\n" +"# What does this do?\n" +"empty_weights = surveys_df[pd.isnull(surveys_df['weight'])]['weight']\n" +"print(empty_weights)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:524 +msgid "" +"Let's take a minute to look at the statement above. We are using the " +"Boolean\n" +"object `pd.isnull(surveys_df['weight'])` as an index to `surveys_df`. We " +"are\n" +"asking Python to select rows that have a `NaN` value of weight." +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:529 +msgid "> ## Challenge - Putting it all together" +msgstr "" + +#: python-ecology-lesson/_episodes/03-index-slice-subset.md:530 +msgid "" +">\n" +"> 1. Create a new DataFrame that only contains observations with sex values " +"that\n" +"> are **not** female or male. Assign each sex value in the new DataFrame " +"to a\n" +"> new value of 'x'. Determine the number of null values in the subset.\n" +">\n" +"> 2. Create a new DataFrame that contains only observations that are of sex " +"male\n" +"> or female and where weight values are greater than 0. Create a stacked " +"bar\n" +"> plot of average weight by plot with male vs female values stacked for " +"each\n" +"> plot." +msgstr "" + +# Front Matter +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:1 +msgid "" +"---\n" +"title: Data Types and Formats\n" +"teaching: 20\n" +"exercises: 25\n" +"questions:\n" +" - \"What types of data can be contained in a DataFrame?\"\n" +" - \"Why is the data type important?\"\n" +"objectives:\n" +" - \"Describe how information is stored in a Python DataFrame.\"\n" +" - \"Define the two main types of data in Python: text and numerics.\"\n" +" - \"Examine the structure of a DataFrame.\"\n" +" - \"Modify the format of values in a DataFrame.\"\n" +" - \"Describe how data types impact operations.\"\n" +" - \"Define, manipulate, and interconvert integers and floats in Python." +"\"\n" +" - \"Analyze datasets having missing/null values (NaN values).\"\n" +" - \"Write manipulated data to a file.\"\n" +"keypoints:\n" +" - \"Pandas uses other names for data types than Python, for example: " +"`object` for textual data.\"\n" +" - \"A column in a DataFrame can only have one data type.\"\n" +" - \"The data type in a DataFrame’s single column can be checked using " +"`dtype`.\"\n" +" - \"Make conscious decisions about how to manage missing data.\"\n" +" - \"A DataFrame can be saved to a CSV file using the `to_csv` function." +"\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:25 +msgid "" +"The format of individual columns and rows will impact analysis performed on " +"a\n" +"dataset read into python. For example, you can't perform mathematical\n" +"calculations on a string (text formatted data). This might seem obvious,\n" +"however sometimes numeric values are read into Python as strings. In this\n" +"situation, when you then try to perform calculations on the string-" +"formatted\n" +"numeric data, you get an error." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:32 +msgid "" +"In this lesson we will review ways to explore and better understand the\n" +"structure and format of our data." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:35 +msgid "# Types of Data" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:37 +msgid "" +"How information is stored in a\n" +"DataFrame or a Python object affects what we can do with it and the outputs " +"of\n" +"calculations as well. There are two main types of data that we're explore " +"in\n" +"this lesson: numeric and text data types." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:42 +msgid "## Numeric Data Types" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:44 +msgid "" +"Numeric data types include integers and floats. A **floating point** (known " +"as a\n" +"float) number has decimal points even if that decimal point value is 0. For\n" +"example: 1.13, 2.0, 1234.345. If we have a column that contains both " +"integers and\n" +"floating point numbers, Pandas will assign the entire column to the float " +"data\n" +"type so the decimal points are not lost." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:50 +msgid "" +"An **integer** will never have a decimal point. Thus if we wanted to store " +"1.13 as\n" +"an integer it would be stored as 1. Similarly, 1234.345 would be stored as " +"1234. You\n" +"will often see the data type `Int64` in Python which stands for 64 bit " +"integer. The 64\n" +"simply refers to the memory allocated to store data in each cell which " +"effectively\n" +"relates to how many digits it can store in each \"cell\". Allocating space " +"ahead of time\n" +"allows computers to optimize storage and processing efficiency." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:57 +msgid "## Text Data Type" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:59 +msgid "" +"Text data type is known as Strings in Python, or Objects in Pandas. Strings " +"can\n" +"contain numbers and / or characters. For example, a string might be a word, " +"a\n" +"sentence, or several sentences. A Pandas object might also be a plot name " +"like\n" +"'plot1'. A string can also contain or consist of numbers. For instance, " +"'1234'\n" +"could be stored as a string. As could '10.23'. However **strings that " +"contain\n" +"numbers can not be used for mathematical operations**!" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:66 +msgid "" +"Pandas and base Python use slightly different names for data types. More on " +"this\n" +"is in the table below:" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:69 +msgid "" +"| Pandas Type | Native Python Type | Description |\n" +"|-------------|--------------------|-------------|\n" +"| object | string | The most general dtype. Will be assigned to your column " +"if column has mixed types (numbers and strings). |\n" +"| int64 | int | Numeric characters. 64 refers to the memory allocated to " +"hold this character. |\n" +"| float64 | float | Numeric characters with decimals. If a column contains " +"numbers and NaNs (see below), pandas will default to float64, in case your " +"missing value has a decimal. |\n" +"| datetime64, timedelta[ns] | N/A (but see the [datetime] module in Python's " +"standard library) | Values meant to hold time data. Look into these for time " +"series experiments. |" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:76 +msgid "[datetime]: http://doc.python.org/2/library/datetime.html" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:79 +msgid "## Checking the format of our data" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:81 +msgid "" +"Now that we're armed with a basic understanding of numeric and text data\n" +"types, let's explore the format of our survey data. We'll be working with " +"the\n" +"same `surveys.csv` dataset that we've used in previous lessons." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:85 +msgid "" +"~~~\n" +"# Note that pd.read_csv is used because we imported pandas as pd\n" +"surveys_df = pd.read_csv(\"data/surveys.csv\")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:91 +msgid "Remember that we can check the type of an object like this:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:93 +msgid "" +"~~~\n" +"type(surveys_df)\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:98 +msgid "" +"~~~\n" +"pandas.core.frame.DataFrame\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:103 +msgid "" +"Next, let's look at the structure of our surveys data. In pandas, we can " +"check\n" +"the type of one column in a DataFrame using the syntax\n" +"`dataFrameName[column_name].dtype`:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:107 +msgid "" +"~~~\n" +"surveys_df['sex'].dtype\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:112 +msgid "" +"~~~\n" +"dtype('O')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:117 +msgid "" +"A type 'O' just stands for \"object\" which in Pandas' world is a string\n" +"(text)." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:120 +msgid "" +"~~~\n" +"surveys_df['record_id'].dtype\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:125 +msgid "" +"~~~\n" +"dtype('int64')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:130 +msgid "" +"The type `int64` tells us that Python is storing each value within this " +"column\n" +"as a 64 bit integer. We can use the `dat.dtypes` command to view the data " +"type\n" +"for each column in a DataFrame (all at once)." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:134 +msgid "" +"~~~\n" +"surveys_df.dtypes\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:139 +msgid "which **returns**:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:141 +msgid "" +"~~~\n" +"record_id int64\n" +"month int64\n" +"day int64\n" +"year int64\n" +"plot_id int64\n" +"species_id object\n" +"sex object\n" +"hindfoot_length float64\n" +"weight float64\n" +"dtype: object\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:153 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:41 +msgid "{: .language-python }" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:155 +msgid "" +"Note that most of the columns in our Survey data are of type `int64`. This " +"means\n" +"that they are 64 bit integers. But the weight column is a floating point " +"value\n" +"which means it contains decimals. The `species_id` and `sex` columns are " +"objects which\n" +"means they contain strings." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:160 +msgid "## Working With Integers and Floats" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:162 +msgid "" +"So we've learned that computers store numbers in one of two ways: as " +"integers or\n" +"as floating-point numbers (or floats). Integers are the numbers we usually " +"count\n" +"with. Floats have fractional parts (decimal places). Let's next consider " +"how\n" +"the data type can impact mathematical operations on our data. Addition,\n" +"subtraction, division and multiplication work on floats and integers as we'd " +"expect." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:168 +msgid "" +"~~~\n" +"print(5+5)\n" +"10\n" +"\n" +"print(24-4)\n" +"20\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:177 +msgid "" +"If we divide one integer by another, we get a float.\n" +"The result on Python 3 is different than in Python 2, where the result is " +"an\n" +"integer (integer division)." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:181 +msgid "" +"~~~\n" +"print(5/9)\n" +"0.5555555555555556\n" +"\n" +"print(10/3)\n" +"3.3333333333333335\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:190 +msgid "" +"We can also convert a floating point number to an integer or an integer to\n" +"floating point number. Notice that Python by default rounds down when it\n" +"converts from floating point to integer." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:194 +msgid "" +"~~~\n" +"# Convert a to an integer\n" +"a = 7.83\n" +"int(a)\n" +"7\n" +"\n" +"# Convert b to a float\n" +"b = 7\n" +"float(b)\n" +"7.0\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:207 +msgid "# Working With Our Survey Data" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:209 +msgid "" +"Getting back to our data, we can modify the format of values within our " +"data, if\n" +"we want. For instance, we could convert the `record_id` field to floating " +"point\n" +"values." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:213 +msgid "" +"~~~\n" +"# Convert the record_id field from an integer to a float\n" +"surveys_df['record_id'] = surveys_df['record_id'].astype('float64')\n" +"surveys_df['record_id'].dtype\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:220 +msgid "" +"~~~\n" +"dtype('float64')\n" +"~~~" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:225 +msgid "> ## Challenge - Changing Types" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:226 +msgid "" +">\n" +"> Try converting the column `plot_id` to floats using\n" +">\n" +"> ~~~\n" +"> surveys_df.plot_id.astype(\"float\")\n" +"> ~~~\n" +"> {: .language-python}\n" +">\n" +"> Next try converting `weight` to an integer. What goes wrong here? What is " +"Pandas telling you?\n" +"> We will talk about some solutions to this later." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:238 +msgid "## Missing Data Values - NaN" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:240 +msgid "" +"What happened in the last challenge activity? Notice that this throws a " +"value error:\n" +"`ValueError: Cannot convert NA to integer`. If we look at the `weight` " +"column in the surveys\n" +"data we notice that there are NaN (**N**ot **a** **N**umber) values. **NaN** " +"values are undefined\n" +"values that cannot be represented mathematically. Pandas, for example, will " +"read\n" +"an empty cell in a CSV or Excel sheet as a NaN. NaNs have some desirable " +"properties: if we\n" +"were to average the `weight` column without replacing our NaNs, Python would " +"know to skip\n" +"over those cells." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:248 +msgid "" +"~~~\n" +"surveys_df['weight'].mean()\n" +"42.672428212991356\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:252 +msgid "" +"{: .language-python}\n" +"Dealing with missing data values is always a challenge. It's sometimes hard " +"to\n" +"know why values are missing - was it because of a data entry error? Or data " +"that\n" +"someone was unable to collect? Should the value be 0? We need to know how\n" +"missing values are represented in the dataset in order to make good " +"decisions.\n" +"If we're lucky, we have some metadata that will tell us more about how null\n" +"values were handled." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:260 +msgid "" +"For instance, in some disciplines, like Remote Sensing, missing data values " +"are\n" +"often defined as -9999. Having a bunch of -9999 values in your data could " +"really\n" +"alter numeric calculations. Often in spreadsheets, cells are left empty " +"where no\n" +"data are available. Pandas will, by default, replace those missing values " +"with\n" +"NaN. However it is good practice to get in the habit of intentionally " +"marking\n" +"cells that have no data, with a no data value! That way there are no " +"questions\n" +"in the future when you (or someone else) explores your data." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:268 +msgid "### Where Are the NaN's?" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:270 +msgid "" +"Let's explore the NaN values in our data a bit further. Using the tools we\n" +"learned in lesson 02, we can figure out how many rows contain NaN values " +"for\n" +"weight. We can also create a new subset from our data that only contains " +"rows\n" +"with weight values > 0 (i.e., select meaningful weight values):" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:275 +msgid "" +"~~~\n" +"len(surveys_df[pd.isnull(surveys_df.weight)])\n" +"# How many rows have weight values?\n" +"len(surveys_df[surveys_df.weight> 0])\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:282 +msgid "" +"We can replace all NaN values with zeroes using the `.fillna()` method " +"(after\n" +"making a copy of the data so we don't lose our work):" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:285 +msgid "" +"~~~\n" +"df1 = surveys_df.copy()\n" +"# Fill all NaN values with 0\n" +"df1['weight'] = df1['weight'].fillna(0)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:292 +msgid "" +"However NaN and 0 yield different analysis results. The mean value when NaN\n" +"values are replaced with 0 is different from when NaN values are simply " +"thrown\n" +"out or ignored." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:296 +msgid "" +"~~~\n" +"df1['weight'].mean()\n" +"38.751976145601844\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:302 +msgid "" +"We can fill NaN values with any value that we chose. The code below fills " +"all\n" +"NaN values with a mean for all weight values." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:305 +msgid "" +"~~~\n" +"df1['weight'] = surveys_df['weight'].fillna(surveys_df['weight'].mean())\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:310 +msgid "" +"We could also chose to create a subset of our data, only keeping rows that " +"do\n" +"not contain NaN values." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:313 +msgid "" +"The point is to make conscious decisions about how to manage missing data. " +"This\n" +"is where we think about how our data will be used and how these values will\n" +"impact the scientific conclusions made from the data." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:317 +msgid "" +"Python gives us all of the tools that we need to account for these issues. " +"We\n" +"just need to be cautious about how the decisions that we make impact " +"scientific\n" +"results." +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:321 +msgid "> ## Challenge - Counting" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:322 +msgid "" +"> Count the number of missing values per column. Hint: The method .count() " +"gives you" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:323 +msgid "" +"> the number of non-NA observations per column. Try looking to the .isnull() " +"method." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:326 +#: python-ecology-lesson/_episodes/05-merging-data.md:116 +msgid "## Writing Out Data to CSV" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:328 +msgid "" +"We've learned about using manipulating data to get desired outputs. But " +"we've also discussed\n" +"keeping data that has been manipulated separate from our raw data. Something " +"we might be interested\n" +"in doing is working with only the columns that have full data. First, let's " +"reload the data so\n" +"we're not mixing up all of our previous manipulations." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:336 +msgid "" +"{: .language-python}\n" +"Next, let's drop all the rows that contain missing values. We will use the " +"command `dropna`.\n" +"By default, dropna removes rows that contain missing data for even just one " +"column." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:340 +msgid "" +"~~~\n" +"df_na = surveys_df.dropna()\n" +"\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:346 +msgid "" +"If you now type `df_na`, you should observe that the resulting DataFrame has " +"30676 rows\n" +"and 9 columns, much smaller than the 35549 row original." +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:349 +msgid "" +"We can now use the `to_csv` command to do export a DataFrame in CSV format. " +"Note that the code\n" +"below will by default save the data into the current working directory. We " +"can\n" +"save it to a different folder by adding the foldername and a slash before " +"the filename:\n" +"`df.to_csv('foldername/out.csv')`. We use 'index=False' so that\n" +"pandas doesn't include the index number for each line." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:355 +msgid "" +"~~~\n" +"# Write DataFrame to CSV\n" +"df_na.to_csv('data_output/surveys_complete.csv', index=False)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:361 +msgid "" +"We will use this data file later in the workshop. Check out your working " +"directory to make\n" +"sure the CSV wrote out properly, and that you can open it! If you want, try " +"to bring it\n" +"back into Python to make sure it imports properly." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:366 +msgid "## Recap" +msgstr "" + +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:368 +msgid "What we've learned:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:370 +msgid "+ How to explore the data types of columns within a DataFrame" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:371 +msgid "+ How to change the data type" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:372 +msgid "" +"+ What NaN values are, how they might be represented, and what this means " +"for your work" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:373 +msgid "+ How to replace NaN values, if desired" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/04-data-types-and-format.md:374 +msgid "+ How to use `to_csv` to write manipulated data to a file." +msgstr "" + +# Front Matter +#: python-ecology-lesson/_episodes/05-merging-data.md:1 +msgid "" +"---\n" +"title: Combining DataFrames with Pandas\n" +"teaching: 20\n" +"exercises: 25\n" +"questions:\n" +" - \"Can I work with data from multiple sources?\"\n" +" - \"How can I combine data from different data sets?\"\n" +"objectives:\n" +" - \"Combine data from multiple files into a single DataFrame using merge " +"and concat.\"\n" +" - \"Combine two DataFrames using a unique ID found in both DataFrames." +"\"\n" +" - \"Employ `to_csv` to export a DataFrame in CSV format.\"\n" +" - \"Join DataFrames using common fields (join keys).\"\n" +"keypoints:\n" +" - \"Pandas' `merge` and `concat` can be used to combine subsets of a " +"DataFrame, or even data from different files.\"\n" +" - \"`join` function combines DataFrames based on index or column.\"\n" +" - \"Joining two DataFrames can be done in multiple ways (left, right, " +"and inner) depending on what data must be in the final DataFrame.\"\n" +" - \"`to_csv` can be used to write out DataFrames in CSV format.\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:20 +msgid "" +"In many \"real world\" situations, the data that we want to use come in " +"multiple\n" +"files. We often need to combine these files into a single DataFrame to " +"analyze\n" +"the data. The pandas package provides [various methods for combining\n" +"DataFrames](http://pandas.pydata.org/pandas-docs/stable/merging.html) " +"including\n" +"`merge` and `concat`." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:26 +msgid "" +"To work through the examples below, we first need to load the species and\n" +"surveys files into pandas DataFrames. In iPython:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/05-merging-data.md:29 +msgid "" +"~~~\n" +"import pandas as pd\n" +"surveys_df = pd.read_csv(\"data/surveys.csv\",\n" +" keep_default_na=False, na_values=[\"\"])\n" +"surveys_df\n" +"\n" +" record_id month day year plot species sex hindfoot_length " +"weight\n" +"0 1 7 16 1977 2 NA M 32 NaN\n" +"1 2 7 16 1977 3 NA M 33 NaN\n" +"2 3 7 16 1977 2 DM F 37 NaN\n" +"3 4 7 16 1977 7 DM M 36 NaN\n" +"4 5 7 16 1977 3 DM M 35 NaN\n" +"... ... ... ... ... ... ... ... ... ...\n" +"35544 35545 12 31 2002 15 AH NaN NaN NaN\n" +"35545 35546 12 31 2002 15 AH NaN NaN NaN\n" +"35546 35547 12 31 2002 10 RM F 15 14\n" +"35547 35548 12 31 2002 7 DO M 36 51\n" +"35548 35549 12 31 2002 5 NaN NaN NaN NaN\n" +"\n" +"[35549 rows x 9 columns]\n" +"\n" +"species_df = pd.read_csv(\"data/species.csv\",\n" +" keep_default_na=False, na_values=[\"\"])\n" +"species_df\n" +" species_id genus species taxa\n" +"0 AB Amphispiza bilineata Bird\n" +"1 AH Ammospermophilus harrisi Rodent\n" +"2 AS Ammodramus savannarum Bird\n" +"3 BA Baiomys taylori Rodent\n" +"4 CB Campylorhynchus brunneicapillus Bird\n" +".. ... ... ... ...\n" +"49 UP Pipilo sp. Bird\n" +"50 UR Rodent sp. Rodent\n" +"51 US Sparrow sp. Bird\n" +"52 ZL Zonotrichia leucophrys Bird\n" +"53 ZM Zenaida macroura Bird\n" +"\n" +"[54 rows x 4 columns]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:70 +msgid "" +"Take note that the `read_csv` method we used can take some additional " +"options which\n" +"we didn't use previously. Many functions in Python have a set of options " +"that\n" +"can be set by the user if needed. In this case, we have told pandas to " +"assign\n" +"empty values in our CSV to NaN `keep_default_na=False, na_values=[\"\"]`.\n" +"[More about all of the read_csv options here.](http://pandas.pydata.org/" +"pandas-docs/dev/generated/pandas.io.parsers.read_csv.html)" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/05-merging-data.md:76 +msgid "# Concatenating DataFrames" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:78 +msgid "" +"We can use the `concat` function in pandas to append either columns or rows " +"from\n" +"one DataFrame to another. Let's grab two subsets of our data to see how " +"this\n" +"works." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/05-merging-data.md:82 +msgid "" +"~~~\n" +"# Read in first 10 lines of surveys table\n" +"survey_sub = surveys_df.head(10)\n" +"# Grab the last 10 rows\n" +"survey_sub_last10 = surveys_df.tail(10)\n" +"# Reset the index values to the second dataframe appends properly\n" +"survey_sub_last10=survey_sub_last10.reset_index(drop=True)\n" +"# drop=True option avoids adding new index column with old index values\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:93 +msgid "" +"When we concatenate DataFrames, we need to specify the axis. `axis=0` tells\n" +"pandas to stack the second DataFrame under the first one. It will " +"automatically\n" +"detect whether the column names are the same and will stack accordingly.\n" +"`axis=1` will stack the columns in the second DataFrame to the RIGHT of the\n" +"first DataFrame. To stack the data vertically, we need to make sure we have " +"the\n" +"same columns and associated column format in both datasets. When we stack\n" +"horizonally, we want to make sure what we are doing makes sense (ie the data " +"are\n" +"related in some way)." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/05-merging-data.md:102 +msgid "" +"~~~\n" +"# Stack the DataFrames on top of each other\n" +"vertical_stack = pd.concat([survey_sub, survey_sub_last10], axis=0)\n" +"\n" +"# Place the DataFrames side by side\n" +"horizontal_stack = pd.concat([survey_sub, survey_sub_last10], axis=1)\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/05-merging-data.md:111 +msgid "### Row Index Values and Concat" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:112 +msgid "" +"Have a look at the `vertical_stack` dataframe? Notice anything unusual?\n" +"The row indexes for the two data frames `survey_sub` and " +"`survey_sub_last10`\n" +"have been repeated. We can reindex the new dataframe using the " +"`reset_index()` method." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:118 +msgid "" +"We can use the `to_csv` command to do export a DataFrame in CSV format. Note " +"that the code\n" +"below will by default save the data into the current working directory. We " +"can\n" +"save it to a different folder by adding the foldername and a slash to the " +"file\n" +"`vertical_stack.to_csv('foldername/out.csv')`. We use the 'index=False' so " +"that\n" +"pandas doesn't include the index number for each line." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/05-merging-data.md:124 +msgid "" +"~~~\n" +"# Write DataFrame to CSV\n" +"vertical_stack.to_csv('data_output/out.csv', index=False)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:130 +msgid "" +"Check out your working directory to make sure the CSV wrote out properly, " +"and\n" +"that you can open it! If you want, try to bring it back into Python to make " +"sure\n" +"it imports properly." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/05-merging-data.md:134 +msgid "" +"~~~\n" +"# For kicks read our output back into Python and make sure all looks good\n" +"new_output = pd.read_csv('data_output/out.csv', keep_default_na=False, " +"na_values=[\"\"])\n" +"~~~" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/05-merging-data.md:140 +msgid "> ## Challenge - Combine Data" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:141 +msgid "" +">\n" +"> In the data folder, there are two survey data files: `survey2001.csv` and\n" +"> `survey2002.csv`. Read the data into Python and combine the files to make " +"one\n" +"> new data frame. Create a plot of average plot weight by year grouped by " +"sex.\n" +"> Export your results as a CSV and make sure it reads back into Python " +"properly." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/05-merging-data.md:148 +msgid "# Joining DataFrames" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:150 +msgid "" +"When we concatenated our DataFrames we simply added them to each other -\n" +"stacking them either vertically or side by side. Another way to combine\n" +"DataFrames is to use columns in each dataset that contain common values (a\n" +"common unique id). Combining DataFrames using a common field is called\n" +"\"joining\". The columns containing the common values are called \"join " +"key(s)\".\n" +"Joining DataFrames in this way is often useful when one DataFrame is a " +"\"lookup\n" +"table\" containing additional data that we want to include in the other." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:158 +msgid "" +"NOTE: This process of joining tables is similar to what we do with tables in " +"an\n" +"SQL database." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:161 +msgid "" +"For example, the `species.csv` file that we've been working with is a " +"lookup\n" +"table. This table contains the genus, species and taxa code for 55 species. " +"The\n" +"species code is unique for each line. These species are identified in our " +"survey\n" +"data as well using the unique species code. Rather than adding 3 more " +"columns\n" +"for the genus, species and taxa to each of the 35,549 line Survey data " +"table, we\n" +"can maintain the shorter table with the species information. When we want " +"to\n" +"access that information, we can create a query that joins the additional " +"columns\n" +"of information to the Survey data." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:170 +msgid "Storing data in this way has many benefits including:" +msgstr "" + +# ordered list +#: python-ecology-lesson/_episodes/05-merging-data.md:172 +msgid "" +"1. It ensures consistency in the spelling of species attributes (genus, " +"species" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:173 +msgid "" +" and taxa) given each species is only entered once. Imagine the " +"possibilities\n" +" for spelling errors when entering the genus and species thousands of " +"times!\n" +"2. It also makes it easy for us to make changes to the species information " +"once\n" +" without having to find each instance of it in the larger survey data.\n" +"3. It optimizes the size of our data." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/05-merging-data.md:180 +msgid "## Joining Two DataFrames" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:182 +msgid "" +"To better understand joins, let's grab the first 10 lines of our data as a\n" +"subset to work with. We'll use the `.head` method to do this. We'll also " +"read\n" +"in a subset of the species table." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/05-merging-data.md:186 +msgid "" +"~~~\n" +"# Read in first 10 lines of surveys table\n" +"survey_sub = surveys_df.head(10)\n" +"\n" +"# Import a small subset of the species data designed for this part of the " +"lesson.\n" +"# It is stored in the data folder.\n" +"species_sub = pd.read_csv('data/speciesSubset.csv', keep_default_na=False, " +"na_values=[\"\"])\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:196 +msgid "" +"In this example, `species_sub` is the lookup table containing genus, " +"species, and\n" +"taxa names that we want to join with the data in `survey_sub` to produce a " +"new\n" +"DataFrame that contains all of the columns from both `species_df` *and*\n" +"`survey_df`." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/05-merging-data.md:202 +msgid "## Identifying join keys" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:204 +msgid "" +"To identify appropriate join keys we first need to know which field(s) are\n" +"shared between the files (DataFrames). We might inspect both DataFrames to\n" +"identify these columns. If we are lucky, both DataFrames will have columns " +"with\n" +"the same name that also contain the same data. If we are less lucky, we need " +"to\n" +"identify a (differently-named) column in each DataFrame that contains the " +"same\n" +"information." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/05-merging-data.md:211 +msgid "" +"~~~\n" +">>> species_sub.columns\n" +"\n" +"Index([u'species_id', u'genus', u'species', u'taxa'], dtype='object')\n" +"\n" +">>> survey_sub.columns\n" +"\n" +"Index([u'record_id', u'month', u'day', u'year', u'plot_id', u'species_id',\n" +" u'sex', u'hindfoot_length', u'weight'], dtype='object')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:223 +msgid "" +"In our example, the join key is the column containing the two-letter " +"species\n" +"identifier, which is called `species_id`." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:226 +msgid "" +"Now that we know the fields with the common species ID attributes in each\n" +"DataFrame, we are almost ready to join our data. However, since there are\n" +"[different types of joins](http://blog.codinghorror.com/a-visual-explanation-" +"of-sql-joins/), we\n" +"also need to decide which type of join makes sense for our analysis." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/05-merging-data.md:231 +msgid "## Inner joins" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:233 +msgid "" +"The most common type of join is called an _inner join_. An inner join " +"combines\n" +"two DataFrames based on a join key and returns a new DataFrame that " +"contains\n" +"**only** those rows that have matching values in *both* of the original\n" +"DataFrames." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:238 +msgid "" +"Inner joins yield a DataFrame that contains only rows where the value being\n" +"joins exists in BOTH tables. An example of an inner join, adapted from " +"[this\n" +"page](http://blog.codinghorror.com/a-visual-explanation-of-sql-joins/) is " +"below:" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:242 +msgid "![Inner join -- courtesy of codinghorror.com](../fig/inner-join.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:244 +msgid "" +"The pandas function for performing joins is called `merge` and an Inner join " +"is\n" +"the default option:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/05-merging-data.md:247 +msgid "" +"~~~\n" +"merged_inner = pd.merge(left=survey_sub,right=species_sub, " +"left_on='species_id', right_on='species_id')\n" +"# In this case `species_id` is the only column name in both dataframes, so " +"if we skipped `left_on`\n" +"# And `right_on` arguments we would still get the same result\n" +"\n" +"# What's the size of the output data?\n" +"merged_inner.shape\n" +"merged_inner\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/05-merging-data.md:258 +msgid "" +"~~~\n" +" record_id month day year plot_id species_id sex hindfoot_length \\\n" +"0 1 7 16 1977 2 NL M 32\n" +"1 2 7 16 1977 3 NL M 33\n" +"2 3 7 16 1977 2 DM F 37\n" +"3 4 7 16 1977 7 DM M 36\n" +"4 5 7 16 1977 3 DM M 35\n" +"5 8 7 16 1977 1 DM M 37\n" +"6 9 7 16 1977 1 DM F 34\n" +"7 7 7 16 1977 2 PE F NaN\n" +"\n" +" weight genus species taxa\n" +"0 NaN Neotoma albigula Rodent\n" +"1 NaN Neotoma albigula Rodent\n" +"2 NaN Dipodomys merriami Rodent\n" +"3 NaN Dipodomys merriami Rodent\n" +"4 NaN Dipodomys merriami Rodent\n" +"5 NaN Dipodomys merriami Rodent\n" +"6 NaN Dipodomys merriami Rodent\n" +"7 NaN Peromyscus eremicus Rodent\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:281 +msgid "" +"The result of an inner join of `survey_sub` and `species_sub` is a new " +"DataFrame\n" +"that contains the combined set of columns from `survey_sub` and " +"`species_sub`. It\n" +"*only* contains rows that have two-letter species codes that are the same " +"in\n" +"both the `survey_sub` and `species_sub` DataFrames. In other words, if a row " +"in\n" +"`survey_sub` has a value of `species_id` that does *not* appear in the " +"`species_id`\n" +"column of `species`, it will not be included in the DataFrame returned by " +"an\n" +"inner join. Similarly, if a row in `species_sub` has a value of " +"`species_id`\n" +"that does *not* appear in the `species_id` column of `survey_sub`, that row " +"will not\n" +"be included in the DataFrame returned by an inner join." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:291 +msgid "" +"The two DataFrames that we want to join are passed to the `merge` function " +"using\n" +"the `left` and `right` argument. The `left_on='species'` argument tells " +"`merge`\n" +"to use the `species_id` column as the join key from `survey_sub` (the " +"`left`\n" +"DataFrame). Similarly , the `right_on='species_id'` argument tells `merge` " +"to\n" +"use the `species_id` column as the join key from `species_sub` (the `right`\n" +"DataFrame). For inner joins, the order of the `left` and `right` arguments " +"does\n" +"not matter." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:299 +msgid "" +"The result `merged_inner` DataFrame contains all of the columns from " +"`survey_sub`\n" +"(record id, month, day, etc.) as well as all the columns from `species_sub`\n" +"(species_id, genus, species, and taxa)." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:303 +msgid "" +"Notice that `merged_inner` has fewer rows than `survey_sub`. This is an\n" +"indication that there were rows in `surveys_df` with value(s) for " +"`species_id` that\n" +"do not exist as value(s) for `species_id` in `species_df`." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/05-merging-data.md:307 +msgid "## Left joins" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:309 +msgid "" +"What if we want to add information from `species_sub` to `survey_sub` " +"without\n" +"losing any of the information from `survey_sub`? In this case, we use a " +"different\n" +"type of join called a \"left outer join\", or a \"left join\"." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:313 +msgid "" +"Like an inner join, a left join uses join keys to combine two DataFrames. " +"Unlike\n" +"an inner join, a left join will return *all* of the rows from the `left`\n" +"DataFrame, even those rows whose join key(s) do not have values in the " +"`right`\n" +"DataFrame. Rows in the `left` DataFrame that are missing values for the " +"join\n" +"key(s) in the `right` DataFrame will simply have null (i.e., NaN or None) " +"values\n" +"for those columns in the resulting joined DataFrame." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:320 +msgid "" +"Note: a left join will still discard rows from the `right` DataFrame that do " +"not\n" +"have values for the join key(s) in the `left` DataFrame." +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:323 +msgid "![Left Join](../fig/left-join.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:325 +msgid "" +"A left join is performed in pandas by calling the same `merge` function used " +"for\n" +"inner join, but using the `how='left'` argument:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/05-merging-data.md:328 +msgid "" +"~~~\n" +"merged_left = pd.merge(left=survey_sub,right=species_sub, how='left', " +"left_on='species_id', right_on='species_id')\n" +"merged_left\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:332 +msgid "" +"{: .language-python}\n" +"~~~\n" +" record_id month day year plot_id species_id sex hindfoot_length \\\n" +"0 1 7 16 1977 2 NL M 32\n" +"1 2 7 16 1977 3 NL M 33\n" +"2 3 7 16 1977 2 DM F 37\n" +"3 4 7 16 1977 7 DM M 36\n" +"4 5 7 16 1977 3 DM M 35\n" +"5 6 7 16 1977 1 PF M 14\n" +"6 7 7 16 1977 2 PE F NaN\n" +"7 8 7 16 1977 1 DM M 37\n" +"8 9 7 16 1977 1 DM F 34\n" +"9 10 7 16 1977 6 PF F 20" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:346 +msgid "" +" weight genus species taxa\n" +"0 NaN Neotoma albigula Rodent\n" +"1 NaN Neotoma albigula Rodent\n" +"2 NaN Dipodomys merriami Rodent\n" +"3 NaN Dipodomys merriami Rodent\n" +"4 NaN Dipodomys merriami Rodent\n" +"5 NaN NaN NaN NaN\n" +"6 NaN Peromyscus eremicus Rodent\n" +"7 NaN Dipodomys merriami Rodent\n" +"8 NaN Dipodomys merriami Rodent\n" +"9 NaN NaN NaN NaN\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:360 +msgid "" +"The result DataFrame from a left join (`merged_left`) looks very much like " +"the\n" +"result DataFrame from an inner join (`merged_inner`) in terms of the columns " +"it\n" +"contains. However, unlike `merged_inner`, `merged_left` contains the **same\n" +"number of rows** as the original `survey_sub` DataFrame. When we inspect\n" +"`merged_left`, we find there are rows where the information that should " +"have\n" +"come from `species_sub` (i.e., `species_id`, `genus`, and `taxa`) is\n" +"missing (they contain NaN values):" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/05-merging-data.md:368 +msgid "" +"~~~\n" +"merged_left[ pd.isnull(merged_left.genus) ]\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:371 +msgid "" +"{: .language-python}\n" +"~~~\n" +" record_id month day year plot_id species_id sex hindfoot_length \\\n" +"5 6 7 16 1977 1 PF M 14\n" +"9 10 7 16 1977 6 PF F 20" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:377 +msgid "" +" weight genus species taxa\n" +"5 NaN NaN NaN NaN\n" +"9 NaN NaN NaN NaN\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:383 +msgid "" +"These rows are the ones where the value of `species_id` from `survey_sub` " +"(in this\n" +"case, `PF`) does not occur in `species_sub`." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/05-merging-data.md:387 +msgid "## Other join types" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:389 +msgid "The pandas `merge` function supports two other join types:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/05-merging-data.md:391 +msgid "" +"* Right (outer) join: Invoked by passing `how='right'` as an argument. " +"Similar" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:392 +msgid "" +" to a left join, except *all* rows from the `right` DataFrame are kept, " +"while\n" +" rows from the `left` DataFrame without matching join key(s) values are\n" +" discarded.\n" +"* Full (outer) join: Invoked by passing `how='outer'` as an argument. This " +"join\n" +" type returns the all pairwise combinations of rows from both DataFrames; i." +"e.,\n" +" the result DataFrame will `NaN` where data is missing in one of the " +"dataframes. This join type is\n" +" very rarely used." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/05-merging-data.md:400 +msgid "# Final Challenges" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/05-merging-data.md:402 +msgid "> ## Challenge - Distributions" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/05-merging-data.md:403 +msgid "" +"> Create a new DataFrame by joining the contents of the `surveys.csv` and" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/05-merging-data.md:404 +msgid "> `species.csv` tables. Then calculate and plot the distribution of:" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:405 +msgid "" +">\n" +"> 1. taxa by plot\n" +"> 2. taxa by sex by plot" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/05-merging-data.md:410 +msgid "> ## Challenge - Diversity Index" +msgstr "" + +#: python-ecology-lesson/_episodes/05-merging-data.md:411 +msgid "" +">\n" +"> 1. In the data folder, there is a `plots.csv` file that contains " +"information about the\n" +"> type associated with each plot. Use that data to summarize the number " +"of\n" +"> plots by plot type.\n" +"> 2. Calculate a diversity index of your choice for control vs rodent " +"exclosure\n" +"> plots. The index should consider both species abundance and number of\n" +"> species. You might choose to use the simple [biodiversity index " +"described\n" +"> here](http://www.amnh.org/explore/curriculum-collections/biodiversity-" +"counts/plant-ecology/how-to-calculate-a-biodiversity-index)\n" +"> which calculates diversity as:\n" +">\n" +"> the number of species in the plot / the total number of individuals in " +"the plot = Biodiversity index." +msgstr "" + +# Front Matter +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:1 +msgid "" +"---\n" +"title: Data Workflows and Automation\n" +"teaching: 40\n" +"exercises: 50\n" +"questions:\n" +" - \"Can I automate operations in Python?\"\n" +" - \"What are functions and why should I use them?\"\n" +"objectives:\n" +" - \"Describe why for loops are used in Python.\"\n" +" - \"Employ for loops to automate data analysis.\"\n" +" - \"Write unique filenames in Python.\"\n" +" - \"Build reusable code in Python.\"\n" +" - \"Write functions using conditional statements (if, then, else).\"\n" +"keypoints:\n" +" - \"Loops help automate repetitive tasks over sets of items.\"\n" +" - \"Loops combined with functions provide a way to process data more " +"efficiently than we could by hand.\"\n" +" - \"Conditional statements enable execution of different operations on " +"different data.\"\n" +" - \"Functions enable code reuse.\"\n" +"---" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:21 +msgid "" +"So far, we've used Python and the pandas library to explore and manipulate\n" +"individual datasets by hand, much like we would do in a spreadsheet. The " +"beauty\n" +"of using a programming language like Python, though, comes from the ability " +"to\n" +"automate data processing through the use of loops and functions." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:26 +msgid "## For loops" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:28 +msgid "" +"Loops allow us to repeat a workflow (or series of actions) a given number " +"of\n" +"times or while some condition is true. We would use a loop to automatically\n" +"process data that's stored in multiple files (daily values with one file " +"per\n" +"year, for example). Loops lighten our work load by performing repeated " +"tasks\n" +"without our direct involvement and make it less likely that we'll introduce\n" +"errors by making mistakes while processing each file by hand." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:35 +msgid "" +"Let's write a simple for loop that simulates what a kid might see during a\n" +"visit to the zoo:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:38 +msgid "" +"~~~\n" +"animals = ['lion', 'tiger', 'crocodile', 'vulture', 'hippo']\n" +"print(animals)\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:44 +msgid "" +"~~~\n" +"['lion', 'tiger', 'crocodile', 'vulture', 'hippo']\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:49 +msgid "" +"~~~\n" +"for creature in animals:\n" +" print(creature)\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:55 +msgid "" +"~~~\n" +"lion\n" +"tiger\n" +"crocodile\n" +"vulture\n" +"hippo\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:64 +msgid "" +"The line defining the loop must start with `for` and end with a colon, and " +"the\n" +"body of the loop must be indented." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:67 +msgid "" +"In this example, `creature` is the loop variable that takes the value of the " +"next\n" +"entry in `animals` every time the loop goes around. We can call the loop " +"variable\n" +"anything we like. After the loop finishes, the loop variable will still " +"exist\n" +"and will have the value of the last entry in the collection:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:72 +msgid "" +"~~~\n" +"animals = ['lion', 'tiger', 'crocodile', 'vulture', 'hippo']\n" +"for creature in animals:\n" +" pass\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:79 +msgid "" +"~~~\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:83 +msgid "" +"~~~\n" +"print('The loop variable is now: ' + creature)\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:88 +msgid "" +"~~~\n" +"The loop variable is now: hippo\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:93 +msgid "" +"We are not asking Python to print the value of the loop variable anymore, " +"but\n" +"the for loop still runs and the value of `creature` changes on each pass " +"through\n" +"the loop. The statement `pass` in the body of the loop just means \"do " +"nothing\"." +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:97 +msgid "> ## Challenge - Loops" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:98 +msgid "" +">\n" +"> 1. What happens if we don't include the `pass` statement?\n" +">\n" +"> 2. Rewrite the loop so that the animals are separated by commas, not new " +"lines\n" +"> (Hint: You can concatenate strings using a plus sign. For example,\n" +"> `print(string1 + string2)` outputs 'string1string2')." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:106 +msgid "## Automating data processing using For Loops" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:108 +msgid "" +"The file we've been using so far, `surveys.csv`, contains 25 years of data " +"and is\n" +"very large. We would like to separate the data for each year into a " +"separate\n" +"file." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:112 +msgid "" +"Let's start by making a new directory inside the folder `data` to store all " +"of\n" +"these files using the module `os`:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:115 +msgid "" +"~~~\n" +"import os\n" +"\n" +"os.mkdir('data/yearly_files')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:122 +msgid "" +"The command `os.mkdir` is equivalent to `mkdir` in the shell. Just so we " +"are\n" +"sure, we can check that the new directory was created within the `data` " +"folder:\n" +"~~~\n" +"os.listdir('data')\n" +"~~~\n" +"{: .language-python}\n" +"~~~\n" +"['plots.csv',\n" +" 'portal_mammals.sqlite',\n" +" 'species.csv',\n" +" 'survey2001.csv',\n" +" 'survey2002.csv',\n" +" 'surveys.csv',\n" +" 'surveys2002_temp.csv',\n" +" 'yearly_files']\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:140 +msgid "The command `os.listdir` is equivalent to `ls` in the shell." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:142 +msgid "" +"In previous lessons, we saw how to use the library pandas to load the " +"species\n" +"data into memory as a DataFrame, how to select a subset of the data using " +"some\n" +"criteria, and how to write the DataFrame into a CSV file. Let's write a " +"script\n" +"that performs those three steps in sequence for the year 2002:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:147 +msgid "" +"~~~\n" +"import pandas as pd\n" +"\n" +"# Load the data into a DataFrame\n" +"surveys_df = pd.read_csv('data/surveys.csv')\n" +"\n" +"# Select only data for the year 2002\n" +"surveys2002 = surveys_df[surveys_df.year == 2002]\n" +"\n" +"# Write the new DataFrame to a CSV file\n" +"surveys2002.to_csv('data/yearly_files/surveys2002.csv')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:161 +msgid "" +"To create yearly data files, we could repeat the last two commands over and\n" +"over, once for each year of data. Repeating code is neither elegant nor\n" +"practical, and is very likely to introduce errors into your code. We want " +"to\n" +"turn what we've just written into a loop that repeats the last two commands " +"for\n" +"every year in the dataset." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:167 +msgid "" +"Let's start by writing a loop that simply prints the names of the files we " +"want\n" +"to create - the dataset we are using covers 1977 through 2002, and we'll " +"create\n" +"a separate file for each of those years. Listing the filenames is a good way " +"to\n" +"confirm that the loop is behaving as we expect." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:172 +msgid "" +"We have seen that we can loop over a list of items, so we need a list of " +"years\n" +"to loop over. We can get the years in our DataFrame with:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:175 +msgid "" +"~~~\n" +"surveys_df['year']\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:178 +msgid "" +"{: .language-python}\n" +"~~~\n" +"0 1977\n" +"1 1977\n" +"2 1977\n" +"3 1977\n" +" ...\n" +"35545 2002\n" +"35546 2002\n" +"35547 2002\n" +"35548 2002\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:192 +msgid "" +"but we want only unique years, which we can get using the `unique` method\n" +"which we have already seen." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:195 +msgid "" +"~~~\n" +"surveys_df['year'].unique()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:198 +msgid "" +"{: .language-python}\n" +"~~~\n" +"array([1977, 1978, 1979, 1980, 1981, 1982, 1983, 1984, 1985, 1986, 1987,\n" +" 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,\n" +" 1999, 2000, 2001, 2002], dtype=int64)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:206 +msgid "Putting this into our for loop we get" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:208 +msgid "" +"~~~\n" +"for year in surveys_df['year'].unique():\n" +" filename='data/yearly_files/surveys' + str(year) + '.csv'\n" +" print(filename)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:213 +msgid "" +"{: .language-python}\n" +"~~~\n" +"data/yearly_files/surveys1977.csv\n" +"data/yearly_files/surveys1978.csv\n" +"data/yearly_files/surveys1979.csv\n" +"data/yearly_files/surveys1980.csv\n" +"data/yearly_files/surveys1981.csv\n" +"data/yearly_files/surveys1982.csv\n" +"data/yearly_files/surveys1983.csv\n" +"data/yearly_files/surveys1984.csv\n" +"data/yearly_files/surveys1985.csv\n" +"data/yearly_files/surveys1986.csv\n" +"data/yearly_files/surveys1987.csv\n" +"data/yearly_files/surveys1988.csv\n" +"data/yearly_files/surveys1989.csv\n" +"data/yearly_files/surveys1990.csv\n" +"data/yearly_files/surveys1991.csv\n" +"data/yearly_files/surveys1992.csv\n" +"data/yearly_files/surveys1993.csv\n" +"data/yearly_files/surveys1994.csv\n" +"data/yearly_files/surveys1995.csv\n" +"data/yearly_files/surveys1996.csv\n" +"data/yearly_files/surveys1997.csv\n" +"data/yearly_files/surveys1998.csv\n" +"data/yearly_files/surveys1999.csv\n" +"data/yearly_files/surveys2000.csv\n" +"data/yearly_files/surveys2001.csv\n" +"data/yearly_files/surveys2002.csv\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:244 +msgid "" +"We can now add the rest of the steps we need to create separate text files:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:246 +msgid "" +"~~~\n" +"# Load the data into a DataFrame\n" +"surveys_df = pd.read_csv('data/surveys.csv')\n" +"\n" +"for year in surveys_df['year'].unique():\n" +"\n" +" # Select data for the year\n" +" surveys_year = surveys_df[surveys_df.year == year]\n" +"\n" +" # Write the new DataFrame to a CSV file\n" +" filename = 'data/yearly_files/surveys' + str(year) + '.csv'\n" +" surveys_year.to_csv(filename)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:261 +msgid "" +"Look inside the `yearly_files` directory and check a couple of the files " +"you\n" +"just created to confirm that everything worked as expected." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:264 +msgid "## Writing Unique FileNames" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:266 +msgid "Notice that the code above created a unique filename for each year." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:268 +msgid "" +"~~~\n" +"filename = 'data/yearly_files/surveys' + str(year) + '.csv'\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:273 +msgid "Let's break down the parts of this name:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:275 +msgid "" +"* The first part is simply some text that specifies the directory to store " +"our" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:276 +msgid "" +" data file in (data/yearly_files/) and the first part of the file name\n" +" (surveys): `'data/yearly_files/surveys'`\n" +"* We can concatenate this with the value of a variable, in this case `year` " +"by\n" +" using the plus `+` sign and the variable we want to add to the file name: `" +"+\n" +" str(year)`\n" +"* Then we add the file extension as another text string: `+ '.csv'`" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:283 +msgid "" +"Notice that we use single quotes to add text strings. The variable is not\n" +"surrounded by quotes. This code produces the string\n" +"`data/yearly_files/surveys2002.csv` which contains the path to the new " +"filename\n" +"AND the file name itself." +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:288 +msgid "> ## Challenge - Modifying loops" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:289 +msgid "" +">\n" +"> 1. Some of the surveys you saved are missing data (they have null values " +"that\n" +"> show up as NaN - Not A Number - in the DataFrames and do not show up in " +"the text\n" +"> files). Modify the for loop so that the entries with null values are not\n" +"> included in the yearly files.\n" +">\n" +"> 2. Let's say you only want to look at data from a given multiple of years. " +"How would you modify your loop in order to generate a data file for only " +"every 5th year, starting from 1977?\n" +">\n" +"> 3. Instead of splitting out the data by years, a colleague wants to do " +"analyses each species separately. How would you write a unique CSV file for " +"each species?" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:300 +msgid "## Building reusable and modular code with functions" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:302 +msgid "" +"Suppose that separating large data files into individual yearly files is a " +"task\n" +"that we frequently have to perform. We could write a **for loop** like the " +"one above\n" +"every time we needed to do it but that would be time consuming and error " +"prone.\n" +"A more elegant solution would be to create a reusable tool that performs " +"this\n" +"task with minimum input from the user. To do this, we are going to turn the " +"code\n" +"we've already written into a function." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:309 +msgid "" +"Functions are reusable, self-contained pieces of code that are called with " +"a\n" +"single command. They can be designed to accept arguments as input and " +"return\n" +"values, but they don't need to do either. Variables declared inside " +"functions\n" +"only exist while the function is running and if a variable within the " +"function\n" +"(a local variable) has the same name as a variable somewhere else in the " +"code,\n" +"the local variable hides but doesn't overwrite the other." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:316 +msgid "" +"Every method used in Python (for example, `print`) is a function, and the\n" +"libraries we import (say, `pandas`) are a collection of functions. We will " +"only\n" +"use functions that are housed within the same code that uses them, but it's " +"also\n" +"easy to write functions that can be used by different programs." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:321 +msgid "Functions are declared following this general structure:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:323 +msgid "" +"~~~\n" +"def this_is_the_function_name(input_argument1, input_argument2):\n" +"\n" +" # The body of the function is indented\n" +" # This function prints the two arguments to screen\n" +" print('The function arguments are:', input_argument1, input_argument2, " +"'(this is done inside the function!)')\n" +"\n" +" # And returns their product\n" +" return input_argument1 * input_argument2\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:335 +msgid "" +"The function declaration starts with the word `def`, followed by the " +"function\n" +"name and any arguments in parenthesis, and ends in a colon. The body of the\n" +"function is indented just like loops are. If the function returns something " +"when\n" +"it is called, it includes a return statement at the end." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:340 +msgid "This is how we call the function:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:342 +msgid "" +"~~~\n" +"product_of_inputs = this_is_the_function_name(2,5)\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:347 +msgid "" +"~~~\n" +"The function arguments are: 2 5 (this is done inside the function!)\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:352 +msgid "" +"~~~\n" +"print('Their product is:', product_of_inputs, '(this is done outside the " +"function!)')\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:357 +msgid "" +"~~~\n" +"Their product is: 10 (this is done outside the function!)\n" +"~~~" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:362 +msgid "> ## Challenge - Functions" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:363 +msgid "" +">\n" +"> 1. Change the values of the arguments in the function and check its " +"output\n" +"> 2. Try calling the function by giving it the wrong number of arguments " +"(not 2)\n" +"> or not assigning the function call to a variable (no `product_of_inputs " +"=`)\n" +"> 3. Declare a variable inside the function and test to see where it exists " +"(Hint:\n" +"> can you print it from outside the function?)\n" +"> 4. Explore what happens when a variable both inside and outside the " +"function\n" +"> have the same name. What happens to the global variable when you change " +"the\n" +"> value of the local variable?" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:374 +msgid "" +"We can now turn our code for saving yearly data files into a function. There " +"are\n" +"many different \"chunks\" of this code that we can turn into functions, and " +"we can\n" +"even create functions that call other functions inside them. Let's first " +"write a\n" +"function that separates data for just one year and saves that data to a file:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:379 +msgid "" +"~~~\n" +"def one_year_csv_writer(this_year, all_data):\n" +" \"\"\"\n" +" Writes a csv file for data from a given year.\n" +"\n" +" this_year --- year for which data is extracted\n" +" all_data --- DataFrame with multi-year data\n" +" \"\"\"\n" +"\n" +" # Select data for the year\n" +" surveys_year = all_data[all_data.year == this_year]\n" +"\n" +" # Write the new DataFrame to a csv file\n" +" filename = 'data/yearly_files/function_surveys' + str(this_year) + '." +"csv'\n" +" surveys_year.to_csv(filename)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:397 +msgid "" +"The text between the two sets of triple double quotes is called a docstring " +"and\n" +"contains the documentation for the function. It does nothing when the " +"function\n" +"is running and is therefore not necessary, but it is good practice to " +"include\n" +"docstrings as a reminder of what the code does. Docstrings in functions " +"also\n" +"become part of their 'official' documentation:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:403 +msgid "" +"~~~\n" +"one_year_csv_writer?\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:408 +msgid "" +"~~~\n" +"one_year_csv_writer(2002, surveys_df)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:413 +msgid "" +"We changed the root of the name of the CSV file so we can distinguish it " +"from\n" +"the one we wrote before. Check the `yearly_files` directory for the file. " +"Did it\n" +"do what you expect?" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:417 +msgid "" +"What we really want to do, though, is create files for multiple years " +"without\n" +"having to request them one by one. Let's write another function that " +"replaces\n" +"the entire For loop by simply looping through a sequence of years and " +"repeatedly\n" +"calling the function we just wrote, `one_year_csv_writer`:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:423 +msgid "" +"~~~\n" +"def yearly_data_csv_writer(start_year, end_year, all_data):\n" +" \"\"\"\n" +" Writes separate CSV files for each year of data.\n" +"\n" +" start_year --- the first year of data we want\n" +" end_year --- the last year of data we want\n" +" all_data --- DataFrame with multi-year data\n" +" \"\"\"\n" +"\n" +" # \"end_year\" is the last year of data we want to pull, so we loop to " +"end_year+1\n" +" for year in range(start_year, end_year+1):\n" +" one_year_csv_writer(year, all_data)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:439 +msgid "" +"Because people will naturally expect that the end year for the files is the " +"last\n" +"year with data, the for loop inside the function ends at `end_year + 1`. By\n" +"writing the entire loop into a function, we've made a reusable tool for " +"whenever\n" +"we need to break a large data file into yearly files. Because we can specify " +"the\n" +"first and last year for which we want files, we can even use this function " +"to\n" +"create files for a subset of the years available. This is how we call this\n" +"function:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:447 +msgid "" +"~~~\n" +"# Load the data into a DataFrame\n" +"surveys_df = pd.read_csv('data/surveys.csv')\n" +"\n" +"# Create CSV files\n" +"yearly_data_csv_writer(1977, 2002, surveys_df)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:456 +msgid "" +"BEWARE! If you are using IPython Notebooks and you modify a function, you " +"MUST\n" +"re-run that cell in order for the changed function to be available to the " +"rest\n" +"of the code. Nothing will visibly happen when you do this, though, because\n" +"simply defining a function without *calling* it doesn't produce an output. " +"Any\n" +"cells that use the now-changed functions will also have to be re-run for " +"their\n" +"output to change." +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:463 +msgid "> ## Challenge- More functions" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:464 +msgid "" +">\n" +"> 1. Add two arguments to the functions we wrote that take the path of the\n" +"> directory where the files will be written and the root of the file " +"name.\n" +"> Create a new set of files with a different name in a different " +"directory.\n" +"> 2. How could you use the function `yearly_data_csv_writer` to create a CSV " +"file\n" +"> for only one year? (Hint: think about the syntax for `range`)\n" +"> 3. Make the functions return a list of the files they have written. There " +"are\n" +"> many ways you can do this (and you should try them all!): either of " +"the\n" +"> functions can print to screen, either can use a return statement to " +"give back\n" +"> numbers or strings to their function call, or you can use some " +"combination of\n" +"> the two. You could also try using the `os` library to list the contents " +"of\n" +"> directories.\n" +"> 4. Explore what happens when variables are declared inside each of the " +"functions\n" +"> versus in the main (non-indented) body of your code. What is the scope " +"of the\n" +"> variables (where are they visible)? What happens when they have the " +"same name\n" +"> but are given different values?" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:482 +msgid "" +"The functions we wrote demand that we give them a value for every argument.\n" +"Ideally, we would like these functions to be as flexible and independent as\n" +"possible. Let's modify the function `yearly_data_csv_writer` so that the\n" +"`start_year` and `end_year` default to the full range of the data if they " +"are\n" +"not supplied by the user. Arguments can be given default values with an " +"equal\n" +"sign in the function declaration. Any arguments in the function without " +"default\n" +"values (here, `all_data`) is a required argument and MUST come before the\n" +"argument with default values (which are optional in the function call)." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:491 +msgid "" +"~~~\n" +"def yearly_data_arg_test(all_data, start_year = 1977, end_year = 2002):\n" +" \"\"\"\n" +" Modified from yearly_data_csv_writer to test default argument values!\n" +"\n" +" start_year --- the first year of data we want --- default: 1977\n" +" end_year --- the last year of data we want --- default: 2002\n" +" all_data --- DataFrame with multi-year data\n" +" \"\"\"\n" +"\n" +" return start_year, end_year\n" +"\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, 1988, 1993)\n" +"print('Both optional arguments:\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df)\n" +"print('Default values:\\t\\t\\t', start, end)\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:512 +msgid "" +"~~~\n" +"Both optional arguments:\t1988 1993\n" +"Default values:\t\t1977 2002\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:518 +msgid "" +"The \"\\t\" in the `print` statements are tabs, used to make the text align " +"and be\n" +"easier to read." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:521 +msgid "" +"But what if our dataset doesn't start in 1977 and end in 2002? We can modify " +"the\n" +"function so that it looks for the start and end years in the dataset if " +"those\n" +"dates are not provided:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:525 +msgid "" +"~~~\n" +"def yearly_data_arg_test(all_data, start_year = None, end_year = None):\n" +" \"\"\"\n" +" Modified from yearly_data_csv_writer to test default argument values!\n" +"\n" +" start_year --- the first year of data we want --- default: None - check " +"all_data\n" +" end_year --- the last year of data we want --- default: None - check " +"all_data\n" +" all_data --- DataFrame with multi-year data\n" +" \"\"\"\n" +"\n" +" if start_year is None:\n" +" start_year = min(all_data.year)\n" +" if end_year is None:\n" +" end_year = max(all_data.year)\n" +"\n" +" return start_year, end_year\n" +"\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, 1988, 1993)\n" +"print('Both optional arguments:\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df)\n" +"print('Default values:\\t\\t\\t', start, end)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:549 +msgid "" +"{: .language-python}\n" +"~~~\n" +"Both optional arguments:\t1988 1993\n" +"Default values:\t\t1977 2002\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:556 +msgid "" +"The default values of the `start_year` and `end_year` arguments in the " +"function\n" +"`yearly_data_arg_test` are now `None`. This is a build-it constant in " +"Python\n" +"that indicates the absence of a value - essentially, that the variable " +"exists in\n" +"the namespace of the function (the directory of variable names) but that it\n" +"doesn't correspond to any existing object." +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:562 +msgid "> ## Challenge - Variables" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:563 +msgid "" +">\n" +"> 1. What type of object corresponds to a variable declared as `None`? " +"(Hint:\n" +"> create a variable set to `None` and use the function `type()`)\n" +">\n" +"> 2. Compare the behavior of the function `yearly_data_arg_test` when the\n" +"> arguments have `None` as a default and when they do not have default " +"values.\n" +">\n" +"> 3. What happens if you only include a value for `start_year` in the " +"function\n" +"> call? Can you write the function call with only a value for `end_year`? " +"(Hint:\n" +"> think about how the function must be assigning values to each of the " +"arguments -\n" +"> this is related to the need to put the arguments without default values " +"before\n" +"> those with default values in the function definition!)" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:577 +msgid "## If Statements" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:579 +msgid "" +"The body of the test function now has two conditionals (if statements) that\n" +"check the values of `start_year` and `end_year`. If statements execute a " +"segment\n" +"of code when some condition is met. They commonly look something like this:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:583 +msgid "" +"~~~\n" +"a = 5\n" +"\n" +"if a<0: # Meets first condition?\n" +"\n" +" # if a IS less than zero\n" +" print('a is a negative number')\n" +"\n" +"elif a>0: # Did not meet first condition. meets second condition?\n" +"\n" +" # if a ISN'T less than zero and IS more than zero\n" +" print('a is a positive number')\n" +"\n" +"else: # Met neither condition\n" +"\n" +" # if a ISN'T less than zero and ISN'T more than zero\n" +" print('a must be zero!')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:603 +msgid "Which would return:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:605 +msgid "" +"~~~\n" +"a is a positive number\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:610 +msgid "" +"Change the value of `a` to see how this function works. The statement " +"`elif`\n" +"means \"else if\", and all of the conditional statements must end in a colon." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:613 +msgid "" +"The if statements in the function `yearly_data_arg_test` check whether there " +"is an\n" +"object associated with the variable names `start_year` and `end_year`. If " +"those\n" +"variables are `None`, the if statements return the boolean `True` and " +"execute whatever\n" +"is in their body. On the other hand, if the variable names are associated " +"with\n" +"some value (they got a number in the function call), the if statements " +"return `False`\n" +"and do not execute. The opposite conditional statements, which would return\n" +"`True` if the variables were associated with objects (if they had received " +"value\n" +"in the function call), would be `if start_year` and `if end_year`." +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:622 +msgid "" +"As we've written it so far, the function `yearly_data_arg_test` associates\n" +"values in the function call with arguments in the function definition just " +"based\n" +"in their order. If the function gets only two values in the function call, " +"the\n" +"first one will be associated with `all_data` and the second with " +"`start_year`,\n" +"regardless of what we intended them to be. We can get around this problem " +"by\n" +"calling the function using keyword arguments, where each of the arguments in " +"the\n" +"function definition is associated with a keyword and the function call " +"passes\n" +"values to the function using these keywords:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:631 +msgid "" +"~~~\n" +"start,end = yearly_data_arg_test (surveys_df)\n" +"print('Default values:\\t\\t\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, 1988, 1993)\n" +"print('No keywords:\\t\\t\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, start_year = 1988, end_year = " +"1993)\n" +"print('Both keywords, in order:\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, end_year = 1993, start_year = " +"1988)\n" +"print('Both keywords, flipped:\\t\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, start_year = 1988)\n" +"print('One keyword, default end:\\t', start, end)\n" +"\n" +"start,end = yearly_data_arg_test (surveys_df, end_year = 1993)\n" +"print('One keyword, default start:\\t', start, end)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:650 +msgid "" +"{: .language-python}\n" +"~~~\n" +"Default values:\t\t1977 2002\n" +"No keywords:\t\t1988 1993\n" +"Both keywords, in order:\t1988 1993\n" +"Both keywords, flipped:\t1988 1993\n" +"One keyword, default end:\t1988 2002\n" +"One keyword, default start:\t1977 1993\n" +"~~~" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:661 +msgid "> ## Challenge - Modifying functions" +msgstr "" + +#: python-ecology-lesson/_episodes/06-loops-and-functions.md:662 +msgid "" +">\n" +"> 1. Rewrite the `one_year_csv_writer` and `yearly_data_csv_writer` " +"functions to\n" +"> have keyword arguments with default values\n" +">\n" +"> 2. Modify the functions so that they don't create yearly files if there is " +"no\n" +"> data for a given year and display an alert to the user (Hint: use " +"conditional\n" +"> statements to do this. For an extra challenge, use `try`\n" +"> statements!)\n" +">\n" +"> 3. The code below checks to see whether a directory exists and creates one " +"if it\n" +"> doesn't. Add some code to your function that writes out the CSV files, to " +"check\n" +"> for a directory to write to.\n" +">\n" +"> ~~~\n" +">if 'dir_name_here' in os.listdir('.'):\n" +"> print('Processed directory exists')\n" +">else:\n" +"> os.mkdir('dir_name_here')\n" +"> print('Processed directory created')\n" +"> ~~~\n" +"> {: .language-python }\n" +">\n" +"> 4. The code that you have written so far to loop through the years is " +"good,\n" +"> however it is not necessarily reproducible with different datasets.\n" +"> For instance, what happens to the code if we have additional years of " +"data\n" +"> in our CSV files? Using the tools that you learned in the previous " +"activities,\n" +"> make a list of all years represented in the data. Then create a loop to " +"process\n" +"> your data, that begins at the earliest year and ends at the latest year " +"using\n" +"> that list.\n" +">\n" +"> HINT: you can create a loop with a list as follows: `for years in " +"year_list:`" +msgstr "" + +# Front Matter +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:1 +msgid "" +"---\n" +"title: Making Plots With plotnine\n" +"teaching: 40\n" +"exercises: 50\n" +"questions:\n" +" - \"How can I visualize data in Python?\"\n" +" - \"What is 'grammar of graphics'?\"\n" +"objectives:\n" +" - \"Create a `plotnine` object.\"\n" +" - \"Set universal plot settings.\"\n" +" - \"Modify an existing plotnine object.\"\n" +" - \"Change the aesthetics of a plot such as color.\"\n" +" - \"Edit the axis labels.\"\n" +" - \"Build complex plots using a step-by-step approach.\"\n" +" - \"Create scatter plots, box plots, and time series plots.\"\n" +" - \"Use the facet_wrap and facet_grid commands to create a collection of " +"plots splitting the data by a factor variable.\"\n" +" - \"Create customized plot styles to meet their needs.\"\n" +"keypoints:\n" +" - \"The `data`, `aes` variables and a `geometry` are the main elements " +"of a plotnine graph\"\n" +" - \"With the `+` operator, additional `scale_*`, `theme_*`, `xlab/ylab` " +"and `facet_*` elements are added\"\n" +"---" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:23 +msgid "## Disclaimer" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:25 +msgid "" +"Python has powerful built-in plotting capabilities such as `matplotlib`, but " +"for\n" +"this episode, we will be using the [`plotnine`][plotnine]\n" +"package, which facilitates the creation of highly-informative plots of\n" +"structured data based on the R implementation of [`ggplot2`][ggplot2]\n" +"and [The Grammar of Graphics][grammar-of-graphics]\n" +"by Leland Wilkinson. The `plotnine`\n" +"package is built on top of Matplotlib and interacts well with Pandas." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:33 +msgid "" +"Just as with the other packages, `plotnine` need to be imported. It is good\n" +"practice to not just load an entire package such as `from plotnine import " +"*`,\n" +"but to use an abbreviation as we used `pd` for Pandas:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:37 +msgid "" +"~~~\n" +"%matplotlib inline\n" +"import plotnine as p9\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:43 +msgid "" +"From now on, the functions of `plotnine` are available using `p9.`. For the\n" +"exercise, we will use the `surveys.csv` data set, with the `NA` values " +"removed" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:46 +msgid "" +"~~~\n" +"import pandas as pd\n" +"\n" +"surveys_complete = pd.read_csv('data/surveys.csv')\n" +"surveys_complete = surveys_complete.dropna()\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:54 +msgid "## Plotting with plotnine" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:56 +msgid "" +"The `plotnine` package (cfr. other packages conform The Grammar of Graphics) " +"supports the creation of complex plots from data in a\n" +"dataframe. It uses default settings, which help creating publication " +"quality\n" +"plots with a minimal amount of settings and tweaking." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:60 +msgid "" +"`plotnine` graphics are built step by step by adding new elementsadding\n" +"different elements on top of each other using the `+` operator. Putting the\n" +"individual steps together in brackets `()` provides Python-compatible syntax." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:64 +msgid "To build a `plotnine` graphic we need to:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:66 +msgid "- Bind the plot to a specific data frame using the `data` argument:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:68 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete))\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:71 +msgid "" +"{: .language-python}\n" +"As we have not defined anything else, just an empty figure is available and\n" +"presented." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:75 +msgid "" +"As we have not defined anything else, just an empty figure is available and\n" +"presented." +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:78 +msgid "" +"- Define aesthetics (`aes`), by **selecting variables** used in the plot and" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:79 +msgid "" +"`mapping` them to a presentation such as plotting size, shape color, etc. " +"You\n" +"can interpret this as: *which** of the variables will influence the plotted\n" +"objects/geometries:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:83 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length')))\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:89 +msgid "" +"The most important aes mappings are: `x`, `y`, `alpha`, `color`, `colour`,\n" +"`fill`, `linetype`, `shape`, `size` and `stroke`." +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:92 +msgid "" +"- Still no specific data is plotted, as we have to define what kind of " +"geometry" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:93 +msgid "" +"will be used for the plot. The most straightforward is probably using " +"points.\n" +"Points is one of the `geoms` options, the graphical representation of the " +"data\n" +"in the plot. Others are lines, bars,... To add a geom to the plot use `+`\n" +"operator:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:98 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:157 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length'))\n" +" + p9.geom_point()\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:106 +msgid "" +"The `+` in the `plotnine` package is particularly useful because it allows " +"you\n" +"to modify existing `plotnine` objects. This means you can easily set up " +"plot\n" +"*templates* and conveniently explore different types of plots, so the above\n" +"plot can also be generated with code like this:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:112 +msgid "" +"~~~\n" +"# Create\n" +"surveys_plot = p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length'))\n" +"\n" +"# Draw the plot\n" +"surveys_plot + p9.geom_point()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:122 +msgid "![png](../fig/06_first_plot.png)" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:124 +msgid "> ## Challenge - bar chart" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:125 +msgid "" +"> Working on the `surveys_complete` data set, use the `plot-id` column to" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:126 +msgid "" +"> create a `bar`-plot that counts the number of records for each plot. (Check" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:127 +msgid "> the documentation of the bar geometry to handle the counts)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:128 +msgid "" +">\n" +"> > ## Answers\n" +"> >\n" +"> > ~~~\n" +"> > (p9.ggplot(data=surveys_complete,\n" +"> > mapping=p9.aes(x='plot_id'))\n" +"> > + p9.geom_bar()\n" +"> > )\n" +"> > ~~~\n" +"> > {: .language-python}\n" +"> >\n" +"> > ![png](../fig/06_challenge_bar.png)" +msgstr "" + +# SC/DC Template label +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:140 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:275 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:344 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:485 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:505 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:326 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:356 +msgid "> {: .solution}" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:143 +msgid "Notes:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:145 +msgid "" +"- Anything you put in the `ggplot()` function can be seen by any geom layers" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:146 +msgid "" +"that you add (i.e., these are universal plot settings). This includes the " +"`x`\n" +"and `y` axis you set up in `aes()`.\n" +"- You can also specify aesthetics for a given `geom` independently of the\n" +"aesthetics defined globally in the `ggplot()` function." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:151 +msgid "## Building your plots iteratively" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:153 +msgid "" +"Building plots with `plotnine` is typically an iterative process. We start " +"by\n" +"defining the dataset we'll use, lay the axes, and choose a geom. Hence, the\n" +"`data`, `aes` and `geom-*` are the elementary elements of any graph:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:165 +msgid "" +"Then, we start modifying this plot to extract more information from it. For\n" +"instance, we can add transparency (alpha) to avoid overplotting:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:169 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length'))\n" +" + p9.geom_point(alpha=0.1)\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:177 +msgid "![png](../fig/06_alpha_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:179 +msgid "We can also add colors for all the points" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:182 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length'))\n" +" + p9.geom_point(alpha=0.1, color='blue')\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:190 +msgid "![png](../fig/06_blue_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:192 +msgid "" +"Or to color each species in the plot differently, map the `species_id` " +"column\n" +"to the color aesthetic:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:195 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:407 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight',\n" +" y='hindfoot_length',\n" +" color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:205 +msgid "![png](../fig/06_color_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:207 +msgid "" +"Apart from the adaptations of the arguments and settings of the `data`, " +"`aes`\n" +"and `geom-*` elements, additional elements can be added as well, using the `" +"+`\n" +"operator:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:211 +msgid "- Changing the labels:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:213 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length', " +"color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +" + p9.xlab(\"Weight (g)\")\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:222 +msgid "![png](../fig/06_color_label_plot.png)" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:224 +msgid "" +"- Defining scale for colors, axes,... For example, a log-version of the x-" +"axis" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:225 +msgid "could support the interpretation of the lower numbers:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:227 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length', " +"color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +" + p9.xlab(\"Weight (g)\")\n" +" + p9.scale_x_log10()\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:237 +msgid "![png](../fig/06_log_plot.png)" +msgstr "" + +# unordered list +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:239 +msgid "" +"- Changing the theme (`theme_*`) or some specific theming (`theme`) elements." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:240 +msgid "" +"Usually plots with white background look more readable when printed. We " +"can\n" +"set the background to white using the function `theme_bw()`." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:243 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length', " +"color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +" + p9.xlab(\"Weight (g)\")\n" +" + p9.scale_x_log10()\n" +" + p9.theme_bw()\n" +" + p9.theme(text=p9.element_text(size=16))\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:255 +msgid "![png](../fig/06_white_plot.png)" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:257 +msgid "> ## Challenge - Bar plot adaptations" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:258 +msgid "" +"> Adapt the bar plot of the previous exercise by mapping the `sex` variable " +"to" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:259 +msgid "" +"> the color fill of the bar chart. Change the `scale` of the color fill by" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:260 +msgid "> providing the colors `blue` and `orange` manually" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:261 +msgid "> (see [API reference][plotnine-api] to find the appropriate function)." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:262 +msgid "" +">\n" +"> > ## Answers\n" +"> >\n" +"> > ~~~\n" +"> > (p9.ggplot(data=surveys_complete,\n" +"> > mapping=p9.aes(x='plot_id',\n" +"> > fill='sex'))\n" +"> > + p9.geom_bar()\n" +"> > + p9.scale_fill_manual([\"blue\", \"orange\"])\n" +"> > )\n" +"> > ~~~\n" +"> > {: .language-python}\n" +"> > ![png](../fig/06_challenge_color_bar.png)" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:279 +msgid "## Plotting distributions" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:281 +msgid "" +"Visualizing distributions is a common task during data exploration and\n" +"analysis. To visualize the distribution of `weight` within each " +"`species_id`\n" +"group, a boxplot can be used:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:285 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='species_id',\n" +" y='weight'))\n" +" + p9.geom_boxplot()\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:294 +msgid "![png](../fig/06_boxplot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:296 +msgid "" +"By adding points of the individual observations to the boxplot, we can have " +"a\n" +"better idea of the number of measurements and of their distribution:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:299 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='species_id',\n" +" y='weight'))\n" +" + p9.geom_jitter(alpha=0.2)\n" +" + p9.geom_boxplot(alpha=0.)\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:309 +msgid "![png](../fig/06_point_boxplot.png)" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:311 +msgid "> ## Challenge - distributions" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:312 +msgid "" +">\n" +"> Boxplots are useful summaries, but hide the *shape* of the distribution.\n" +"> For example, if there is a bimodal distribution, this would not be " +"observed\n" +"> with a boxplot. An alternative to the boxplot is the violin plot " +"(sometimes\n" +"> known as a beanplot), where the shape (of the density of points) is " +"drawn.\n" +">\n" +"> In many types of data, it is important to consider the *scale* of the\n" +"> observations. For example, it may be worth changing the scale of the " +"axis\n" +"> to better distribute the observations in the space of the plot.\n" +">\n" +"> - Replace the box plot with a violin plot, see `geom_violin()`\n" +"> - Represent weight on the log10 scale, see `scale_y_log10()`\n" +"> - Add color to the datapoints on your boxplot according to the plot from " +"which\n" +"> the sample was taken (`plot_id`)\n" +">\n" +"> Hint: Check the class for `plot_id`. By using `factor()` within the `aes`\n" +"> mapping of a variable, `plotnine` will handle the values as category " +"values.\n" +">\n" +"> > ## Answers\n" +"> >\n" +"> > ~~~\n" +"> > (p9.ggplot(data=surveys_complete,\n" +"> > mapping=p9.aes(x='species_id',\n" +"> > y='weight',\n" +"> > color='factor(plot_id)'))\n" +"> > + p9.geom_jitter(alpha=0.3)\n" +"> > + p9.geom_violin(alpha=0, color=\"0.7\")\n" +"> > + p9.scale_y_log10()\n" +"> > )\n" +"> > ~~~\n" +"> > {: .language-python}\n" +"> > ![png](../fig/06_challenge_boxplot.png)" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:348 +msgid "## Plotting time series data" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:350 +msgid "" +"Let's calculate number of counts per year for each species. To do that we " +"need\n" +"to group data first and count the species (`species_id`) within each group." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:353 +msgid "" +"~~~\n" +"yearly_counts = surveys_complete.groupby(['year', 'species_id'])" +"['species_id'].count()\n" +"yearly_counts\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:359 +msgid "" +"When checking the result of the previous calculation, we actually have both " +"the\n" +"`year` and the `species_id` as a row index. We can reset this index to use " +"both\n" +"as column variable:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:363 +msgid "" +"~~~\n" +"yearly_counts = yearly_counts.reset_index(name='counts')\n" +"yearly_counts\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:369 +msgid "" +"Timelapse data can be visualised as a line plot (`geom_line`) with years on " +"`x`\n" +"axis and counts on the `y` axis." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:373 +msgid "" +"~~~\n" +"(p9.ggplot(data=yearly_counts,\n" +" mapping=p9.aes(x='year',\n" +" y='counts'))\n" +" + p9.geom_line()\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:382 +msgid "" +"Unfortunately this does not work, because we plot data for all the species\n" +"together. We need to tell `plotnine` to draw a line for each species by\n" +"modifying the aesthetic function and map the species_id to the color:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:386 +msgid "" +"~~~\n" +"(p9.ggplot(data=yearly_counts,\n" +" mapping=p9.aes(x='year',\n" +" y='counts',\n" +" color='species_id'))\n" +" + p9.geom_line()\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:396 +msgid "![png](../fig/06_time_plot.png)" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:398 +msgid "## Faceting" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:400 +msgid "" +"As any other library supporting the Grammar of Graphics, `plotnine` has a\n" +"special technique called *faceting* that allows to split one plot into " +"multiple\n" +"plots based on a factor variable included in the dataset." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:404 +msgid "" +"Consider our scatter plot of the `weight` versus the `hindfoot_length` from " +"the\n" +"previous sections:" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:417 +msgid "" +"We can now keep the same code and at the `facet_wrap` on a chosen variable " +"to\n" +"split out the graph and make a separate graph for each of the groups in " +"that\n" +"variable. As an example, use `sex`:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:421 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight',\n" +" y='hindfoot_length',\n" +" color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +" + p9.facet_wrap(\"sex\")\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:430 +msgid "" +"{: .language-python}\n" +"![png](../fig/06_facet_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:433 +msgid "" +"We can apply the same concept on any of the available categorical variables:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:435 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight',\n" +" y='hindfoot_length',\n" +" color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +" + p9.facet_wrap(\"plot_id\")\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:446 +msgid "![png](../fig/06_facet_all_plot.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:448 +msgid "" +"The `facet_wrap` geometry extracts plots into an arbitrary number of " +"dimensions\n" +"to allow them to cleanly fit on one page. On the other hand, the " +"`facet_grid`\n" +"geometry allows you to explicitly specify how you want your plots to be\n" +"arranged via formula notation (`rows ~ columns`; a `.` can be used as a\n" +"placeholder that indicates only one row or column)." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:454 +msgid "" +"~~~\n" +"# only select the years of interest\n" +"survey_2000 = surveys_complete[surveys_complete[\"year\"].isin([2000, " +"2001])]\n" +"\n" +"(p9.ggplot(data=survey_2000,\n" +" mapping=p9.aes(x='weight',\n" +" y='hindfoot_length',\n" +" color='species_id'))\n" +" + p9.geom_point(alpha=0.1)\n" +" + p9.facet_grid(\"year ~ sex\")\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:466 +msgid "" +"{: .language-python}\n" +"![png](../fig/06_select_plot.png)" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:469 +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:489 +msgid "> ## Challenge - facetting" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:470 +msgid "" +"> Create a separate plot for each of the species that depicts how the average" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:471 +msgid "> weight of the species changes through the years." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:472 +msgid "" +">\n" +"> > ## Answers\n" +"> > yearly_weight = surveys_complete.groupby(['year', 'species_id'])" +"['weight'].mean().reset_index()\n" +"> >\n" +"> > ~~~\n" +"> > (p9.ggplot(data=yearly_weight,\n" +"> > mapping=p9.aes(x='year',\n" +"> > y='weight'))\n" +"> > + p9.geom_line()\n" +"> > + p9.facet_wrap(\"species_id\")\n" +"> > )\n" +"> > ~~~\n" +"> > {: .language-python}" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:490 +msgid "" +"> Based on the previous exercise, visually compare how the weights of male " +"and" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:491 +msgid "" +"> females has changed through time by creating a separate plot for each sex " +"and" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:492 +msgid "> an individual color assigned to each `species_id`." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:493 +msgid "" +">\n" +"> > ## Answers\n" +"> > yearly_weight = surveys_complete.groupby(['year', 'species_id', 'sex'])" +"['weight'].mean().reset_index()\n" +"> >\n" +"> > (p9.ggplot(data=yearly_weight,\n" +"> > mapping=p9.aes(x='year',\n" +"> > y='weight',\n" +"> > color='species_id'))\n" +"> > + p9.geom_line()\n" +"> > + p9.facet_wrap(\"sex\")\n" +"> > )\n" +"> > {: .language-python}" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:509 +msgid "## Further customization" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:511 +msgid "" +"As the syntax of `plotnine` follows the original R package `ggplot2`, the\n" +"documentation of `ggplot2` can provide information and inspiration to " +"customize\n" +"graphs. Take a look at the `ggplot2` [cheat sheet][ggplot2-cheat-sheet], and " +"think of ways to\n" +"improve the plot. You can write down some of your ideas as comments in the " +"Etherpad." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:516 +msgid "" +"The theming options provide a rich set of visual adaptations. Consider the\n" +"following example of a bar plot with the counts per year." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:519 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='factor(year)'))\n" +" + p9.geom_bar()\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:527 +msgid "![png](../fig/06_overlap_bars.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:529 +msgid "" +"Notice that we use the `year` here as a categorical variable by using the\n" +"`factor` functionality. However, by doing so, we have the individual year\n" +"labels overlapping with each other. The `theme` functionality provides a way " +"to\n" +"rotate the text of the x-axis labels:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:534 +msgid "" +"~~~\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='factor(year)'))\n" +" + p9.geom_bar()\n" +" + p9.theme_bw()\n" +" + p9.theme(axis_text_x = p9.element_text(angle=90))\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:544 +msgid "![png](../fig/06_good_bars.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:546 +msgid "" +"When you like a specific set of theme-customizations you created, you can " +"save\n" +"them as an object to easily apply them to other plots you may create:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:550 +msgid "" +"~~~\n" +"my_custom_theme = p9.theme(axis_text_x = p9.element_text(color=\"grey\", " +"size=10,\n" +" angle=90, " +"hjust=.5),\n" +" axis_text_y = p9.element_text(color=\"grey\", " +"size=10))\n" +"(p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='factor(year)'))\n" +" + p9.geom_bar()\n" +" + my_custom_theme\n" +")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:562 +msgid "![png](../fig/06_theme_plot.png)" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:564 +msgid "> ## Challenge - customization" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:565 +msgid "> Please take another five minutes to either improve one of the plots" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:566 +msgid "> generated in this exercise or create a beautiful graph of your own." +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:567 +msgid "" +">\n" +"> Here are some ideas:\n" +">\n" +"> * See if you can change thickness of lines for the line plot .\n" +"> * Can you find a way to change the name of the legend? What about its " +"labels?\n" +"> * Use a different color palette (see )" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:576 +msgid "" +"After creating your plot, you can save it to a file in your favourite " +"format.\n" +"You can easily change the dimension (and its resolution) of your plot by\n" +"adjusting the appropriate arguments (`width`, `height` and `dpi`):" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:581 +msgid "" +"~~~\n" +"my_plot = (p9.ggplot(data=surveys_complete,\n" +" mapping=p9.aes(x='weight', y='hindfoot_length'))\n" +" + p9.geom_point()\n" +")\n" +"my_plot.save(\"scatterplot.png\", width=10, height=10, dpi=300)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/07-visualization-ggplot-python.md:590 +msgid "" +"[ggplot2-cheat-sheet]: https://www.rstudio.com/wp-content/uploads/2015/08/" +"ggplot2-cheatsheet.pdf\n" +"[ggplot2]: https://ggplot2.tidyverse.org\n" +"[grammar-of-graphics]: http://link.springer.com/" +"book/10.1007%2F0-387-28695-0\n" +"[plotnine-api]: https://plotnine.readthedocs.io/en/stable/api.html#color-and-" +"fill-scales\n" +"[plotnine]: https://plotnine.readthedocs.io/en/stable" +msgstr "" + +# Front Matter +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:1 +msgid "" +"---\n" +"title: Data Ingest and Visualization - Matplotlib and Pandas\n" +"teaching: 40\n" +"exercises: 65\n" +"questions:\n" +" - \"What other tools can I use to create plots apart from ggplot?\"\n" +" - \"Why should I use Python to create plots?\"\n" +"objectives:\n" +" - \"Import the pyplot toolbox to create figures in Python.\"\n" +" - \"Use matplotlib to make adjustments to Pandas or plotnine objects.\"\n" +"keypoints:\n" +" - \"Matplotlib is the engine behind plotnine and Pandas plots.\"\n" +" - \"Object-based nature of matplotlib plots enables their detailed " +"customization after they have been created.\"\n" +" - \"Export plots to a file using the `savefig` method.\"\n" +"---" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:18 +msgid "## Putting it all together" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:20 +msgid "" +"Up to this point, we have walked through tasks that are often\n" +"involved in handling and processing data using the workshop ready cleaned\n" +"files that we have provided. In this wrap-up exercise, we will perform\n" +"many of the same tasks with real data sets. This lesson also covers data\n" +"visualization." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:26 +msgid "" +"As opposed to the previous ones, this lesson does not give step-by-step\n" +"directions to each of the tasks. Use the lesson materials you've already " +"gone\n" +"through as well as the Python documentation to help you along." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:30 +msgid "## Obtain data" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:32 +msgid "" +"There are many repositories online from which you can obtain data. We are\n" +"providing you with one data file to use with these exercises, but feel free " +"to\n" +"use any data that is relevant to your research. The file\n" +"[`bouldercreek_09_2013.txt`]({{ page.root }}/data/bouldercreek_09_2013.txt)\n" +"contains stream discharge data, summarized at 15\n" +"15 minute intervals (in cubic feet per second) for a streamgage on Boulder\n" +"Creek at North 75th Street (USGS gage06730200) for 1-30 September 2013. If " +"you'd\n" +"like to use this dataset, please find it in the data folder." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:41 +msgid "## Clean up your data and open it using Python and Pandas" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:43 +msgid "" +"To begin, import your data file into Python using Pandas. Did it fail? Your " +"data\n" +"file probably has a header that Pandas does not recognize as part of the " +"data\n" +"table. Remove this header, but do not simply delete it in a text editor! " +"Use\n" +"either a shell script or Python to do this - you wouldn't want to do it by " +"hand\n" +"if you had many files to process." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:49 +msgid "" +"If you are still having trouble importing the data as a table using Pandas,\n" +"check the documentation. You can open the docstring in an ipython notebook " +"using\n" +"a question mark. For example:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:53 +msgid "" +"~~~\n" +"import pandas as pd\n" +"pd.read_csv?\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:59 +msgid "" +"Look through the function arguments to see if there is a default value that " +"is\n" +"different from what your file requires (Hint: the problem is most likely " +"the\n" +"delimiter or separator. Common delimiters are `','` for comma, `' '` for " +"space,\n" +"and `'\\t'` for tab)." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:64 +msgid "" +"Create a DataFrame that includes only the values of the data that are useful " +"to\n" +"you. In the streamgage file, those values might be the date, time, and " +"discharge\n" +"measurements. Convert any measurements in imperial units into SI units. You " +"can\n" +"also change the name of the columns in the DataFrame like this:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:69 +msgid "" +"~~~\n" +"df = pd.DataFrame({'1stcolumn':[100,200], '2ndcolumn':[10,20]}) # this just " +"creates a DataFrame for the example!\n" +"print('With the old column names:\\n') # the \\n makes a new line, so it's " +"easier to see\n" +"print(df)\n" +"\n" +"df.columns = ['FirstColumn','SecondColumn'] # rename the columns!\n" +"print('\\n\\nWith the new column names:\\n')\n" +"print(df)\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:80 +msgid "" +"~~~\n" +"With the old column names:\n" +"\n" +" 1stcolumn 2ndcolumn\n" +"0 100 10\n" +"1 200 20\n" +"\n" +"\n" +"With the new column names:\n" +"\n" +" FirstColumn SecondColumn\n" +"0 100 10\n" +"1 200 20\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:96 +msgid "## Matplotlib package" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:98 +msgid "" +"[Matplotlib](https://matplotlib.org/) is a Python package that is widely " +"used throughout the scientific Python community to create high-quality and " +"publication-ready graphics. It supports a wide range of raster and vector " +"graphics formats including PNG, PostScript, EPS, PDF and SVG." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:100 +msgid "" +"Moreover, matplotlib is the actual engine behind the plotting capabilities " +"of both Pandas and plotnine packages. For example, when we call the `.plot` " +"method on Pandas data objects, we actually use the matplotlib package." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:102 +msgid "First, import the pyplot toolbox:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:104 +msgid "" +"~~~\n" +"import matplotlib.pyplot as plt\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:109 +msgid "Now, let's read data and plot it!" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:111 +msgid "" +"~~~\n" +"surveys = pd.read_csv(\"data/surveys.csv\")\n" +"my_plot = surveys.plot(\"hindfoot_length\", \"weight\", kind=\"scatter\")\n" +"plt.show() # not necessary in Jupyter Notebooks\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:118 +msgid "![Scatter plot of survey data set](../fig/08_scatter_surveys.png)" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:120 +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:134 +msgid "> ## Tip" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:121 +msgid "" +"> By default, matplotlib creates a figure in a separate window. When using" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:122 +msgid "" +"> Jupyter notebooks, we can make figures appear in-line within the notebook " +"by" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:123 +msgid "> executing:" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:124 +msgid "" +">\n" +"> ~~~\n" +"> %matplotlib inline\n" +"> ~~~\n" +"> {: .language-python}" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:131 +msgid "" +"The returned object is a matplotlib object (check it yourself with " +"`type(my_plot)`),\n" +"to which we may make further adjustments and refinements using other " +"matplotlib methods." +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:135 +msgid "> Matplotlib itself can be overwhelming, so a useful strategy is to" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:136 +msgid "> do as much as you easily can in a convenience layer, _i.e._ start" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:137 +msgid "> creating the plot in Pandas or plotnine, and then use matplotlib" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:138 +msgid "> for the rest." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:141 +msgid "" +"We will cover a few basic commands for creating and formatting plots with " +"matplotlib in this lesson.\n" +"A great resource for help creating and styling your figures is the " +"matplotlib gallery\n" +"(), which includes plots in many " +"different\n" +"styles and the source codes that create them." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:147 +msgid "### `plt` pyplot versus object-based matplotlib" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:149 +msgid "" +"Matplotlib integrates nicely with the NumPy package and can use NumPy " +"arrays\n" +"as input to the available plot functions. Consider the following example " +"data,\n" +"created with NumPy by drawing 1000 samples from a normal distribution with a " +"mean value of 0 and\n" +"a standard deviation of 0.1:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:154 +msgid "" +"~~~\n" +"import numpy as np\n" +"sample_data = np.random.normal(0, 0.1, 1000)\n" +"\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:161 +msgid "" +"To plot a histogram of our draws from the normal distribution, we can use " +"the `hist` function directly:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:163 +msgid "" +"~~~\n" +"plt.hist(sample_data)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:168 +msgid "" +"![Histogram of 1000 samples from normal distribution](../fig/08-normal-" +"distribution.png)" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:170 +msgid "> ## Tip: Cross-Platform Visualization of Figures" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:171 +msgid "" +"> Jupyter Notebooks make many aspects of data analysis and visualization " +"much simpler. This includes" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:172 +msgid "" +"> doing some of the labor of visualizing plots for you. But, not every one " +"of your collaborators" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:173 +msgid "" +"> will be using a Jupyter Notebook. The `.show()` command allows you to " +"visualize plots" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:174 +msgid "" +"> when working at the command line, with a script, or at the IPython " +"interpreter. In the" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:175 +msgid "" +"> previous example, adding `plt.show()` after the creation of the plot will " +"enable your" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:176 +msgid "" +"> colleagues who aren't using a Jupyter notebook to reproduce your work on " +"their platform." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:179 +msgid "" +"or create matplotlib `figure` and `axis` objects first and subsequently add " +"a histogram with 30\n" +"data bins:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:182 +msgid "" +"~~~\n" +"fig, ax = plt.subplots() # initiate an empty figure and axis matplotlib " +"object\n" +"ax.hist(sample_data, 30)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:188 +msgid "" +"Although the latter approach requires a little bit more code to create the " +"same plot,\n" +"the advantage is that it gives us **full control** over the plot and we can " +"add new items\n" +"such as labels, grid lines, title, and other visual elements. For example, " +"we can add\n" +"additional axes to the figure and customize their labels:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:193 +msgid "" +"~~~\n" +"fig, ax1 = plt.subplots() # prepare a matplotlib figure\n" +"ax1.hist(sample_data, 30)\n" +"\n" +"# Add a plot of a Beta distribution\n" +"a = 5\n" +"b = 10\n" +"beta_draws = np.random.beta(a, b)\n" +"# adapt the labels\n" +"ax1.set_ylabel('density')\n" +"ax1.set_xlabel('value')\n" +"\n" +"# add additional axes to the figure\n" +"ax2 = fig.add_axes([0.125, 0.575, 0.3, 0.3])\n" +"#ax2 = fig.add_axes([left, bottom, right, top])\n" +"ax2.hist(beta_draws)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:212 +msgid "![Plot with additional axes](../fig/08-dualdistribution.png)" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:214 +msgid "> ## Challenge - Drawing from distributions" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:215 +msgid "> Have a look at the NumPy" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:216 +msgid "" +"> random documentation ." +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:217 +msgid "" +"> Choose a distribution you have no familiarity with, and try to sample from " +"and visualize it." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:222 +msgid "### Link matplotlib, Pandas and plotnine" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:224 +msgid "" +"When we create a plot using pandas or plotnine, both libraries use " +"matplotlib\n" +"to create those plots. The plots created in pandas or plotnine are " +"matplotlib\n" +"objects, which enables us to use some of the advanced plotting options " +"available\n" +"in the matplotlib library. Because the objects output by pandas and " +"plotnine\n" +"can be read by matplotlib, we have many more options than any one library " +"can\n" +"provide, offering a consistent environment to make publication-quality " +"visualizations." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:231 +msgid "" +"~~~\n" +"fig, ax1 = plt.subplots() # prepare a matplotlib figure\n" +"\n" +"surveys.plot(\"hindfoot_length\", \"weight\", kind=\"scatter\", ax=ax1)\n" +"\n" +"# Provide further adaptations with matplotlib:\n" +"ax1.set_xlabel(\"Hindfoot length\")\n" +"ax1.tick_params(labelsize=16, pad=8)\n" +"fig.suptitle('Scatter plot of weight versus hindfoot length', fontsize=15)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:243 +msgid "" +"![Extended version of scatter plot surveys](../" +"fig/08_scatter_surveys_extended.png)" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:245 +msgid "" +"To retrieve the matplotlib figure object from plotnine for customization, " +"use the `draw()` function in plotnine:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:247 +msgid "" +"~~~\n" +"import plotnine as p9\n" +"myplot = (p9.ggplot(data=surveys,\n" +" mapping=p9.aes(x='hindfoot_length', y='weight')) +\n" +" p9.geom_point())\n" +"\n" +"# convert output plotnine to a matplotlib object\n" +"my_plt_version = myplot.draw()\n" +"\n" +"# Provide further adaptations with matplotlib:\n" +"p9_ax = my_plt_version.axes[0] # each subplot is an item in a list\n" +"p9_ax.set_xlabel(\"Hindfoot length\")\n" +"p9_ax.tick_params(labelsize=16, pad=8)\n" +"p9_ax.set_title('Scatter plot of weight versus hindfoot length', " +"fontsize=15)\n" +"plt.show() # not necessary in Jupyter Notebooks\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:265 +msgid "" +"![Extended version of plotnine scatter plot](../" +"fig/08_scatter_surveys_plotnine.png)" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:267 +msgid "> ## Challenge - Pandas and matplotlib" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:268 +msgid "" +"> Load the streamgage data set with Pandas, subset the week of the 2013 " +"Front Range flood" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:269 +msgid "" +"> (September 11 through 15) and create a hydrograph (line plot) of the " +"discharge data using" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:270 +msgid "" +"> Pandas, linking it to an empty maptlotlib `ax` object. Create a second " +"axis that displays the" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:271 +msgid "> whole dataset. Adapt the title and axes' labels using matplotlib." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:272 +msgid "" +">\n" +"> > ## Answers\n" +"> >\n" +"> > ~~~\n" +"> > discharge = pd.read_csv(\"data/bouldercreek_09_2013.txt\",\n" +"> > skiprows=27, delimiter=\"\\t\",\n" +"> > names=[\"agency\", \"site_id\", \"datetime\",\n" +"> > \"timezone\", \"discharge\", " +"\"discharge_cd\"])\n" +"> > discharge[\"datetime\"] = pd.to_datetime(discharge[\"datetime\"])\n" +"> > front_range = discharge[(discharge[\"datetime\"] >= \"2013-09-09\") &\n" +"> > (discharge[\"datetime\"] < \"2013-09-15\")]\n" +"> >\n" +"> > fig, ax = plt.subplots()\n" +"> > front_range.plot(x =\"datetime\", y=\"discharge\", ax=ax)\n" +"> > ax.set_xlabel(\"\") # no label\n" +"> > ax.set_ylabel(\"Discharge, cubic feet per second\")\n" +"> > ax.set_title(\" Front Range flood event 2013\")\n" +"> > discharge = pd.read_csv(\"../data/bouldercreek_09_2013.txt\",\n" +"> > skiprows=27, delimiter=\"\\t\",\n" +"> > names=[\"agency\", \"site_id\", \"datetime\",\n" +"> > \"timezone\", \"flow_rate\", \"height\"])\n" +"> > fig, ax = plt.subplots()\n" +"> > flood = discharge[(discharge[\"datetime\"] >= \"2013-09-11\") &\n" +"> > (discharge[\"datetime\"] < \"2013-09-15\")]\n" +"> >\n" +"> > ax2 = fig.add_axes([0.65, 0.575, 0.25, 0.3])\n" +"> > flood.plot(x =\"datetime\", y=\"flow_rate\", ax=ax)\n" +"> > discharge.plot(x =\"datetime\", y=\"flow_rate\", ax=ax2)\n" +"> > ax2.legend().set_visible(False)\n" +"> > ax.set_xlabel(\"\") # no label\n" +"> > ax.set_ylabel(\"Discharge, cubic feet per second\")\n" +"> > ax.legend().set_visible(False)\n" +"> > ax.set_title(\" Front Range flood event 2013\")\n" +"> > discharge = pd.read_csv(\"../data/bouldercreek_09_2013.txt\",\n" +"> > skiprows=27, delimiter=\"\\t\",\n" +"> > names=[\"agency\", \"site_id\", \"datetime\",\n" +"> > \"timezone\", \"flow_rate\", \"height\"])\n" +"> > fig, ax = plt.subplots()\n" +"> > flood = discharge[(discharge[\"datetime\"] >= \"2013-09-11\") &\n" +"> > (discharge[\"datetime\"] < \"2013-09-15\")]\n" +"> >\n" +"> > ax2 = fig.add_axes([0.65, 0.575, 0.25, 0.3])\n" +"> > flood.plot(x =\"datetime\", y=\"flow_rate\", ax=ax)\n" +"> > discharge.plot(x =\"datetime\", y=\"flow_rate\", ax=ax2)\n" +"> > ax2.legend().set_visible(False)\n" +"> >\n" +"> > ax.set_xlabel(\"\") # no label\n" +"> > ax.set_ylabel(\"Discharge, cubic feet per second\")\n" +"> > ax.legend().set_visible(False)\n" +"> > ax.set_title(\" Front Range flood event 2013\")\n" +"> > ~~~\n" +"> > {: .language-python}\n" +"> >\n" +"> > ![Flood event plot](../fig/08_flood_event.png)" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:329 +msgid "### Saving matplotlib figures" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:331 +msgid "" +"Once satisfied with the resulting plot, you can save the plot with the `." +"savefig(*args)` method from matplotlib:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:333 +msgid "" +"~~~\n" +"fig.savefig(\"my_plot_name.png\")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:338 +msgid "" +"which will save the `fig` created using Pandas/matplotlib as a png file with " +"the name `my_plot_name`" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:340 +msgid "> ## Tip: Saving figures in different formats" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:341 +msgid "> Matplotlib recognizes the extension used in the filename and" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:342 +msgid "> supports (on most computers) png, pdf, ps, eps and svg formats." +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:345 +msgid "> ## Challenge - Saving figure to file" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:346 +msgid "> Check the documentation of the `savefig` method and check how" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:347 +msgid "> you can comply to journals requiring figures as `pdf` file with" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:348 +msgid "> dpi >= 300." +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:349 +msgid "" +">\n" +"> > ## Answers\n" +"> >\n" +"> > ~~~\n" +"> > fig.savefig(\"my_plot_name.pdf\", dpi=300)\n" +"> > ~~~\n" +"> > {: .language-python}" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:359 +msgid "## Make other types of plots:" +msgstr "" + +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:361 +msgid "" +"Matplotlib can make many other types of plots in much the same way that it " +"makes two-dimensional line plots. Look through the examples in\n" +" and try a few of them (click " +"on the\n" +"\"Source code\" link and copy and paste into a new cell in ipython notebook " +"or\n" +"save as a text file with a `.py` extension and run in the command line)." +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:366 +msgid "> ## Challenge - Final Plot" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:367 +msgid "" +"> Display your data using one or more plot types from the example gallery. " +"Which" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:368 +msgid "" +"> ones to choose will depend on the content of your own data file. If you are" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:369 +msgid "" +"> using the streamgage file [`bouldercreek_09_2013.txt`]({{ page.root }}/" +"data/bouldercreek_09_2013.txt), you could make a" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:370 +msgid "" +"> histogram of the number of days with a given mean discharge, use bar plots" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:371 +msgid "" +"> to display daily discharge statistics, or explore the different ways " +"matplotlib" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/08-putting-it-all-together.md:372 +msgid "> can handle dates and times for figures." +msgstr "" + +# Front Matter +#: python-ecology-lesson/_episodes/09-working-with-sql.md:1 +msgid "" +"---\n" +"title: Accessing SQLite Databases Using Python and Pandas\n" +"teaching: 20\n" +"exercises: 25\n" +"questions:\n" +" - \"What if my data are stored in an SQL database? Can I manage them " +"with Python?\"\n" +" - \"How can I write data from Python to be used with SQL?\"\n" +"objectives:\n" +" - \"Use the sqlite3 module to interact with a SQL database.\"\n" +" - \"Access data stored in SQLite using Python.\"\n" +" - \"Describe the difference in interacting with data stored as a CSV " +"file versus in SQLite.\"\n" +" - \"Describe the benefits of accessing data using a database compared to " +"a CSV file.\"\n" +"keypoints:\n" +" - \"sqlite3 provides a SQL-like interface to read, query, and write SQL " +"databases from Python.\"\n" +" - \"sqlite3 can be used with Pandas to read SQL data to the familiar " +"Pandas DataFrame.\"\n" +" - \"Pandas and sqlite3 can also be used to transfer between the CSV and " +"SQL formats.\"\n" +"---" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/09-working-with-sql.md:19 +msgid "## Python and SQL" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:21 +msgid "" +"When you open a CSV in python, and assign it to a variable name, you are " +"using\n" +"your computers memory to save that variable. Accessing data from a database " +"like\n" +"SQL is not only more efficient, but also it allows you to subset and import " +"only\n" +"the parts of the data that you need." +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:26 +msgid "" +"In the following lesson, we'll see some approaches that can be taken to do " +"so." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/09-working-with-sql.md:28 +msgid "### The `sqlite3` module" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:30 +msgid "" +"The [sqlite3] module provides a straightforward interface for interacting " +"with\n" +"SQLite databases. A connection object is created using `sqlite3.connect()`; " +"the\n" +"connection must be closed at the end of the session with the `.close()` " +"command.\n" +"While the connection is open, any interactions with the database require you " +"to\n" +"make a cursor object with the `.cursor()` command. The cursor is then ready " +"to\n" +"perform all kinds of operations with `.execute()`." +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:37 +msgid "[sqlite3]: https://docs.python.org/3/library/sqlite3.html" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/09-working-with-sql.md:39 +msgid "" +"~~~\n" +"import sqlite3\n" +"\n" +"# Create a SQL connection to our SQLite database\n" +"con = sqlite3.connect(\"data/portal_mammals.sqlite\")\n" +"\n" +"cur = con.cursor()\n" +"\n" +"# The result of a \"cursor.execute\" can be iterated over by row\n" +"for row in cur.execute('SELECT * FROM species;'):\n" +" print(row)\n" +"\n" +"# Be sure to close the connection\n" +"con.close()\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/09-working-with-sql.md:56 +msgid "### Queries" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:58 +msgid "" +"One of the most common ways to interact with a database is by querying:\n" +"retrieving data based on some search parameters. Use a SELECT statement " +"string.\n" +"The query is returned as a single tuple or a tuple of tuples. Add a WHERE\n" +"statement to filter your results based on some parameter." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/09-working-with-sql.md:63 +msgid "" +"~~~\n" +"import sqlite3\n" +"\n" +"# Create a SQL connection to our SQLite database\n" +"con = sqlite3.connect(\"data/portal_mammals.sqlite\")\n" +"\n" +"cur = con.cursor()\n" +"\n" +"# Return all results of query\n" +"cur.execute('SELECT plot_id FROM plots WHERE plot_type=\"Control\"')\n" +"cur.fetchall()\n" +"\n" +"# Return first result of query\n" +"cur.execute('SELECT species FROM species WHERE taxa=\"Bird\"')\n" +"cur.fetchone()\n" +"\n" +"# Be sure to close the connection\n" +"con.close()\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/09-working-with-sql.md:84 +msgid "## Accessing data stored in SQLite using Python and Pandas" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:86 +msgid "" +"Using pandas, we can import results of a SQLite query into a dataframe. " +"Note\n" +"that you can use the same SQL commands / syntax that we used in the SQLite\n" +"lesson. An example of using pandas together with sqlite is below:" +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/09-working-with-sql.md:90 +msgid "" +"~~~\n" +"import pandas as pd\n" +"import sqlite3\n" +"\n" +"# Read sqlite query results into a pandas DataFrame\n" +"con = sqlite3.connect(\"data/portal_mammals.sqlite\")\n" +"df = pd.read_sql_query(\"SELECT * from surveys\", con)\n" +"\n" +"# Verify that result of SQL query is stored in the dataframe\n" +"print(df.head())\n" +"\n" +"con.close()\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_episodes/09-working-with-sql.md:105 +msgid "## Storing data: CSV vs SQLite" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:107 +msgid "" +"Storing your data in an SQLite database can provide substantial performance\n" +"improvements when reading/writing compared to CSV. The difference in " +"performance\n" +"becomes more noticeable as the size of the dataset grows (see for example " +"[these\n" +"benchmarks])." +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:112 +msgid "" +"[these benchmarks]: http://sebastianraschka.com/" +"Articles/2013_sqlite_database.html#results-and-conclusions" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/09-working-with-sql.md:115 +msgid "> ## Challenge - SQL" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:116 +msgid "" +">\n" +"> 1. Create a query that contains survey data collected between 1998 - 2001 " +"for\n" +"> observations of sex \"male\" or \"female\" that includes observation's " +"genus and\n" +"> species and site type for the sample. How many records are returned?\n" +">\n" +"> 2. Create a dataframe that contains the total number of observations " +"(count)\n" +"> made for all years, and sum of observation weights for each site, " +"ordered by\n" +"> site ID." +msgstr "" + +# header +#: python-ecology-lesson/_episodes/09-working-with-sql.md:126 +msgid "## Storing data: Create new tables using Pandas" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:128 +msgid "" +"We can also us pandas to create new tables within an SQLite database. Here, " +"we run we re-do an\n" +"exercise we did before with CSV files using our SQLite database. We first " +"read in our survey data,\n" +"then select only those survey results for 2002, and then save it out to its " +"own table so we can work\n" +"with it on its own later." +msgstr "" + +# code block +#: python-ecology-lesson/_episodes/09-working-with-sql.md:133 +msgid "" +"~~~\n" +"import pandas as pd\n" +"import sqlite3\n" +"\n" +"con = sqlite3.connect(\"data/portal_mammals.sqlite\")\n" +"\n" +"# Load the data into a DataFrame\n" +"surveys_df = pd.read_sql_query(\"SELECT * from surveys\", con)\n" +"\n" +"# Select only data for 2002\n" +"surveys2002 = surveys_df[surveys_df.year == 2002]\n" +"\n" +"# Write the new DataFrame to a new SQLite table\n" +"surveys2002.to_sql(\"surveys2002\", con, if_exists=\"replace\")\n" +"\n" +"con.close()\n" +"~~~" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_episodes/09-working-with-sql.md:152 +msgid "> ## Challenge - Saving your work" +msgstr "" + +#: python-ecology-lesson/_episodes/09-working-with-sql.md:153 +msgid "" +">\n" +"> 1. For each of the challenges in the previous challenge block, modify your " +"code to save the\n" +"> results to their own tables in the portal database.\n" +">\n" +"> 2. What are some of the reasons you might want to save the results of your " +"queries back into the\n" +"> database? What are some of the reasons you might avoid doing this." +msgstr "" + +# Front Matter +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:1 +msgid "" +"---\n" +"layout: page\n" +"title: About Contributors\n" +"permalink: /contributors/\n" +"---" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:6 +msgid "" +"The materials in this python-ecology-lesson repository were initially " +"developed\n" +"and adapted and continue to be revised by many contributors. Some of the " +"lessons\n" +"were adapted from Software Carpentry materials." +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:10 +msgid "" +"The first Python Data Carpentry workshop was run at University of Miami on " +"March\n" +"30 2015 John Gosset and Francois Michonneau. During this time materials " +"were\n" +"refined and they presented again at the UCAR Software Engineering Assembly " +"(SEA)\n" +"conference in Boulder, Colorado by Leah Wasser (NEON,Inc) and Mariela " +"Perignon." +msgstr "" + +# header +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:15 +msgid "## Data" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:17 +msgid "" +"Data is from the paper S. K. Morgan Ernest, Thomas J. Valone, and James H.\n" +"Brown. 2009. Long-term monitoring and experimental manipulation of a " +"Chihuahuan\n" +"Desert ecosystem near Portal, Arizona, USA. Ecology 90:1708." +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:21 +msgid "" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:23 +msgid "" +"Excel data is from the paper Bahlai, C.A., Schaafsma, A.W., Lagos, D., " +"Voegtlin,\n" +"D., Smith, J.L., Welsman, J.A., Xue, Y., DiFonzo, C., Hallett, R.H., 2014.\n" +"Factors inducing migratory forms of soybean aphid and an examination of " +"North\n" +"American spatial dynamics of this species in the context of migratory " +"behavior.\n" +"Agriculture and Forest Entomology. 16, 240-250." +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:29 +msgid "" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:31 +msgid "" +"Master_suction_trap_data_list_uncleaned.csv is a pre-cleaning version of a\n" +"publicly available dataset by David Voegtlin, Doris Lagos, Douglas Landis " +"and\n" +"Christie Bahlai, available at " +msgstr "" + +# header +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:35 +msgid "## Lessons" +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:37 +msgid "The current list of lessons." +msgstr "" + +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:39 +msgid "" +"Note: these lessons were reorganized, cleaned up and developed further by " +"Leah\n" +"Wasser, Mariela Perignon, John Gosset and François Michonneau in April 2015." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:42 +msgid " - Short Introduction to Python" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:43 +msgid " - Starting With Data" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:44 +msgid " - Index Slice Subset" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:45 +msgid " - Data Types and Format" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:46 +msgid " - Merging Data" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:47 +msgid "" +" - Data Analysis Automation: Loops and Functions (Developed by Mariela " +"Perignon with minor edits both Leah Wasser)" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:48 +msgid "" +" - Visualizing Data with ggplot (Developed by Jeremy Zucker November 2016)" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:49 +msgid "" +" - Putting It All Together (Developed by Mariela Perignon with minor " +"revisions by Leah Wasser April 2015)" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/CONTRIBUTORS.md:50 +msgid "" +" - Accessing SQL using Python (Added by John Gosset with minor revisions by " +"Leah Wasser April 2015)" +msgstr "" + +# Front Matter +#: python-ecology-lesson/_extras/about.md:1 +msgid "" +"---\n" +"layout: page\n" +"title: About\n" +"permalink: /about/\n" +"---" +msgstr "" + +#: python-ecology-lesson/_extras/about.md:6 +msgid "{% include carpentries.html %}" +msgstr "" + +# Front Matter +#: python-ecology-lesson/_extras/discuss.md:1 +msgid "" +"---\n" +"layout: page\n" +"title: Discussion\n" +"permalink: /discuss/\n" +"---" +msgstr "" + +#: python-ecology-lesson/_extras/discuss.md:7 +msgid "No current discussion" +msgstr "" + +# Front Matter +#: python-ecology-lesson/_extras/extra_challenges.md:1 +msgid "" +"--- \n" +"layout: " +"page \n" +"title: \"Extra Challenges" +"\" \n" +"permalink: /" +"extra_challenges/ \n" +"--- " +msgstr "" + +# header +#: python-ecology-lesson/_extras/extra_challenges.md:7 +msgid "# Extra Challenges" +msgstr "" + +#: python-ecology-lesson/_extras/extra_challenges.md:9 +msgid "" +"A collection of challenges that have been either removed from or not (yet) " +"added to the main lesson. " +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_extras/extra_challenges.md:11 +msgid "> ## Looping Over DataFrame" +msgstr "" + +#: python-ecology-lesson/_extras/extra_challenges.md:12 +msgid "" +">\n" +"> (Please refer to lesson `06-loops-and-functions.md`)\n" +">\n" +"> The file `surveys.csv` in the `data` folder contains 25 years of data from " +"surveys,\n" +"> starting from 1977. We can extract data corresponding to each year in this " +"DataFrame\n" +"> to individual CSV files, by using a `for` loop:\n" +"> \n" +"> ~~~\n" +"> import pandas as pd\n" +"> \n" +"> # Load the data into a DataFrame\n" +"> surveys_df = pd.read_csv('data/surveys.csv')\n" +"> \n" +"> # Loop through a sequence of years and export selected data\n" +"> start_year = 1977\n" +"> end_year = 2002\n" +"> for year in range(start_year, end_year+1):\n" +">\n" +"> # Select data for the year\n" +"> surveys_year = surveys_df[surveys_df.year == year] \n" +">\n" +"> # Write the new DataFrame to a CSV file\n" +"> filename = 'data/surveys' + str(year) + '.csv' \n" +"> surveys_year.to_csv(filename)\n" +"> ~~~\n" +"> {: .language-python}\n" +">\n" +"> What happens if there is no data for a year in a sequence? For example,\n" +"> imagine we used `1976` as the `start_year`\n" +">\n" +"> > ## Solution\n" +"> > We get the expected files for all years between 1977 and 2002,\n" +"> > plus an empty `data/surveys1976.csv` file with only the headers. \n" +"> {: .solution} " +msgstr "" + +# Front Matter +#: python-ecology-lesson/_extras/figures.md:1 +msgid "" +"---\n" +"title: Figures\n" +"---" +msgstr "" + +#: python-ecology-lesson/_extras/figures.md:5 python-ecology-lesson/aio.md:6 +msgid "{% include base_path.html %}" +msgstr "" + +# inline html +#: python-ecology-lesson/_extras/figures.md:7 +msgid "" +"" +msgstr "" + +#: python-ecology-lesson/_extras/figures.md:61 +msgid "" +"{% comment %}\n" +"Create anchor for each one of the episodes.\n" +"{% endcomment %}\n" +"{% for episode in site.episodes %}\n" +"
\n" +"{% endfor %}" +msgstr "" + +# Front Matter +#: python-ecology-lesson/_extras/guide.md:1 +msgid "" +"---\n" +"layout: page\n" +"title: \"Instructor Notes\"\n" +"permalink: /guide/\n" +"---" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:7 +msgid "# Challenge solutions" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:9 +msgid "## Install the required workshop packages" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:11 +msgid "" +"Please use the instructions in the [Setup][lesson-setup] document to perform " +"installs. If you\n" +"encounter setup issues, please file an issue with the tags 'High-priority'." +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:14 +msgid "## Checking installations." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:16 +msgid "" +"In the `_include/scripts` directory, you will find a script called check_env." +"py This checks the\n" +"functionality of the Anaconda install." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:19 +msgid "" +"By default, Data Carpentry does not have people pull the whole repository " +"with all the scripts and\n" +"addenda. Therefore, you, as the instructor, get to decide how you'd like to " +"provide this script to\n" +"learners, if at all. To use this, students can navigate into `_includes/" +"scripts` terminal, and\n" +"execute the following:" +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:24 +msgid "" +"~~~\n" +"python check_env.py\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:29 +msgid "" +"If learners receive an `AssertionError`, it will inform you how to help them " +"correct this\n" +"installation. Otherwise, it will tell you that the system is good to go and " +"ready for Data\n" +"Carpentry!" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:33 +msgid "## 01-short-introduction-to-Python" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:35 +msgid "### Tuples Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:37 +msgid "* What happens when you execute `a_list[1] = 5`?" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:38 +msgid "* What happens when you execute `a_tuple[2] = 5`?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:40 +msgid "" +" As a tuple is immutable, it does not support item assignment. Elements in " +"a list can be altered\n" +" individually." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:43 +msgid "* What does `type(a_tuple)` tell you about `a_tuple`?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:45 +msgid "\t`tuple`" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:47 +msgid "### Dictionaries Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:49 +msgid "" +"* Changing dictionaries: 2. Reassign the value that corresponds to the key " +"`2`." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:51 +msgid "" +"Make sure it is also clear that access to 'the value that corresponds to the " +"key `2`' is actually\n" +"just about the key name. Add for example `rev[10] = \"ten\"` to clarify it " +"is not about the position." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:54 +msgid "" +"~~~\n" +"rev\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:63 +msgid "" +"~~~\n" +"rev[2] = \"apple-sauce\"\n" +"~~~" +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:68 +msgid "" +"~~~\n" +"{1: 'one', 2: 'apple-sauce', 3: 'three'}\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:73 +msgid "## 02-starting-with-data" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/_extras/guide.md:75 +msgid "> ## Important Bug Note" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:76 +msgid "" +">\n" +"> In Pandas prior to 0.18.1 there is a bug causing `surveys_df['weight']." +"describe()` to return\n" +"> a runtime error." +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:81 +msgid "### Dataframe Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:83 +msgid "* `surveys_df.columns`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:85 +msgid "" +" column names (optional: show `surveys_df.columns[4] = \"plotid\"` The " +"index is not mutable; recap of\n" +" previous lesson. Adapting the name is done by `rename` function\n" +" `surveys_df.rename(columns={\"plot_id\": \"plotid\"})`)" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:89 +msgid "* `surveys_df.head()`. Also, what does `surveys_df.head(15)` do?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:91 +msgid " Show first 5 lines. Show first 15 lines." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:93 +msgid "* `surveys_df.tail()`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:95 +msgid " Show last 5 lines" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:97 +msgid "" +"* `surveys_df.shape`. Take note of the output of the shape method. What " +"format does it return the" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:98 +msgid " shape of the DataFrame in?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:100 +msgid "\t`type(surveys_df.shape)` -> `Tuple`" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:102 +msgid "### Calculating Statistics Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:104 +msgid "" +"* Create a list of unique plot ID's found in the surveys data. Call it " +"`plot_names`. How many unique" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:105 +msgid " plots are in the data? How many unique species are in the data?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:107 +msgid "" +" `plot_names = pd.unique(surveys_df[\"plot_id\"])` Number of unique plot " +"ID's: `plot_names.size` or\n" +" `len(plot_names)`; Number of unique species in the data: `len(pd." +"unique(surveys_df[\"species\"]))`" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:110 +msgid "" +"* What is the difference between `len(plot_names)` and " +"`surveys_df['plot_id'].nunique()`?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:112 +msgid "" +" Both do result in the same output, making it alternative ways of getting " +"the unique values.\n" +" `nunique` combines the count and unique value extraction." +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:115 +msgid "### Grouping Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:117 +msgid "* How many recorded individuals are female `F` and how many male `M`?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:119 +msgid "\t`grouped_data.count()`" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:121 +msgid "" +"* What happens when you group by two columns using the following syntax and " +"then grab mean values?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:123 +msgid "" +" The mean value for each combination of plot and sex is calculated. Remark " +"that the mean does not\n" +" make sense for each variable, so you can specify this column-wise: e.g. I " +"want to know the last\n" +" survey year, median foot-length and mean weight for each plot/sex " +"combination:" +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:127 +msgid "" +"~~~\n" +"surveys_df.groupby(['plot_id','sex']).agg({\"year\": 'min',\n" +" \"hindfoot_length\": 'median',\n" +" \"weight\": 'mean'})\n" +"~~~" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:134 +msgid "* Summarize the weight values for each plot in your data." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:136 +msgid "" +"~~~\n" +"surveys_df.groupby(['plot_id'])['weight'].describe()\n" +"~~~" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:141 +msgid "" +"* Another Challenge: What is another way to create a list of species and the " +"associated count of the" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:142 +msgid " records in the data?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:144 +msgid "" +" Instead of getting the column of the groupby and counting it, you can also " +"count on the groupby\n" +" (all columns) and make a selection of the resulting data frame:\n" +" `surveys_df.groupby('species_id').count()[\"record_id\"]`" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:148 +msgid "### Plotting Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:150 +msgid "* Create a plot of the average weight across all species per plot." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:152 +msgid "" +"~~~\n" +"surveys_df.groupby('plot_id').mean()[\"weight\"].plot(kind='bar')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:157 +msgid "" +"![average weight across all species for each plot](../" +"fig/01_chall_bar_meanweight.png)" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:159 +msgid "" +"* Create a plot of total males versus total females for the entire datase." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:161 +msgid "" +"~~~\n" +"surveys_df.groupby('sex').count()[\"record_id\"].plot(kind='bar')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:164 +msgid "" +"{: .language-python}\n" +"![total males versus total females for the entire dataset](../" +"fig/01_chall_bar_totalsex.png)" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:167 +msgid "## 03-index-slice-subset" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:169 +msgid "" +"Tip: use `.head()` method throughout this lesson to keep your display neater " +"for students.\n" +"Encourage students to try with and without `.head()` to reinforce this " +"useful tool and then to use\n" +"it or not at their preference. For example, if a student worries about " +"keeping up in pace with\n" +"typing, let them know they can skip the `.head()`, but that you'll use it to " +"keep more lines of\n" +"previous steps visible." +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:175 +msgid "### Indexing Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:177 +msgid "* What value does the code below return? `a[0]`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:179 +msgid "" +"\t`1`, as Python starts with element 0 (for Matlab users: this is " +"different!)" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:181 +msgid "* How about this: `a[5]`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:183 +#: python-ecology-lesson/_extras/guide.md:191 +msgid "\t`IndexError`" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:185 +msgid "* In the example above, calling `a[5]` returns an error. Why is that?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:187 +msgid "\tThe list has no element with index 5 (going from 0 till 4)." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:189 +msgid "* What about? `a[len(a)]`" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:193 +msgid "### Selection Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:195 +msgid "* What happens when you execute:" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:197 +msgid "" +"\t`surveys_df[0:3]`\n" +"\t`surveys_df[0:1]` slicing only the first element\n" +"\t`surveys_df[:5]` slicing from first element makes 0 redundant\n" +"\t`surveys_df[-1:]` you can count backwards" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:202 +msgid "" +" *Suggestion*: You can also select every Nth row: `surveys_df[1:10:2]`. So, " +"how to interpret\n" +" `surveys_df[::-1]`?" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:205 +msgid "" +"* What is the difference between `surveys_df.iloc[0:4, 1:4]` and `surveys_df." +"loc[0:4, 1:4]`?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:207 +msgid "" +" Check the position, or the name. Cfr. the second is like it would be in a " +"dictionary, asking for\n" +" the key-names. Column names 1:4 do not exist, resulting in an error. Check " +"also the difference\n" +" between `surveys_df.loc[0:4]` and `surveys_df.iloc[0:4]`" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:211 +msgid "### Advanced Selection Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:213 +msgid "" +"* Select a subset of rows in the `surveys_df` DataFrame that contain data " +"from the year 1999 and" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:214 +msgid "" +" that contain weight values less than or equal to 8. How many columns did " +"you end up with? What did\n" +" your neighbor get?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:217 +msgid "" +" `surveys_df[(surveys_df[\"year\"] == 1999) & (surveys_df[\"weight\"] <= " +"8)]`; when only interested in\n" +" how many, the sum of `True` values could be used as well:\n" +" `sum((surveys_df[\"year\"] == 1999) & (surveys_df[\"weight\"] <= 8))`" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:221 +msgid "" +"* You can use the `isin` command in Python to query a DataFrame based upon a " +"list of values as" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:222 +msgid "" +" follows: `surveys_df[surveys_df['species_id'].isin([listGoesHere])]`. Use " +"the `isin` function to\n" +" find all plots that contain particular species in the surveys DataFrame. " +"How many records contain\n" +" these values?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:226 +msgid "" +"\tFor example, using `PB` and `PL`:\n" +" `surveys_df[surveys_df['species_id'].isin(['PB', 'PL'])]['plot_id']." +"unique()` provides a list of\n" +" the plots with these species involved. With\n" +" `surveys_df[surveys_df['species_id'].isin(['PB', 'PL'])].shape` the number " +"of records can be\n" +" derived." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:232 +msgid "" +"* Create a query that finds all rows with a weight value > or equal to 0." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:234 +msgid "\t`surveys_df[surveys_df[\"weight\"] >= 0]`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:236 +msgid "" +" *Suggestion*: Introduce already that all these slice operations are " +"actually based on a\n" +" *Boolean indexing* operation (next section in the lesson). The filter " +"provides for each record if\n" +" it satisfies (True) or not (False). The slicing itself interprets the True/" +"False of each record." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:240 +msgid "" +"* The `~` symbol in Python can be used to return the OPPOSITE of the " +"selection that you specify in" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:241 +msgid "" +" Python. It is equivalent to \"is not in\". Write a query that selects all " +"rows that are NOT equal to\n" +" 'M' or 'F' in the surveys data." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:244 +msgid "" +"~~~\n" +"surveys_df[~surveys_df[\"sex\"].isin(['M', 'F'])]\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:249 +msgid "### Masking Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:251 +msgid "" +"* Create a new DataFrame that only contains observations with sex values " +"that are not female or" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:252 +msgid "" +" male. Assign each sex value in the new DataFrame to a new value of 'x'. " +"Determine the number of\n" +" null values in the subset." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:255 +msgid "" +" ~~~\n" +" new = surveys_df[~surveys_df['sex'].isin(['M', 'F'])].copy()\n" +" new['sex']='x'\n" +" print(len(new))\n" +" ~~~\n" +" {: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:262 +msgid "" +" Can verify the number of Nan values with `sum(surveys_df['sex']." +"isnull())`, which is equal to the\n" +" number of none female/male records." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:265 +msgid "" +"* Create a new DataFrame that contains only observations that are of sex " +"male or female and where" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:266 +msgid "" +" weight values are greater than 0. Create a stacked bar plot of average " +"weight by plot with male vs\n" +" female values stacked for each plot." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:269 +msgid "" +" ~~~\n" +" # selection of the data with isin\n" +" stack_selection = surveys_df[(surveys_df['sex'].isin(['M', 'F'])) &\n" +" surveys_df[\"weight\"] > 0.][[\"sex\", \"weight\", \"plot_id" +"\"]]\n" +" # calculate the mean weight for each plot id and sex combination:\n" +" stack_selection = stack_selection.groupby([\"plot_id\", \"sex\"]).mean()." +"unstack()\n" +" # and we can make a stacked bar plot from this:\n" +" stack_selection.plot(kind='bar', stacked=True)\n" +" ~~~\n" +" {: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:280 +msgid "" +" *Suggestion*: As we know the other values are all Nan values, we could " +"also select all not null\n" +" values (just preview, more on this in next lesson):\n" +" ~~~\n" +" stack_selection = surveys_df[(surveys_df['sex'].notnull()) &\n" +" surveys_df[\"weight\"] > 0.][[\"sex\", \"weight\", \"plot_id" +"\"]]\n" +" ~~~\n" +" {: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:288 +msgid "" +" ![average weight for each plot per sex](../fig/02_chall_stack_levelissue." +"png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:290 +msgid "" +" However, due to the `unstack` command, the legend header contains two " +"levels. In order to remove\n" +" this, the column naming needs to be simplified:\n" +" ~~~\n" +" stack_selection.columns = stack_selection.columns.droplevel()\n" +" ~~~\n" +" {: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:297 +msgid "" +" ![average weight for each plot per sex](../fig/02_chall_stack_level.png)" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:299 +msgid "## 04-data-types-and-format" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:301 +msgid "### Challenge - Changing Types" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:303 +msgid "" +"* Try converting the column `plot_id` to floats using `surveys_df.plot_id." +"astype(\"float\")`." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:304 +msgid "" +"Then, try converting the contents of the `weight` column to an integer " +"type.\n" +"What error messages does Pandas give you? What do these errors mean?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:307 +msgid "" +"Pandas cannot convert types from float to int if the column contains NaN " +"values." +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:309 +msgid "### Challenge - Counting" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:311 +msgid "" +"* Count the number of missing values per column. Hint: The method `.count()` " +"gives you the number of" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:312 +msgid "" +" non-NA observations per column. Try looking to the `.isnull()` method." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:314 +msgid "" +"~~~\n" +"surveys_df.isnull()\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:319 +msgid "" +"If the students have trouble generating the output, or anything happens with " +"that, the folder\n" +"`sample_output` in this repository contains the file `surveys_complete.csv` " +"with the data they\n" +"should generate." +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:323 +msgid "## 05-merging-data" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:325 +msgid "" +"* In the data folder, there are two survey data files: survey2001.csv and " +"survey2002.csv. Read the" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:326 +msgid "" +" data into Python and combine the files to make one new data frame. Create " +"a plot of average plot\n" +" weight by year grouped by sex. Export your results as a CSV and make sure " +"it reads back into\n" +" Python properly." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:330 +msgid "" +"~~~\n" +"# read the files:\n" +"survey2001 = pd.read_csv(\"data/survey2001.csv\")\n" +"survey2002 = pd.read_csv(\"data/survey2002.csv\")\n" +"# concatenate\n" +"survey_all = pd.concat([survey2001, survey2002], axis=0)\n" +"# get the weight for each year, grouped by sex:\n" +"weight_year = survey_all.groupby(['year', 'sex']).mean()[\"wgt\"].unstack()\n" +"# plot:\n" +"weight_year.plot(kind=\"bar\")\n" +"plt.tight_layout() # tip(!)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:342 +msgid "" +"{: .language-python}\n" +"![average weight for each year, grouped by sex](../fig/04_chall_weight_year." +"png)\n" +"~~~\n" +"# writing to file:\n" +"weight_year.to_csv(\"weight_for_year.csv\")\n" +"# reading it back in:\n" +"pd.read_csv(\"weight_for_year.csv\", index_col=0)\n" +"~~~\n" +"{: .language-python}" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:352 +msgid "" +"* Create a new DataFrame by joining the contents of the surveys.csv and " +"species.csv tables." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:354 +msgid "" +"~~~\n" +"merged_left = pd.merge(left=surveys_df,right=species_df, how='left', on=" +"\"species_id\")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:359 +msgid "Then calculate and plot the distribution of:" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:361 +msgid "**1. taxa per plot** (number of species of each taxa per plot):" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:363 +msgid "" +"Species distribution (number of taxa for each plot) can be derived as " +"follows:\n" +"~~~\n" +"merged_left.groupby([\"plot_id\"])[\"taxa\"].nunique().plot(kind='bar')\n" +"~~~\n" +"{: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:369 +msgid "![taxa per plot](../fig/04_chall_ntaxa_per_site.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:371 +msgid "" +"*Suggestion*: It is also possible to plot the number of individuals for each " +"taxa in each plot\n" +"(stacked bar chart):\n" +"~~~\n" +"merged_left.groupby([\"plot_id\", \"taxa\"]).count()[\"record_id\"]." +"unstack().plot(kind='bar', stacked=True)\n" +"plt.legend(loc='upper center', ncol=3, bbox_to_anchor=(0.5, 1.05))\n" +"~~~\n" +"{: .language-python}\n" +"(the legend otherwise overlaps the bar plot)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:380 +msgid "![taxa per plot](../fig/04_chall_taxa_per_site.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:382 +msgid "" +"**2. taxa by sex by plot**:\n" +"Providing the Nan values with the M|F values (can also already be changed to " +"'x'):\n" +"~~~\n" +"merged_left.loc[merged_left[\"sex\"].isnull(), \"sex\"] = 'M|F'\n" +"~~~\n" +"{: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:389 +msgid "" +"Number of taxa for each plot/sex combination:\n" +"~~~\n" +"ntaxa_sex_site= merged_left.groupby([\"plot_id\", \"sex\"])[\"taxa\"]." +"nunique().reset_index(level=1)\n" +"ntaxa_sex_site = ntaxa_sex_site.pivot_table(values=\"taxa\", columns=\"sex" +"\", index=ntaxa_sex_site.index)\n" +"ntaxa_sex_site.plot(kind=\"bar\", legend=False)\n" +"plt.legend(loc='upper center', ncol=3, bbox_to_anchor=(0.5, 1.08),\n" +" fontsize='small', frameon=False)\n" +"~~~\n" +"{: .language-python}" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:399 +msgid "![taxa per plot per sex](../fig/04_chall_ntaxa_per_site_sex.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:401 +msgid "*Suggestion (for discussion only)*:" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:403 +msgid "" +"The number of individuals for each taxa in each plot per sex can be derived " +"as well." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:405 +msgid "" +"~~~\n" +"sex_taxa_site = merged_left.groupby([\"plot_id\", \"taxa\", \"sex\"])." +"count()['record_id']\n" +"sex_taxa_site.unstack(level=[1, 2]).plot(kind='bar', logy=True)\n" +"plt.legend(loc='upper center', ncol=3, bbox_to_anchor=(0.5, 1.15),\n" +" fontsize='small', frameon=False)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:413 +msgid "![taxa per plot per sex](../fig/04_chall_sex_taxa_site_intro.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:415 +msgid "" +"This is not really the best plot choice: not readable,... A first option to " +"make this better, is to\n" +"make facets. However, pandas/matplotlib do not provide this by default. Just " +"as a pure matplotlib\n" +"example (`M|F` if for not-defined sex records):" +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:419 +msgid "" +"~~~\n" +"fig, axs = plt.subplots(3, 1)\n" +"for sex, ax in zip([\"M\", \"F\", \"M|F\"], axs):\n" +" sex_taxa_site[sex_taxa_site[\"sex\"] == sex].plot(kind='bar', ax=ax, " +"legend=False)\n" +" ax.set_ylabel(sex)\n" +" if not ax.is_last_row():\n" +" ax.set_xticks([])\n" +" ax.set_xlabel(\"\")\n" +"axs[0].legend(loc='upper center', ncol=5, bbox_to_anchor=(0.5, 1.3),\n" +" fontsize='small', frameon=False)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:432 +msgid "![taxa per plot per sex](../fig/04_chall_sex_taxa_site.png)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:434 +msgid "" +"However, it would be better to link to [Seaborn][seaborn] and [Altair]" +"[altair] for its kind of\n" +"multivariate visualisations." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:437 +msgid "" +"* In the data folder, there is a plot CSV that contains information about " +"the type associated with" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:438 +msgid "each plot. Use that data to summarize the number of plots by plot type." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:440 +msgid "" +"~~~\n" +"plot_info = pd.read_csv(\"data/plots.csv\")\n" +"plot_info.groupby(\"plot_type\").count()\n" +"~~~" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:446 +msgid "" +"* Calculate a diversity index of your choice for control vs rodent exclosure " +"plots. The index should" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:447 +msgid "" +"consider both species abundance and number of species. You might choose the " +"simple biodiversity\n" +"index described here which calculates diversity as `the number of species in " +"the plot / the total\n" +"number of individuals in the plot = Biodiversity index.`" +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:451 +msgid "" +"~~~\n" +"merged_site_type = pd.merge(merged_left, plot_info, on='plot_id')\n" +"# For each plot, get the number of species for each plot\n" +"nspecies_site = merged_site_type.groupby([\"plot_id\"])[\"species\"]." +"nunique().rename(\"nspecies\")\n" +"# For each plot, get the number of individuals\n" +"nindividuals_site = merged_site_type.groupby([\"plot_id\"]).count()" +"['record_id'].rename(\"nindiv\")\n" +"# combine the two series\n" +"diversity_index = pd.concat([nspecies_site, nindividuals_site], axis=1)\n" +"# calculate the diversity index\n" +"diversity_index['diversity'] = diversity_index['nspecies']/" +"diversity_index['nindiv']\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:464 +msgid "Making a bar chart:" +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:466 +msgid "" +"~~~\n" +"diversity_index['diversity'].plot(kind=\"barh\")\n" +"plt.xlabel(\"Diversity index\")\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:472 +msgid "![taxa per plot per sex](../fig/04_chall_diversity_index.png)" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:475 +msgid "## 06-loops-and-functions" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:477 +msgid "### Basic Loop Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:479 +msgid "* What happens if we do not include the `pass` statement?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:481 +msgid "\t`SyntaxError:`" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:483 +msgid "" +"* Rewrite the loop so that the animals are separated by commas, not new " +"lines (Hint: You can" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:484 +msgid "" +"concatenate strings using a plus sign. For example, `print(string1 + " +"string2)` outputs\n" +"'string1string2')." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:487 +msgid "" +"~~~\n" +"for creature in animals:\n" +" print(creature+',', end='')\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:493 +msgid "" +"This loop also adds a comma after the last animal. A better, loop-free " +"solution would be:\n" +"`','.join(animals)`" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:496 +msgid "### Looping Over Dataframe Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:498 +msgid "" +"* Some of the surveys you saved are missing data (they have null values that " +"show up as NaN - Not A" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:499 +msgid "" +"Number - in the DataFrames and do not show up in the text files). Modify the " +"for loop so that the\n" +"entries with null values are not included in the yearly files." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:502 +msgid "" +"~~~\n" +"surveys_year = surveys_df[surveys_df.year == year].dropna()\n" +"~~~" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:507 +msgid "" +"* Let's say you only want to look at data from a given multiple of years. " +"How would you modify your" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:508 +msgid "" +"loop in order to generate a data file for only every 5th year, starting from " +"1977?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:510 +msgid "" +"You could just make a list manually, however, why not check the first and " +"last year making use of\n" +"the code itself?" +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:513 +msgid "" +"~~~\n" +"n_year = 5 # better overview by making variable from it\n" +"first_year = surveys_df['year'].min()\n" +"last_year = surveys_df['year'].max()\n" +"\n" +"for year in range(first_year, last_year, n_year):\n" +" print(year)\n" +"\n" +" # Select data for the year\n" +" surveys_year = surveys_df[surveys_df.year == year].dropna()\n" +"~~~" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:526 +msgid "" +"* Instead of splitting out the data by years, a colleague wants to do " +"analyses each species" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:527 +msgid "separately. How would you write a unique csv file for each species?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:529 +msgid "" +"Similar to previous example, but use the `species_id` column. " +"`surveys_df['species_id'].unique()`.\n" +"However, the species names would improve interpretation of the file naming. " +"A join with the species:\n" +"`merged_left = pd.merge(left=surveys,right=species, how='left', on=" +"\"species_id\")` and using the\n" +"`species` column." +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:534 +msgid "### Functions Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:536 +msgid "" +"* Change the values of the arguments in the function and check its output." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:537 +msgid "" +"* Try calling the function by giving it the wrong number of arguments (not " +"2), or not assigning the" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:538 +msgid "" +"function call to a variable (no `product_of_inputs =`).\n" +"* Declare a variable inside the function and test to see where it exists " +"(Hint: can you print it\n" +"from outside the function?).\n" +"* Explore what happens when a variable both inside and outside the function " +"have the same name. What\n" +"happens to the global variable when you change the value of the local " +"variable?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:544 +msgid "Show these in a debugging environment to make this more clear!" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:546 +msgid "### Additional Functions Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:548 +msgid "" +"* Add two arguments to the functions we wrote that take the path of the " +"directory where the files" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:549 +msgid "" +"will be written and the root of the file name. Create a new set of files " +"with a different name in\n" +"a different directory." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:552 +msgid "" +"~~~\n" +"def one_year_csv_writer(this_year, all_data, folder_to_save, root_name):\n" +" \"\"\"\n" +" Writes a csv file for data from a given year.\n" +"\n" +" Parameters\n" +" ---------\n" +" this_year : int\n" +" year for which data is extracted\n" +" all_data: pd.DataFrame\n" +" DataFrame with multi-year data\n" +" folder_to_save : str\n" +" folder to save the data files\n" +" root_name: str\n" +" root of the filenames to save the data\n" +" \"\"\"\n" +"\n" +" # Select data for the year\n" +" surveys_year = all_data[all_data.year == this_year]\n" +"\n" +" # Write the new DataFrame to a csv file\n" +" filename = os.path.join(folder_to_save, ''.join([root_name, " +"str(this_year), '.csv']))\n" +" surveys_year.to_csv(filename)\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:576 +msgid "" +"{: .language-python}\n" +"Also adapt function `yearly_data_csv_writer` with the additional inputs." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:579 +msgid "" +"* How could you use the function `yearly_data_csv_writer` to create a csv " +"file for only one year?" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:580 +msgid "(Hint: think about the syntax for `range`)" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:582 +msgid "Adapt the input arguments, e.g. 1978, 1979." +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:584 +msgid "### Output Management Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:586 +msgid "" +"* Make the functions return a list of the files they have written. There are " +"many ways you can do" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:587 +msgid "" +"this (and you should try them all!):\n" +"\t* either of the functions can print to screen,\n" +"\tjust add `print(\"year \" + str(this_year)+ \" written to disk\")` " +"statement\n" +"\t* either can use a return statement to give back numbers or strings to " +"their function call,\n" +"\t* or you can use some combination of the two.\n" +"\t* You could also try using the os library to list the contents of " +"directories.\n" +"\t\t`os.listdir`" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:595 +msgid "" +"Implementation inside the function:\n" +"~~~\n" +"filenames = []\n" +"for year in range(start_year, end_year+1):\n" +" filenames.append(one_year_csv_writer(year, all_data, folder_to_save, " +"root_name))\n" +"return filenames\n" +"~~~\n" +"{: .language-python}" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:604 +msgid "" +"* Explore what happens when variables are declared inside each of the " +"functions versus in the main" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:605 +msgid "" +"(non-indented) body of your code. What is the scope of the variables (where " +"are they visible)?\n" +"What happens when they have the same name but are given different values?" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:608 +msgid "" +"* What type of object corresponds to a variable declared as `None`? (Hint: " +"create a variable set to" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:609 +msgid "`None` and use the function `type()`)" +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:611 +msgid "" +"~~~\n" +"NoneType\n" +"~~~" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:616 +msgid "" +"* Compare the behavior of the function `yearly_data_arg_test` when the " +"arguments have `None` as a" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:617 +msgid "default and when they do not have default values." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:619 +msgid "" +"* What happens if you only include a value for `start_year` in the function " +"call? Can you write the" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:620 +msgid "" +"function call with only a value for `end_year`? (Hint: think about how the " +"function must be\n" +"assigning values to each of the arguments - this is related to the need to " +"put the arguments\n" +"without default values before those with default values in the function " +"definition!)" +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:624 +msgid "" +"~~~\n" +"yearly_data_arg_test(surveys_df, end_year=2001)\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:629 +msgid "### Functions Modifications Challenges" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:631 +msgid "" +"* Rewrite the `one_year_csv_writer` and `yearly_data_csv_writer` functions " +"to have keyword arguments" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:632 +msgid "with default values." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:634 +msgid "" +"~~~\n" +"def one_year_csv_writer(this_year, all_data, folder_to_save='./', " +"root_name='survey'):\n" +" \"\"\"\n" +" Writes a csv file for data from a given year.\n" +"\n" +" Parameters\n" +" ---------\n" +" this_year : int\n" +" year for which data is extracted\n" +" all_data: pd.DataFrame\n" +" DataFrame with multi-year data\n" +" folder_to_save : str\n" +" folder to save the data files\n" +" root_name: str\n" +" root of the filenames to save the data\n" +" \"\"\"\n" +"\n" +" # Select data for the year\n" +" surveys_year = all_data[all_data.year == this_year]\n" +"\n" +" # Write the new DataFrame to a csv file\n" +" filename = os.path.join(folder_to_save, ''.join([root_name, " +"str(this_year), '.csv']))\n" +" surveys_year.to_csv(filename)\n" +"~~~" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:660 +msgid "" +"* Modify the functions so that they do not create yearly files if there is " +"no data for a given year" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:661 +msgid "" +"and display an alert to the user (Hint: use `for` loops and conditional " +"statements to do this. For\n" +"an extra challenge, use `try` statements!)" +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:664 +msgid "" +"~~~\n" +" # Write the new DataFrame to a csv file\n" +" if len(surveys_year) > 0:\n" +" filename = os.path.join(folder_to_save, ''.join([root_name, " +"str(this_year), '.csv']))\n" +" surveys_year.to_csv(filename)\n" +" else:\n" +" print(\"No data for year \" + str(this_year))\n" +"~~~" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/guide.md:674 +msgid "" +"* The code that you have written so far to loop through the years is good, " +"however, it is not" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:675 +msgid "" +"necessarily reproducible with different datasets. For instance, what happens " +"to the code if we\n" +"have additional years of data in our CSV files? Using the tools that you " +"learned in the previous\n" +"activities, make a list of all years represented in the data. Then create a " +"loop to process your\n" +"data, that begins at the earliest year and ends at the latest year using " +"that list." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:680 +msgid "" +"~~~\n" +"def yearly_data_csv_writer(all_data, yearcolumn=\"year\",\n" +" folder_to_save='./', root_name='survey'):\n" +" \"\"\"\n" +" Writes separate csv files for each year of data.\n" +"\n" +" all_data --- DataFrame with multi-year data\n" +" yearcolumn --- column name containing the year of the data\n" +" folder_to_save --- folder name to store files\n" +" root_name --- start of the file names stored\n" +" \"\"\"\n" +" years = all_data[\"year\"].unique()\n" +"\n" +" # \"end_year\" is the last year of data we want to pull, so we loop to " +"end_year+1\n" +" filenames = []\n" +" for year in years:\n" +" filenames.append(one_year_csv_writer(year, all_data, folder_to_save, " +"root_name))\n" +" return filenames\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:701 +msgid "## 07-visualization-ggplot-python" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:703 +msgid "" +"If the students have trouble generating the output, or anything happens with " +"that, there is a file\n" +"called \"sample output\" that contains the data file they should have " +"generated in lesson 3." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:706 +msgid "iPython notebooks for plotting can be viewed in the `_extras` folder" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:708 +msgid "## 08-putting-it-all-together" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:710 +msgid "" +"Scientists often operate on mathematical equations. Being able to use them " +"in their graphics has a\n" +"lot of added value. Luckily, Matplotlib provides powerful tools for text " +"control. One of them is the\n" +"ability to use LaTeX mathematical notation, whenever text is used (you can " +"learn more about LaTeX\n" +"math notation here: ). To " +"use mathematical\n" +"notation, surround your text using the dollar sign (\"$\"). LaTeX uses the " +"backslash character (\"\\\\\")\n" +"a lot. Since backslash has a special meaning in the Python strings, you " +"should replace all the\n" +"LaTeX-related backslashes with two backslashes." +msgstr "" + +# code block +#: python-ecology-lesson/_extras/guide.md:718 +msgid "" +"~~~\n" +"plt.plot(t, t, 'r--', label='$y=x$')\n" +"plt.plot(t, t**2 , 'bs-', label='$y=x^2$')\n" +"plt.plot(t, (t - 5)**2 + 5 * t - 0.5, 'g^:', label='$y=(x - 5)^2 + 5 x - \\" +"\\frac{1}{2}$') # note the double backslash\n" +"\n" +"plt.legend(loc='upper left', shadow=True, fontsize='x-large')\n" +"\n" +"# Note the double backslashes in the line below.\n" +"plt.xlabel('This is the x axis. It can also contain math such as $\\\\bar{x}=" +"\\\\frac{\\\\sum_{i=1}^{n} {x}} {N}$')\n" +"plt.ylabel('This is the y axis')\n" +"plt.title('This is the figure title')\n" +"\n" +"plt.show()\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/_extras/guide.md:734 +msgid "## 09-working-with-sql" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:736 +msgid "FIXME" +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:739 +msgid "[This page][matplotlib-mathtext] contains more information." +msgstr "" + +#: python-ecology-lesson/_extras/guide.md:741 +msgid "" +"[seaborn]: https://stanford.edu/~mwaskom/software/seaborn\n" +"[altair]: https://github.com/ellisonbg/altair\n" +"[matplotlib-mathtext]: https://matplotlib.org/users/mathtext.html" +msgstr "" + +# Front Matter +#: python-ecology-lesson/_extras/jupyter_notebooks.md:1 +msgid "" +"---\n" +"layout: page\n" +"title: \"Overview of Jupyter Notebooks\"\n" +"permalink: /jupyter_notebooks/\n" +"---" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:7 +msgid "" +"![Example Jupyter Notebook](../fig/00_0_jupyter_notebook_example.jpg)\n" +"*Screenshot of a [Jupyter Notebook on quantum mechanics](https://github.com/" +"jrjohansson/qutip-lectures) by Robert Johansson*" +msgstr "" + +# header +#: python-ecology-lesson/_extras/jupyter_notebooks.md:10 +msgid "### How the Jupyter notebook works" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:12 +msgid "After typing the command `jupyter notebook`, the following happens:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/jupyter_notebooks.md:14 +msgid "" +"* A Jupyter Notebook server is automatically created on your local machine." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/jupyter_notebooks.md:15 +msgid "" +"* The Jupyter Notebook server runs locally on your machine only and does not" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:16 +msgid "" +" use an internet connection.\n" +"* The Jupyter Notebook server opens the Jupyter notebook client, also known\n" +" as the notebook user interface, in your default web browser." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:20 +msgid "" +" ![Jupyter notebook file browser](../fig/00_1_jupyter_file_browser.png)\n" +" *The Jupyter notebook file browser*" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/jupyter_notebooks.md:23 +msgid "" +"* To create a new Python notebook select the \"New\" dropdown on the upper" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:24 +msgid " right of the screen." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:26 +msgid "" +" ![Jupyter notebook file browser](../fig/00_2_jupyter_new_notebook.png)\n" +" *The Jupyter notebook file browser*" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/jupyter_notebooks.md:29 +msgid "" +"* When you can create a new notebook and type code into the browser, the web" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:30 +msgid " browser and the Jupyter notebook server communicate with each other." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:32 +msgid "" +" ![new Jupyter notebook](../fig/00_3_jupyter_blank_notebook.png)\n" +" *A new, blank Jupyter notebook*" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/jupyter_notebooks.md:35 +msgid "* Under the \"help\" menu, take a quick interactive tour of how to" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:36 +msgid "" +" use the notebook. Help on Jupyter and key workshop packages is\n" +" available here too." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:39 +msgid "" +" ![Jupyter tour and help](../fig/00_4_jupyter_tour_help.png)\n" +" *User interface tour and Help*" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/jupyter_notebooks.md:42 +msgid "" +"* The Jupyter Notebook server does the work and calculations, and the web" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:43 +msgid "" +" browser renders the notebook.\n" +"* The web browser then displays the updated notebook to you." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/jupyter_notebooks.md:46 +msgid "* For example, click in the first cell and type some Python code." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:48 +msgid "" +" ![Code cell](../fig/00_5_jupyter_code_before.png)\n" +" *A Code cell*" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/jupyter_notebooks.md:51 +msgid "" +"* This is a **Code** cell (see the cell type dropdown with the word " +"**Code**)." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:52 +msgid " To run the cell, type Shift+Return." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:54 +msgid "" +" ![Code cell and its output](../fig/00_6_jupyter_code_after.png)\n" +" *A Code cell and its output*" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/jupyter_notebooks.md:57 +msgid "* Let's look at a **Markdown** cell. Markdown is a text manipulation" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:58 +msgid "" +" language that is readable yet offers additional formatting. Don't forget\n" +" to select **Markdown** from the cell type dropdown. Click in the cell and\n" +" enter the markdown text." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:62 +msgid "" +" ![markdown input cell](../fig/00_7_jupyter_markdown_before.png)\n" +" *A markdown input cell*" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/jupyter_notebooks.md:65 +msgid "* To run the cell, type Shift+Return." +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:67 +msgid "" +" ![rendered markdown cell](../fig/00_8_jupyter_markdown_after.png)\n" +" *A rendered markdown cell*" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:71 +msgid "This workflow has several advantages:" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/jupyter_notebooks.md:73 +msgid "- You can easily type, edit, and copy and paste blocks of code." +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/jupyter_notebooks.md:74 +msgid "" +"- Tab completion allows you to easily access the names of things you are " +"using" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:75 +msgid "" +" and learn more about them.\n" +"- It allows you to annotate your code with links, different sized text,\n" +" bullets, etc. to make information more accessible to you and your\n" +" collaborators.\n" +"- It allows you to display figures next to the code that produces them\n" +" to tell a complete story of the analysis." +msgstr "" + +# header +#: python-ecology-lesson/_extras/jupyter_notebooks.md:82 +msgid "### How the notebook is stored" +msgstr "" + +# unordered list +#: python-ecology-lesson/_extras/jupyter_notebooks.md:84 +msgid "" +"* The notebook file is stored in a format called JSON and has the suffix" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:85 +msgid "" +" `.ipynb`.\n" +"* Just like HTML for a webpage, what's saved in a notebook file looks\n" +" different from what you see in your browser.\n" +"* But this format allows Jupyter to mix software (in several languages) " +"with\n" +" documentation and graphics, all in one file." +msgstr "" + +# header +#: python-ecology-lesson/_extras/jupyter_notebooks.md:91 +msgid "### Notebook modes: Control and Edit" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:93 +msgid "" +"The notebook has two modes of operation: Control and Edit. Control mode " +"lets\n" +"you edit notebook level features; while, Edit mode lets you change the\n" +"contents of a notebook cell. Remember a notebook is made up of a number of\n" +"cells which can contain code, markdown, html, visualizations, and more." +msgstr "" + +# header +#: python-ecology-lesson/_extras/jupyter_notebooks.md:98 +msgid "### Help and more information" +msgstr "" + +#: python-ecology-lesson/_extras/jupyter_notebooks.md:100 +msgid "Use the **Help** menu and its options when needed." +msgstr "" + +# Front Matter +#: python-ecology-lesson/aio.md:1 +msgid "" +"---\n" +"layout: page\n" +"permalink: /aio/\n" +"---" +msgstr "" + +# inline html +#: python-ecology-lesson/aio.md:8 +msgid "" +"" +msgstr "" + +#: python-ecology-lesson/aio.md:34 +msgid "" +"{% comment %}\n" +"Create an anchor for every episode.\n" +"{% endcomment %}\n" +"{% for episode in site.episodes %}\n" +"
\n" +"{% endfor %}" +msgstr "" + +# Front Matter +#: python-ecology-lesson/index.md:1 +msgid "" +"---\n" +"layout: lesson\n" +"root: .\n" +"\n" +"maintainers:\n" +" - April Wright\n" +" - Tania Allard\n" +" - Maxim Belkin\n" +"---" +msgstr "" + +#: python-ecology-lesson/index.md:11 +msgid "**Lesson Maintainers:** {{ page.maintainers | join: ', ' }}" +msgstr "" + +#: python-ecology-lesson/index.md:13 +msgid "" +"Python is a general purpose programming language that is useful for writing " +"scripts to work effectively and reproducibly with data." +msgstr "" + +#: python-ecology-lesson/index.md:15 +msgid "" +"This is an introduction to Python designed for participants with no " +"programming experience. These lessons can be taught in a day (~ 6 hours). " +"They start with some basic information about Python syntax, the Jupyter " +"notebook interface, and move through how to import CSV files, using the " +"pandas package to work with data frames, how to calculate summary " +"information from a data frame, and a brief introduction to plotting. The " +"last lesson demonstrates how to work with databases directly from Python." +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/index.md:17 +msgid "> ## Getting Started" +msgstr "" + +#: python-ecology-lesson/index.md:18 +msgid "" +">\n" +"> Data Carpentry's teaching is hands-on, so participants are encouraged to " +"use\n" +"> their own computers to ensure the proper setup of tools for an efficient\n" +"> workflow.
**These lessons assume no prior knowledge of the skills or " +"tools.**\n" +">\n" +"> To get started, follow the directions in the \"[Setup][lesson-setup]\" tab " +"to\n" +"> download data to your computer and follow any installation instructions.\n" +">\n" +"> #### Prerequisites\n" +">\n" +"> This lesson requires a working copy of **Python**.\n" +">
To most effectively use these materials, please make sure to install\n" +"> everything *before* working through this lesson." +msgstr "" + +# SC/DC Template label +#: python-ecology-lesson/index.md:31 python-ecology-lesson/index.md:36 +#: python-ecology-lesson/setup.md:24 python-ecology-lesson/setup.md:42 +msgid "{: .prereq}" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/index.md:33 +msgid "> ## For Instructors" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/index.md:34 +msgid "> If you are teaching this lesson in a workshop, please see the" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/index.md:35 +msgid "> [Instructor notes](guide)." +msgstr "" + +# Front Matter +#: python-ecology-lesson/reference.md:1 +msgid "" +"---\n" +"layout: reference\n" +"---" +msgstr "" + +# header +#: python-ecology-lesson/reference.md:5 +msgid "## Glossary" +msgstr "" + +#: python-ecology-lesson/reference.md:7 +msgid "" +"{:auto_ids}\n" +"0-based indexing\n" +": is a way of assigning indices to elements in a sequential, ordered data " +"structure\n" +" starting from 0, i.e. where the first element of the sequence has index " +"0." +msgstr "" + +#: python-ecology-lesson/reference.md:12 +msgid "" +"CSV (file)\n" +": is an acronym which stands for Comma-Separated Values file. CSV files " +"store\n" +" tabular data, either numbers, strings, or a combination of the two, in " +"plain\n" +" text with columns separated by a comma and rows by the carriage return " +"character." +msgstr "" + +#: python-ecology-lesson/reference.md:17 +msgid "" +"database\n" +": is an organized collection of data." +msgstr "" + +#: python-ecology-lesson/reference.md:20 +msgid "" +"dataframe\n" +": is a two-dimensional labeled data structure with columns of " +"(potentially)\n" +" different type." +msgstr "" + +#: python-ecology-lesson/reference.md:24 +msgid "" +"data structure\n" +": is a particular way of organizing data in memory." +msgstr "" + +#: python-ecology-lesson/reference.md:27 +msgid "" +"data type\n" +": is a particular kind of item that can be assigned to a variable, defined " +"by\n" +" by the values it can take, the programming language in use and the " +"operations\n" +" that can be performed on it." +msgstr "" + +#: python-ecology-lesson/reference.md:32 +msgid "" +"dictionary\n" +": is an unordered Python data structure designed to contain key-value " +"pairs, where both\n" +" the key and the value can be integers, floats or strings. Elements of a " +"dictionary\n" +" can be accessed by their key and can be modified." +msgstr "" + +#: python-ecology-lesson/reference.md:37 +msgid "" +"docstring\n" +": is an optional documentation string to describe what a Python function " +"does." +msgstr "" + +#: python-ecology-lesson/reference.md:40 +msgid "" +"faceting\n" +": is the act of plotting relationships between set variables in multiple " +"subsets\n" +" of the data with the results appearing as different panels in the same " +"figure." +msgstr "" + +#: python-ecology-lesson/reference.md:44 +msgid "" +"float\n" +": is a Python data type designed to store positive and negative decimal " +"numbers\n" +" by means of a floating point representation." +msgstr "" + +#: python-ecology-lesson/reference.md:48 +msgid "" +"function\n" +": is a group of related statements that perform a specific task." +msgstr "" + +#: python-ecology-lesson/reference.md:51 +msgid "" +"integer\n" +": is a Python data type designed to store positive and negative integer " +"numbers." +msgstr "" + +#: python-ecology-lesson/reference.md:54 +msgid "" +"interactive mode\n" +": is an online mode of operation in which the user writes the commands " +"directly\n" +" on the command line one-by-one and execute them immediately by pressing " +"a button\n" +" on the keyword, usually Return." +msgstr "" + +#: python-ecology-lesson/reference.md:59 +msgid "" +"join key\n" +": is a variable or an array representing the column names over which " +"pandas.DataFrame.join()\n" +" merge together columns of different data sets." +msgstr "" + +#: python-ecology-lesson/reference.md:63 +msgid "" +"library\n" +": is a set of functions and methods grouped together to perform some " +"specific\n" +" sort of tasks." +msgstr "" + +#: python-ecology-lesson/reference.md:67 +msgid "" +"list\n" +": is a Python data structure designed to contain sequences of integers, " +"floats,\n" +" strings and any combination of the previous. The sequence is ordered and " +"indexed\n" +" by integers, starting from 0. Elements of a list can be accessed by " +"their index\n" +" and can be modified." +msgstr "" + +#: python-ecology-lesson/reference.md:73 +msgid "" +"loop\n" +": is a sequence of instructions that is continually repeated until a " +"condition\n" +" is satisfied." +msgstr "" + +#: python-ecology-lesson/reference.md:77 +msgid "" +"NaN\n" +": is an acronym for Not-a-Number and represents that either a value is " +"missing or\n" +" the calculation cannot output any meaningful result." +msgstr "" + +#: python-ecology-lesson/reference.md:81 +msgid "" +"None\n" +": is an object that represents no value." +msgstr "" + +#: python-ecology-lesson/reference.md:84 +msgid "" +"scripting mode\n" +": is an offline mode of operation in which the user writes the commands to " +"be\n" +" executed in a text file (with .py extension for Python) which is then " +"compiled\n" +" or interpreted to run the program. Notes that Python interprets script " +"on\n" +" run-time and compiles a binary version of the program to speed up the " +"execution time." +msgstr "" + +#: python-ecology-lesson/reference.md:90 +msgid "" +"Sequential (data structure)\n" +": is an ordered group of objects stored in memory which can be accessed " +"specifying\n" +" their index, i.e. their position, in the structure." +msgstr "" + +#: python-ecology-lesson/reference.md:94 +msgid "" +"SQL\n" +": or Structured Query Language, is a domain-specific language for managing " +"data\n" +" stored in a relational database management system (RDBMS)." +msgstr "" + +#: python-ecology-lesson/reference.md:98 +msgid "" +"SQLite\n" +": is a self-contained, public domain SQL database engine." +msgstr "" + +#: python-ecology-lesson/reference.md:101 +msgid "" +"string\n" +": is a Python data type designed to store sequences of characters." +msgstr "" + +#: python-ecology-lesson/reference.md:104 +msgid "" +"tuple\n" +": is a Python data structure designed to contain sequences of integers, " +"floats,\n" +" strings and any combination of the previous. The sequence is ordered and " +"indexed\n" +" by integers, starting from 0. Elements of a tuple can be accessed by " +"their index\n" +" but cannot be modified." +msgstr "" + +# Front Matter +#: python-ecology-lesson/setup.md:1 +msgid "" +"---\n" +"layout: page\n" +"title: Setup\n" +"---" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/setup.md:6 +msgid "> ## Data" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/setup.md:7 +msgid "> Data for this lesson is from the Portal Project Teaching Database -" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/setup.md:8 +msgid "" +"> [available on FigShare](https://figshare.com/articles/" +"Portal_Project_Teaching_Database/1314459)." +msgstr "" + +#: python-ecology-lesson/setup.md:9 +msgid "" +">\n" +"> We will use the six files listed below for the data in this lesson.\n" +"> Download these files to your computer either by clicking\n" +"> [this link](https://github.com/weecology/portal-teachingdb/archive/master." +"zip),\n" +"> which will give you everything in a single compressed file.\n" +"> You'll need to unzip this file after downloading it.\n" +">\n" +"> Or download each file indvidually with the following links:\n" +">\n" +"> - [surveys.csv](https://ndownloader.figshare.com/files/10717177)\n" +"> - [species.csv](https://ndownloader.figshare.com/files/3299483)\n" +"> - [speciesSubset.csv]({{ page.root }}/data/speciesSubset.csv)\n" +"> - [plots.csv](https://ndownloader.figshare.com/files/3299474)\n" +"> - [bouldercreek_09_2013.txt]({{ page.root }}/data/bouldercreek_09_2013." +"txt)\n" +"> - [SQL Database](https://ndownloader.figshare.com/files/11188550)" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/setup.md:28 +msgid "> ## Software" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/setup.md:29 +msgid "> [Python](http://python.org) is a popular language for" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/setup.md:30 +msgid "> scientific computing, and great for general-purpose programming as" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/setup.md:31 +msgid "> well. Installing all of its scientific packages individually can be" +msgstr "" + +# blockquote, which can be cascaded +#: python-ecology-lesson/setup.md:32 +msgid "> a bit difficult, so we recommend an all-in-one installer." +msgstr "" + +#: python-ecology-lesson/setup.md:33 +msgid "" +">\n" +"> For this workshop we use Python version 3.x.\n" +">\n" +"> ### Required Python Packages for this workshop\n" +">\n" +"> * [Pandas](http://pandas.pydata.org/)\n" +"> * [Jupyter notebook](http://jupyter.org/)\n" +"> * [Numpy](http://www.numpy.org/)\n" +"> * [Matplotlib](http://matplotlib.org/)" +msgstr "" + +# header +#: python-ecology-lesson/setup.md:44 +msgid "## Install the workshop packages" +msgstr "" + +#: python-ecology-lesson/setup.md:46 +msgid "" +"For installing these packages we will use Anaconda or Miniconda.\n" +"They both use [Conda](http://conda.pydata.org/docs/), the main difference " +"is\n" +"that Anaconda comes with a lot of packages pre-installed.\n" +"With Miniconda you will need to install the required packages." +msgstr "" + +# header +#: python-ecology-lesson/setup.md:51 +msgid "### Anaconda installation" +msgstr "" + +#: python-ecology-lesson/setup.md:53 +msgid "Anaconda will install the workshop packages for you." +msgstr "" + +# header +#: python-ecology-lesson/setup.md:55 +msgid "#### Download and install Anaconda" +msgstr "" + +#: python-ecology-lesson/setup.md:57 +msgid "" +"Download and install [Anaconda](https://www.anaconda.com/distribution/" +"#download-section).\n" +"Remember to download and install the installer for Python 3.x." +msgstr "" + +# header +#: python-ecology-lesson/setup.md:60 +msgid "#### Download plotting package" +msgstr "" + +#: python-ecology-lesson/setup.md:62 +msgid "" +"The plotting package plotnine is not installed by default. From the " +"terminal,\n" +"type:" +msgstr "" + +# code block +#: python-ecology-lesson/setup.md:65 +msgid "" +"~~~\n" +"conda install -c conda-forge plotnine\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/setup.md:70 +msgid "### Miniconda installation" +msgstr "" + +#: python-ecology-lesson/setup.md:72 +msgid "" +"Miniconda is a \"light\" version of Anaconda. If you install and use " +"Miniconda\n" +"you will also need to install the workshop packages." +msgstr "" + +# header +#: python-ecology-lesson/setup.md:75 +msgid "#### Download and install Miniconda" +msgstr "" + +#: python-ecology-lesson/setup.md:77 +msgid "" +"Download and install [Miniconda](https://docs.conda.io/en/latest/miniconda." +"html)\n" +"following the instructions. Remember to download and run the installer for\n" +"Python 3.x." +msgstr "" + +# header +#: python-ecology-lesson/setup.md:81 +msgid "#### Check the installation of Miniconda" +msgstr "" + +#: python-ecology-lesson/setup.md:83 python-ecology-lesson/setup.md:92 +msgid "From the terminal, type:" +msgstr "" + +# code block +#: python-ecology-lesson/setup.md:85 +msgid "" +"~~~\n" +"conda list\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/setup.md:90 +msgid "### Install the required workshop packages with conda" +msgstr "" + +# code block +#: python-ecology-lesson/setup.md:94 +msgid "" +"~~~\n" +"conda install -y numpy pandas matplotlib jupyter\n" +"conda install -c conda-forge plotnine\n" +"~~~" +msgstr "" + +# header +#: python-ecology-lesson/setup.md:100 +msgid "## Launch a Jupyter notebook" +msgstr "" + +#: python-ecology-lesson/setup.md:102 +msgid "" +"After installing either Anaconda or Miniconda and the workshop packages,\n" +"launch a Jupyter notebook by typing this command from the terminal:" +msgstr "" + +# code block +#: python-ecology-lesson/setup.md:105 +msgid "" +"~~~\n" +"jupyter notebook\n" +"~~~" +msgstr "" + +#: python-ecology-lesson/setup.md:110 +msgid "" +"The notebook should open automatically in your browser. If it does not or " +"you\n" +"wish to use a different browser, open this link: ." +msgstr "" + +#: python-ecology-lesson/setup.md:113 +msgid "" +"For a bried introduction to Jupyter Notebooks, please consult with our\n" +"[Introduction to Jupyter Notebooks](jupyter_notebooks) page." +msgstr "" diff --git a/po/python-ecology-lesson.pot b/po/python-ecology-lesson.pot index 3a0fdf48..9a0406d8 100644 --- a/po/python-ecology-lesson.pot +++ b/po/python-ecology-lesson.pot @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: i18n\n" "Report-Msgid-Bugs-To: https://github.com/haiwen/seafile-docs/issues\n" -"POT-Creation-Date: 2021-03-09 14:32:15+0900\n" +"POT-Creation-Date: 2021-08-11 00:18:46+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" diff --git a/po/shell-novice.ja.po b/po/shell-novice.ja.po index ca42f83a..f5f11a7e 100644 --- a/po/shell-novice.ja.po +++ b/po/shell-novice.ja.po @@ -1,6 +1,6 @@ # Japanese translation of the Software Carpentry Unix Shell Lesson # Copyright (C) 2021 Software Carpentry Foundation; Japanese Translation Team -# This file is distributed under the same license as the PACKAGE package. +# This file is distributed under the same license as the po4gitbook package. # Software-Carpentry Japanese-Team , 2019, 2020, 2021. # msgid "" @@ -16,7 +16,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" -"X-Generator: Poedit 2.3\n" +"X-Generator: Poedit 3.0\n" # Front Matter #: shell-novice/CODE_OF_CONDUCT.md:1