Back to marketplace

pandas

No description yet. This curated deck is ready for daily study.

Total cards: 19•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (19)

#1
Front (Question)

import pandas library

Back (Answer)

import pandas as pd

#2
Front (Question)

create a hardcoded dataframe

Back (Answer)

dfHardCoded = pd.DataFrame( # records [ ['Jan', 23, 62], ['Feb', 11, 50], ['Mar', 40, 45], ['Apr', 22, 26], ['May', 40, 60], ['Jun', 10, 62] ], # indices index = [ 0, 1, 2, 3, 4, 5], # column headers columns = [ "month", "lowest", "highest"] )

#3
Front (Question)

read data.csv. It is a TSV

Back (Answer)

df = pd.read_csv(“data.csv”, sep=”\t”)

#4
Front (Question)

descriptive statistics table for dataframe “df”

Back (Answer)

df.describe()

#5
Front (Question)

first 5 elements of “df”

Back (Answer)

df.head()

#6
Front (Question)

last 10 elements of “df”

Back (Answer)

df.tail(10)

#7
Front (Question)

datatypes of “df”

Back (Answer)

df.dtypes

#8
Front (Question)

information about the indices of records of “df”

Back (Answer)

df.index

#9
Front (Question)

values of “df” (i.e. records) as a numpy array

Back (Answer)

df.values

#10
Front (Question)

sort values of “df” based on feature “color”, descending

Back (Answer)

df.sort(“color’”, ascending=False)

#11
Front (Question)

return “color” column of dataframe as a pandas series object

Back (Answer)

df[“color”]

#12
Front (Question)

return “color” and “price” columns of dataframe as a pandas dataframe object

Back (Answer)

df[“color”, “price”]

#13
Front (Question)

return a range of records between indices 13-50

Back (Answer)

df[13:51]

#14
Front (Question)

return “color” at indices 2 and 3

Back (Answer)

df.loc[2:4,[“color”]]

#15
Front (Question)

return price at indices 3 and 4. You don’t know the exact name of the price column, but you know it’s index is 7 in the array of columns

Back (Answer)

df.iloc[3:5,[7]]

#16
Front (Question)

return all records with “age” below 10

Back (Answer)

df[df.age < 10]

#17
Front (Question)

return all records with “month” being “Jan” or “Feb”

Back (Answer)

df[df.month.isin([“Jan”, “Feb”])]

#18
Front (Question)

assign 0 to “score” at records 50 to 100

Back (Answer)

df.loc[50:101, [“score”]] = 0

#19
Front (Question)

export to “hello.csv”. Make it tab delimited

Back (Answer)

df.to_csv(“hello.csv”, sep=”\t”)