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 pandas method removes duplicate rows from a DataFrame?
Answer: drop_duplicates()
drop_duplicates() returns a DataFrame with duplicate rows removed, keeping the first occurrence by default.
In Python's csv module, which class is used to write rows to a CSV file?
Answer: csv.writer
csv.writer() creates a writer object whose writerow() or writerows() methods write data to a CSV file.
What is the role of 'transactions' in database management when using Python's sqlite3 module?
Answer: They group SQL operations so all succeed or all fail atomically
A transaction groups multiple SQL statements into an atomic unit; if any statement fails, a rollback reverts all changes.
Which pandas method writes a DataFrame to an Excel file?
Answer: df.to_excel()
df.to_excel() exports a DataFrame to an .xlsx file, requiring the openpyxl library to be installed.
What does the 'dtype' parameter control in pd.read_csv()?
Answer: The data type assigned to one or more columns on import
Passing dtype={'col': str} forces pandas to parse the specified columns as the given data type instead of inferring them.
In SQLAlchemy Core, which function is used to construct a SELECT statement programmatically?
Answer: sqlalchemy.select()
sqlalchemy.select() builds a SELECT SQL expression that can be executed against a connection.
When writing a large DataFrame to a SQL database with pandas, which method is most appropriate?
Answer: df.to_sql()
df.to_sql() writes a DataFrame to a SQL table using an SQLAlchemy engine or sqlite3 connection, with options for if_exists and chunksize.