Skip to content

Commit 82e9265

Browse files
committed
Lading dataframes
Accessing column lengths, series, and unique elements
1 parent fd41cff commit 82e9265

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Diff for: Numpy-Pandas/script.py

+15
Original file line numberDiff line numberDiff line change
@@ -184,3 +184,18 @@ def download_and_load_csv(url):
184184
df = download_and_load_csv(filename)
185185
if df is not None:
186186
print(df.head())
187+
188+
# Accessing the column length
189+
x = df[['Length']]
190+
print(x)
191+
192+
# Getting the column as series
193+
x_series = df['Length']
194+
print(x_series)
195+
196+
# Accessing multiple columns
197+
x_multiple = df[['Artist','Length','Genre']]
198+
print(x_multiple)
199+
200+
# Accessing unique elements is the iloc method where i can access the first row and the first column
201+
print(df.iloc[0,0])

0 commit comments

Comments
 (0)