Python - Data Science Flashcards

Common Python DS Functions

1
Q

Name 3 libraries & their uses.

A

Numpy = lower level computation

Pandas = built atop numpy, used for data analysis

Scikit-Learn = use ML models

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

pd.read_csv(filename)

A

imports data from CSV file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

pd.read_table(filename)

A

imports data from a delimited text file (like TSV)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

pd.read_excel(filename)

A

imports data from an Excel file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

pd.read_sql(query, connection_object)

A

reads from an SQL table/database

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

pd.read_json(json_string)

A

reads from a JSON formatted string, URL, or file

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

pd.read_html(url)

A

parses an html URL, string, or file and extracts tables to a list in a dataframe

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

pd.read_clipboard()

A

takes the contents of your clipboard and passes it to read_table()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

pd.DataFrame(dict)

A

from a dict, keys for column names, values for data as lists

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

df.shape()

A

prints the numbers of rows and columns in a DF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

df.head(n)

A

prints the first n rows of the DF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

df.tail(n)

A

prints the last n rows of the DF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

df.info()

A

returns the index, data type, and memory info

How well did you know this?
1
Not at all
2
3
4
5
Perfectly