Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Exploring Data [1/3] | Reading and Exploring Data
Introduction to pandas [track]

bookExploring Data [1/3]

What can you do with loaded data? First, you need to explore it.

You can get the first or the last n rows of DataFrame. To get the first n rows apply the .head(n) method. To get the last n - apply the .tail(n) method.

Default value of the parameter n is 5 (i.e., if you don't write it, then 5 rows will be printed).

12345678910
# Importing library import pandas as pd # Reading csv file df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/67798cef-5e7c-4fbc-af7d-ae96b4443c0a/audi.csv') # The first 5 rows print(df.head()) # or df.head(5) # The last 3 rows print(df.tail(3))
copy

To get n sample rows, apply the .sample(n) method. Default value for n in this method is 1.

12345678
# Importing library import pandas as pd # Reading csv file df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/67798cef-5e7c-4fbc-af7d-ae96b4443c0a/audi.csv') # 2 random rows print(df.sample(2))
copy

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 2. Kapitel 3

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

Suggested prompts:

Spørg mig spørgsmål om dette emne

Opsummér dette kapitel

Vis virkelige eksempler

Awesome!

Completion rate improved to 3.33

bookExploring Data [1/3]

Stryg for at vise menuen

What can you do with loaded data? First, you need to explore it.

You can get the first or the last n rows of DataFrame. To get the first n rows apply the .head(n) method. To get the last n - apply the .tail(n) method.

Default value of the parameter n is 5 (i.e., if you don't write it, then 5 rows will be printed).

12345678910
# Importing library import pandas as pd # Reading csv file df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/67798cef-5e7c-4fbc-af7d-ae96b4443c0a/audi.csv') # The first 5 rows print(df.head()) # or df.head(5) # The last 3 rows print(df.tail(3))
copy

To get n sample rows, apply the .sample(n) method. Default value for n in this method is 1.

12345678
# Importing library import pandas as pd # Reading csv file df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/67798cef-5e7c-4fbc-af7d-ae96b4443c0a/audi.csv') # 2 random rows print(df.sample(2))
copy

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 2. Kapitel 3
some-alt