Skip to content

Practice Get the Size of a DataFrame

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#2878
LeetCode Problem

Get the Size of a DataFrame

Problem Statement

Given the DataFrame players, return [numberOfRows, numberOfColumns]. Its columns include player_id (int), name (object), age (int) and position (object), and it may contain additional columns. Count every existing column.

Source: Get the Size of a DataFrame on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
+-----------+----------+-----+-------------+--------------------+ | player_id | name     | age | position    | team               | +-----------+----------+-----+-------------+--------------------+ | 846       | Mason    | 21  | Forward     | RealMadrid         | | 749       | Riley    | 30  | Winger      | Barcelona          | | 155       | Bob      | 28  | Striker     | ManchesterUnited   | | 583       | Isabella | 32  | Goalkeeper  | Liverpool          | | 388       | Zachary  | 24  | Midfielder  | BayernMunich       | | 883       | Ava      | 23  | Defender    | Chelsea            | | 355       | Violet   | 18  | Striker     | Juventus           | | 247       | Thomas   | 27  | Striker     | ParisSaint-Germain | | 761       | Jack     | 33  | Midfielder  | ManchesterCity     | | 642       | Charlie  | 36  | Center-back | Arsenal            | +-----------+----------+-----+-------------+--------------------+
Output
[10, 5]

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.