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