Get the Size of a DataFrame — LeetCode 2878 Python Solution
EasyPandas
- Problem
- #2878
- Reading time
- 2 min
- Source
- leetcode.com
Table schema
SQL
DataFrame players: +-------------+--------+ | Column Name | Type | +-------------+--------+ | player_id | int | | name | object | | age | int | | position | object | | ... | ...Example
SQL
DataFrame players:
+-------------+--------+
| Column Name | Type |
+-------------+--------+
| player_id | int |
| name | object |
| age | int |
| position | object |
| ... | ... |
+-------------+--------+Python solution
Python
import pandas as pd
def getDataframeSize(players: pd.DataFrame) -> List[int]:
return list(players.shape)Complexity
| Measure | Complexity |
|---|---|
| Time | O(n) |
| Space | O(1) to O(n) auxiliary |
Related problems
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.