1

Pandas Practice: Simple Query #2

Unsolved
Data Wrangling

Difficulty: 2 | Problem written by peter.washington

Educational Resource: https://web.stanford.edu/class/cs102/readings/pandasreferences.htm


Problem reported in interviews at

Apple
Netflix

Pandas data manipulation is a crucial skill for a data scientist.For this problem, you are given as input a dataframe. Return a list of strings representing the elements of column b for which column a is a positive number.

For example, you could be given the following pandas dataframe, where a, b, and c are the column names and 0, 1, and 2 are the row indices:

   a b c

0 -1 2 3

1 400 5 6

2 700 8 9

In this case, you would return the following list of strings:

["5", "8"]

You can assume that there will always be at least 1 row where column a is positive.

Sample Input:
<class 'str'>
df: a b c 0 -100 2 3 1 400 5 6 2 700 8 9

Expected Output:
<class 'list'>
['5', '8']

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

Iste sequi hic eos eaque fuga animi quam nulla totam dignissimos, laboriosam nihil eligendi atque, animi a hic inventore natus totam ea nemo reprehenderit itaque, itaque assumenda architecto quis beatae, ipsam eaque enim possimus. Labore incidunt nihil quasi totam accusantium pariatur officia, voluptates neque ex minima aspernatur, provident cupiditate repellat eos id quas ea numquam sit accusantium iure pariatur, sequi quis laboriosam atque cupiditate consequatur quae facere tenetur id nihil?

Quod beatae sequi voluptatem ad repudiandae quas dolor quae, mollitia voluptate iste sequi ratione minima eum, distinctio rem earum enim, cumque iure voluptates natus quidem ratione dolore. Sapiente quasi recusandae mollitia iste ut consectetur sed eius, provident nostrum vel laborum, distinctio praesentium repellat voluptatibus. Dolores dolor autem explicabo in, quod aspernatur omnis quo minus veniam tempore molestias harum quasi necessitatibus, nisi dolor amet dolore excepturi, at repudiandae nam quam suscipit ab, asperiores earum nostrum? Nulla minima debitis accusamus illum sint ut eum pariatur, sunt quis maiores nulla, in perferendis itaque voluptatum nihil blanditiis repellendus officia est error ad, rerum molestiae ex eum eaque fuga voluptate sit in porro culpa?

Voluptatum aperiam molestiae quas?

This is a premium feature.
To access this and other such features, click on upgrade below.

Ready.

Input Test Case

Please enter only one test case at a time
numpy has been already imported as np (import numpy as np)