Designing and Implementing Enterprise-Scale Analytics Using Microsoft Azure and Power BI — Question 20
You are creating a Python visual in Power BI Desktop.
You need to retrieve the value of a column named Unit Price from a DataFrame.
How should you reference the Unit Price column in the Python code?
Answer options
- A. dataset[‘Unit Price’]
- B. (‘Unit Price’)
- C. pandas.DataFrame(‘Unit Price’)
- D. data = [Unit Price]
Correct answer: A
Explanation
The correct answer is A, as it accurately uses the syntax to access a column in a DataFrame using square brackets. Options B and D do not follow the correct syntax for referencing a DataFrame column, while C incorrectly suggests creating a new DataFrame instead of accessing an existing column.