EasyNo. 2878
Get the Size of a DataFrame — LeetCode 2878 Python Solution
- Topics
- Pandas
- Reading time
- 2 min
- Source
- leetcode.com
Table schema
DataFrame players: +-------------+--------+ | Column Name | Type | +-------------+--------+ | player_id | int | | name | object | | age | int | | position | object | | ... | ...Example
DataFrame players:
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| player_id | int |
| name | object |
| age | int |
| position | object |
| ... | ... |
+-------------+--------+Python solution
import pandas as pd
def getDataframeSize(players: pd.DataFrame) -> List[int]:
return list(players.shape)Complexity
- Time
- O(n)
- Space · auxiliary
- O(1) to O(n)
Related problems
| No. | Problem | Difficulty |
|---|---|---|
| 2877 | Create a DataFrame from List | Easy |
| 2874 | Maximum Value of an Ordered Triplet II | Medium |
| 2873 | Maximum Value of an Ordered Triplet I | Easy |
| 0057 | Insert Interval | Medium |
| 0192 | Word Frequency | Medium |
| 0193 | Valid Phone Numbers | Easy |
Frequently asked questions
- How hard is LeetCode 2878. Get the Size of a DataFrame?
LeetCode 2878. Get the Size of a DataFrame is rated Easy on LeetCode.
- What topics does LeetCode 2878. Get the Size of a DataFrame cover?
LeetCode 2878. Get the Size of a DataFrame is tagged Pandas on LeetCode.