Microsoft Certified Azure Enterprise Data Analyst Associate · Free Practice Question Easy
Question 18
When creating a Python visual in Power BI Desktop, what is the correct way to reference the Unit Price column in the Python code when retrieving its value from a DataFrame?
- A dataset['Unit Price']
- B ('Unit Price')
- C pandas.DataFrame('Unit Price')
- D data = ['Unit Price']
Reveal correct answer
Correct answer: A
Explanation
The correct option for referencing the Unit Price column in the Python code is dataset['Unit Price']. This syntax allows you to retrieve a specific column from a DataFrame in Power BI Desktop. Option B, ('Unit Price'), is incorrect because it uses parentheses instead of square brackets, which is the correct syntax for accessing a column in a DataFrame. Option C, pandas.DataFrame('Unit Price'), is also incorrect because it creates a new DataFrame with only the 'Unit Price' column, rather than accessing the column from an existing DataFrame. Option D, data = [Unit Price], is incorrect because it uses incorrect syntax and does not properly reference the column.Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
You must be logged in to post a comment.
