6-9. Favorite Places: Make a dictionary called favorite_places. Think of three
names to use as keys in the dictionary, and store one to three favorite places
for each person. To make this exercise a bit more interesting, ask some friends
to name a few of their favorite places. Loop through the dictionary, and print
each person’s name and their favorite places
In [13]: df = pd.DataFrame([{'a': 1, 'b': 2, 'c':3}, {'a':4, 'b':5, 'c':6}])
In [14]: df
Out[14]:
a b c
0 1 2 3
1 4 5 6
In [15]: df.set_index(['a','b'], inplace=True)
In [16]: df
Out[16]:
c
a b
1 2 3
4 5 6
In [35]: df.index.to_frame()[[]].reset_index()
Out[35]:
a b
0 1 2
1 4 5
A thread can be flagged as a “daemon thread”. The significance of this flag is that the entire Python program exits when only daemon threads are left. The initial value is inherited from the creating thread. The flag can be set through the daemon property or the daemon constructor argument.
This is a stand alone packaging of the hashlib library included with Python 2.5 so that it can be used on older versions of Python (tested on 2.3 and 2.4).