Level 10 : Given the following DataFrame df, what will df.loc[df['A'] > 2, 'B'] return?


import pandas as pd

df = pd.DataFrame({
    'A': [1, 2, 3, 4],
    'B': ['a', 'b', 'c', 'd']
})

Author: KaivalyaG | Tags: pandas | 1859+ Python FAQs | Share
assignment-operators | numpy | floats | __future__ | inheritance | __init_subclass__ | function | lambdas | asyncio-module | binary-operation | escape-operator | inherit | identity-operator | collections | aggregating-data-with-functools.reduce() | built-in-function | call | indexing:-loc-vs-iloc | invalid-list | comment | list-comprehension | benefit | input-function | docstring | exception | exception-handling | loop | assignment-operator | class-and-instance-variable | regular-expressions | introduction-to-multiprocessing | literal-characters-and-special-characters | random | parsing-with-strptime | postfix | thread-safe-data-structures-(queue.queue) | recurssion | format | list-mutation | numeric | global-keyword | global-variable | test-discovery | string-slicing | error | bitwise | logical-operators | sys-module | higher-order-function | global | sorting | implementation | operator | set-operation | sorting-and-ranking | overflow | __all__-attribute | else | string | reading:-read(),-readline(),-readlines() | precedence | set | boolean-and-non-boolean | lambda-function | operand | pseudocode | async | syntax-error | staticmethod | lambda-functions | enumerate() | round-function | string-formatting | iterator | multiple-inheritance | fabs-function | sum-function | loop-control | matplotlib | center | oops | command-line-parsing | sum() | arbitrary-arguments-(*args,-**kwargs) | built-in-modules | min-function | thread-synchronization | mathematics | tuple | type-conversion | opening-files-(open()) | dictionary | file-handling | touples | module | access-modifier | tuples | dictionary-comprehensions | introduction-to-threads | iterators | nested-loop | zip | list-join | data-type | slice | threading | while-loops | python | boolean | binary | default-mutable-argument | syntax-error | identity-operator | operators | methods | logical-operator | typeerror | init | encapsulation | functional-programming | namespace | asyncio | mysql | loops | using-join()-and-is_alive()-methods | advanced-file-operations | raise-statement | string-formatting | walking-through-directories-using-os.walk() | design-principle | list-method | list-methods-and-slicing | name-mangling | python-module | map-function | sets | using-yield-in-functions | choice | introduction-to-python | python-history | arithmetic-expression | logical-operator | compute | booleans | complex-number | python-operators | multiple-except-blocks | expand-tab | regex | operator-or | using-lists-as-stacks | with-statement | goto-function | rollback | single-inheritance | using-assertions-(assertequal,-assertraises) | swapping | immutability | odd-number | reading-and-writing-files | math | input-function | working-with-binary-files-(rb,-wb) | recursion | object-attribute | intering | multiple-inheritance | generators-in-python | syntaxerror | import-method | package-management | stack | type-conversion | software-design | while-else-loop | comparison | class-decorators | collection | string-method | matrix-list-comprehension | bitwise-operator | mathematical-function | basic | string-iteration | magic-method | update | time-series-with-pandas | array | unit-testing | sorted | function-and-scope | version | class-and-object | datetime | feature | attribute | precedence-and-associativity | regular-expression | print-statement | destructor | installation | min-max-function | library | function-argument | control-flow | heap-memory | python-repl | counter | else-statement | memory | tuple-methods | anchors-(^,-$) | generator | identifier | objects | head-and-tail | class-and-inheritance | virtual-environment | while-and-for-loop | quantifiers-(*,-+,-?,-{}) | assert | formatting-with-strftime | list-slicing | immutable-data-type | default-arguments | classes | memory-management | list-vs-tuple | formal-and-actual-parameter | list,-set,-and-dictionary-comprehensions | working-with-file-paths | slicing | thread | sys | int | append | multithreading | built-in | oop | datetime.date,-datetime.time,-datetime.datetime | version-check | arithmetic-operation | why-use-multiprocessing-over-threading?-(gil) | string-method | join | working-with-temporary-files-using-tempfile | key-value-pairs | list-comprehension | bitwise-operator | writing:-write(),-writelines() | directory-operations | built-in-function | application | pickling--unpickling | data-structure | parameter | debugging | input | list | managing-directories-with-os-and-shutil | frozenset | id-function | zip-function | using-the-threading-module | print | string-slicing | data-structures | class | membership-operators-(in,-not-in) | constructor | statement | lambda | iterable | control-flow | identity-operators-(is,-is-not) | keyword | creating-custom-modules | logical-operation | round | dictionaries | integers | joining-and-merging-dataframes | max-min | handling-missing-values-(fillna,-dropna) | generators | using-os-and-pathlib-modules | functional-programming | type_conversion | reading-and-writing-large-files-efficiently | data-structures-in-python | exception-handling | filter-function | python-syntax-and-structure | filter | yield | return-statement | descriptors | list-operation | static-method | encoding | def | math-copysign | error-handling | match | conditional-statement | comprehension | copy | creating-and-starting-threads | functions | conditional-statements | for | turtle | operator-overloading | mapping-function | polymorphism | file-handling | filtering-and-indexing | gil | syntax | operations | type-conversion-and-casting | complex | random-function | floating-point-precision | variable | string-methods | data-type | scientific-notation | pandas | control-statement | python_version | lists | counter-function | list-comprehensions | range | deep-copy | context-manager | exponentiation | namedtuple | while-loop | condition | dictionary-methods | conditional-statement | file | factorial-function | data-type-conversions | method | global-variable | defining-functions | string-concatenation | loop-control-statements | python-django | zfill-function | data-structure | method-overloading | file_handling | pep | mutable | pass | dicts | using-else-and-finally | shallow-copy | data-types | multiprocessing | data_structure | error-handling | decimal | overriding-methods | indentation | indexing | interpreter | string-manipulation | raise | tuple-unpacking | list-indexing | dataframe-and-series-objects | integer | matrix | operator-and | conversion | datatype | working-with-dates-and-times | difference-between-threads-and-processes | decorator | using-map()-for-transformations | boolean-masking | expression | virtual-environment | split | strings ...