<!--DEBUG:--><!--DEBUG:dc3-united-states-software-in-english-pdf-2--><!--DEBUG:--><!--DEBUG:dc3-united-states-software-in-english-pdf-2--><!--DEBUG-spv-->{"id":2049066,"date":"2021-12-04T16:11:00","date_gmt":"2021-12-04T14:11:00","guid":{"rendered":"http:\/\/nhub.news\/?p=2049066"},"modified":"2021-12-04T18:03:08","modified_gmt":"2021-12-04T16:03:08","slug":"getting-started-with-pandas-lesson-2","status":"publish","type":"post","link":"http:\/\/nhub.news\/fr\/2021\/12\/getting-started-with-pandas-lesson-2\/","title":{"rendered":"Getting Started With Pandas \u2013 Lesson 2"},"content":{"rendered":"<p style=\"text-align: justify;\"><b>In this article, we are going to make a summary of the different functions that are used in Pandas to perform Indexing, Selection, and Filtering.<\/b><br \/>\nJoin the DZone community and get the full member experience. We begin with the second post of our training saga with Pandas. In this article, we are going to make a summary of the different functions that are used in Pandas to perform Indexing, Selection, and Filtering. Before we start, we are going to visualize ahead of our didactic dataset that we are going to follow to show the examples. It is a well-known dataset that contains wine information. As an introduction, we are going to explain some functions that can be very useful when obtaining a broader view of the state of our dataset. We will start with info() function, which offers us insights about the number of columns, name of every column, We start with the info() function that provides us with information about the number and names of columns, the number of non-null elements, and the data type of each column. We continue with the dtypes attribute that shows us exclusively the data type of each column. The following function provides us with information on numerous statistical calculations that help us understand the distribution of our dataset. Here we are going to take a deep dive into explaining the two main indexing and selection pandas functions: \u2018iloc\u2019 and \u2018loc\u2019 +.loc is primarily label-based, but may also be used with a boolean array..loc will raise KeyError when the items are not found. Allowed inputs are: \u2013 A single label, e.g.5 or \u2018a\u2019 (Note that 5 is interpreted as a label of the index. This use is not an integer position along with the index.). \u2013 A list or array of labels [\u2018a\u2019, \u2018b\u2019, \u2018c\u2019]. \u2013 A slice object with labels \u2018a\u2019:\u2019f\u2019 (Note that contrary to usual Python slices, both the start and the stop are included, when present in the index! See Slicing with labels and Endpoints are inclusive.) \u2013 A boolean array (any NA values will be treated as False). \u2013 A callable function with one argument (the calling Series or DataFrame) and that returns valid output for indexing (one of the above). +.iloc is primarily integer position based (from 0 to length-1 of the axis), but may also be used with a boolean array..iloc will raise IndexError if a requested indexer is out-of-bounds, except slice indexers which allow out-of-bounds indexing. (this conforms with Python\/NumPy slice semantics). Allowed inputs are: \u2013 An integer e.g.5. \u2013 A list or array of integers [4,3,0]. \u2013 A slice object with ints 1:7. \u2013 A boolean array (any NA values will be treated as False). \u2013 A callable function with one argument (the calling Series or DataFrame) and that returns valid output for indexing (one of the above). There is no better way to understand how a function works than showing examples, so here you have a wide range of useful examples to see what are the different ways to use them. + Get the first row + Get the first column + Get the first column of the first row + Get rows from 3 to 5 + Get rows 3,7,10 + Get last five rows + Get the first row of column \u2018quality\u2019 + Get all rows from columns \u2018quality&rsquo;, \u2018sulphates\u2019, \u2018alcohol\u2019 + Get from row called \u2018liters\u2019 forward from columns \u2018quality\u2019 to \u2018alcohol\u2019 + Get rows from 3 to 5 (Different from iloc) One of the things that help us the most when we are working with data is being able to filter it according to certain conditions. For them, the `loc`\u2019 function allows us to introduce these conditions in the following way: + Get all wines which quality is greater than 6 + Get all wines which quality is greater than 5 and less than 8 + Get all wines which quality is equal to 5 or equal to 7 That&rsquo;s all for today. Over the next chapter, we will get a deep dive into the functions we use to iterate, map, group, and sort. Published at DZone with permission of David Suarez. See the original article here. Opinions expressed by DZone contributors are their own.<\/p>\n<script>jQuery(function(){jQuery(\".vc_icon_element-icon\").css(\"top\", \"0px\");});<\/script><script>jQuery(function(){jQuery(\"#td_post_ranks\").css(\"height\", \"10px\");});<\/script><script>jQuery(function(){jQuery(\".td-post-content\").find(\"p\").find(\"img\").hide();});<\/script>","protected":false},"excerpt":{"rendered":"<p>In this article, we are going to make a summary of the different functions that are used in Pandas to perform Indexing, Selection, and Filtering. Join the DZone community and get the full member experience. We begin with the second post of our training saga with Pandas. In this article, we are going to make [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2049065,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[93],"tags":[],"_links":{"self":[{"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/posts\/2049066"}],"collection":[{"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/comments?post=2049066"}],"version-history":[{"count":1,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/posts\/2049066\/revisions"}],"predecessor-version":[{"id":2049067,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/posts\/2049066\/revisions\/2049067"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/media\/2049065"}],"wp:attachment":[{"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/media?parent=2049066"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/categories?post=2049066"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/nhub.news\/fr\/wp-json\/wp\/v2\/tags?post=2049066"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}