pandas_openscm.db.in_memory#
In-memory backend
Not very useful in practice, but helpful for testing
Classes:
| Name | Description |
|---|---|
InMemoryDataBackend |
In-memory data backend |
InMemoryIndexBackend |
In-memory index backend |
InMemoryDataBackend #
In-memory data backend
Methods:
| Name | Description |
|---|---|
load_data |
Load a data file |
save_data |
Save data to disk |
Attributes:
| Name | Type | Description |
|---|---|---|
data |
dict[str, DataFrame] | None
|
Data store |
ext |
str
|
Extension to use with files saved by this backend. |
preserves_index |
Literal[True]
|
Whether this backend preserves the index of data upon (de-)serialisation |
Source code in src/pandas_openscm/db/in_memory.py
ext
class-attribute
instance-attribute
#
ext: str = '.in-mem'
Extension to use with files saved by this backend.
preserves_index
property
#
preserves_index: Literal[True]
Whether this backend preserves the index of data upon (de-)serialisation
load_data #
save_data #
Save data to disk
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
DataFrame
|
Data to save |
required |
data_file
|
Path
|
File in which to save the data |
required |
Source code in src/pandas_openscm/db/in_memory.py
InMemoryIndexBackend #
In-memory index backend
Methods:
| Name | Description |
|---|---|
load_file_map |
Load the file map |
load_index |
Load the index |
save_file_map |
Save the file map to disk |
save_index |
Save the index to disk |
Attributes:
| Name | Type | Description |
|---|---|---|
ext |
str
|
Extension to use with files saved by this backend. |
file_map |
Series[Path] | None
|
File map store |
index |
DataFrame | None
|
Index store |
preserves_index |
Literal[True]
|
Whether this backend preserves the |
Source code in src/pandas_openscm/db/in_memory.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
ext
class-attribute
instance-attribute
#
ext: str = '.in-mem'
Extension to use with files saved by this backend.
preserves_index
property
#
preserves_index: Literal[True]
Whether this backend preserves the pd.MultiIndex upon (de-)serialisation
load_file_map #
load_index #
save_file_map #
Save the file map to disk
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_map
|
Series[Path]
|
File map to save |
required |
file_map_file
|
Path
|
File in which to save the file map |
required |
Source code in src/pandas_openscm/db/in_memory.py
save_index #
Save the index to disk
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
index
|
DataFrame
|
Index to save |
required |
index_file
|
Path
|
File in which to save the index |
required |