Data Management & Integration Flashcards
7 cards from real POC practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Data Management & Integration flashcards as text
Which Python library provides the 'DataFrame.from_records()' constructor to create a DataFrame from a list of dicts?
Answer: pandas
pandas.DataFrame.from_records() builds a DataFrame from a sequence of tuples or list of dictionaries.
What does the 'melt()' function in pandas accomplish?
Answer: Unpivots a wide DataFrame into a long format
melt() transforms columns into rows, converting a wide DataFrame into a long (tidy) format.
In Python, which built-in module provides the 'shelve' functionality for persistent key-value storage of Python objects?
Answer: shelve
The shelve module creates a persistent dictionary-like object backed by a dbm database that stores pickled Python objects.
When executing a parameterized SQL query in sqlite3, which style uses '?' as a placeholder?
Answer: qmark style (?)
sqlite3 supports qmark style where '?' marks each positional parameter supplied as a tuple to cursor.execute().
Which pandas method reindexes a DataFrame, inserting NaN for any new labels not present in the original?
Answer: reindex()
reindex() conforms a DataFrame to a new index, filling gaps with NaN or a specified fill_value.
What is the primary advantage of using SQLAlchemy's connection pooling over creating a new connection for each query?
Answer: It reuses existing database connections, reducing overhead
Connection pooling maintains a set of open connections that are reused, avoiding the cost of establishing a new TCP connection for every query.
Which method in pandas is used to apply a function element-wise to every value in a DataFrame?
Answer: df.applymap()
df.applymap() (renamed df.map() in pandas 2.1+) applies a callable to each individual element across the entire DataFrame.