Deck 1 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Adoption of home broadband has stalled in the United States

A

stopped moving or developing

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

Beautifulsoup how to print clearly the content of ‘soup’

A

soup.preffity()

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

Dimensions du DataFrame boston ?

A

boston.shape

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

How to create a cross validation set with sklearn ?

A

X_train, X_test, Y_train, Y_test = cross_validation.train_test_split(X,Y,test_size=0.3,random_state=0)

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

How to get boston sklearn data to pandas

A
bos = pd.DataFrame(boston.data)
bos.columns = boston.features_names
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How to have infos on columns in pandas

A

df.info()

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

How to know the types of columns in pandas

A

df.dtype

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

plot boston crime vs boston housing price

A

plt. scatter(bos.CRIM, bos.PRICE)
plt. xlabel(“Per capita crime rate by town (CRIM)”)
plt. ylabel(“Housing Price”)
plt. title(“Relationship between CRIM and Price”)

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

quelles options sont dispo dans pandas ?

A

pd. set_option(‘display.width’, 500)
pd. set_option(‘display.max_columns’, 100)
pd. set_option(‘display.notebook_repr_html’, True)

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

Relational Database principle ?

A

Don’t say seek 20 bytes onto disk and pick up from there. Say : selecta data from a set. I dont care where it is, just get the row to me

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

Replace missing values in Age of Titanic passengers with mean value of Ages

A

df1[‘Age’][np.isnan(df1[‘Age’])] = np.median(df1[‘Age’])
or
test.Age = test.Age.fillna(np.median(test[‘Age’]))

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

Rester au courant de l’actualité en anglais?

A

Keeping up with news

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

The decline “could represent a blip or might be a more prolonged reality,”

A

Something that does not last

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

Import module for regular expressions

A

Import re

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

How to import float division

A

From __future__ import division

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

Comment créer une exception lors d’un division par 0

A

try:
Print 0/0
except ZeroDivisionError:
print “cannot divide by 0”

17
Q

Comment unpack une liste [1,2]

A

X,y=[1,2]

18
Q

Import module for regular expressions

A

Import re

19
Q

How to import float division

A

From __future__ import division

20
Q

Comment créer une exception lors d’un division par 0

A

try:
Print 0/0
except ZeroDivisionError:
print “cannot divide by 0”

21
Q

Comment unpack une liste [1,2]

A

X,y=[1,2]

22
Q

Swap variables

A

X,y =y,x

23
Q

How to print work directory ?

A

import os
os.getcwd()
OR
pwd dans le shell

24
Q

How to set work directory to path

A

import os

os.chdir(path)

25
Q

How to run a script automatically every minute?

A

import time
while True:
script += 1
time.sleep(60)

26
Q

How to connect bing API and convert to Json

A
response = urllib2.urlopen(urlbing).read()
data = json.loads(response.decode('utf8'))
27
Q

How to plot two curves on two different axis?

A

fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.plot(dfel.sort().index.to_datetime(),dfel.sort())
ax1.set_ylabel(‘Consommation electrique France (MW)’)

ax2 = ax1.twinx()
ax2.plot(dfth.sort().index.to_datetime(),dfth.sort(), color=’r’)
ax2.set_ylabel(‘Indice de congestion Paris’, color=’r’)
for tl in ax2.get_yticklabels():
tl.set_color(‘r’)

plot.show()

28
Q

read zip file

A

import zipfile
file_to_read = zipfile.ZipFile(‘exemple.zip’)
file_to_read.namelist() #displays content of zip
file_to_read.read(‘file1.txt’)

29
Q

find and return a string of digits in a string

A

import re

numbers = re.search(‘\d+’ , string_to_read).group(1)