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