1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import shelve
# Example 1 - store
patients_df = {
"age" : [25.2, 35.4, 52.1],
"height" : [68.1, 62.5, 60.5],
"weight" : [170.2, 160.7, 185.5]
}
records = shelve.open('patients')
records['patients'] = patients_df
records.close()
# Example 2 - load and manipulate
records = shelve.open('patients')
patients_reconstructed = records['patients']
del records['patients'] # delete value from disk
records.close()
Enter to Rename, Shift+Enter to Preview