Skip to main content

The memory connector allows saving dataframes and variables in memory for communication between successive wrangles and recipes. All contents of the memory connector are lost once the python script finishes executing.

Tabset

Read​

Recipe​

read:
- memory:
id: '1234'

Function​

from wrangles.connectors import memory
df = memory.read(id='1234')

Parameters​

ParameterRequiredData TypeNotes
idstrA unique ID to identify the data. If not specified, will read the last dataframe saved in memory
orientstrSet the arrangement of the data. See pandas.DataFrame.to_dict method for options. Defaults to tight.
order_bystrUses SQL syntax to sort the input.
ifstrA condition that will determine whether the action runs or not as a whole.

Write​

Recipe​

write:
- memory:
id: '1234'

Function​

from wrangles.connectors import memory
import pandas as pd

df = pd.read_csv('example.csv')
memory.write(df=df, id='1234')

Parameters​

ParameterRequiredData TypeNotes
df✓pandas dataframeDataframe to be exported
idstrA unique ID to identify the data. If not specified, will read the last dataframe saved in memory
orientstrSet the arrangement of the data. See pandas.DataFrame.to_dict method for options. Defaults to tight.
order_bystrUses SQL syntax to sort the output.
ifstrA condition that will determine whether the action runs or not as a whole.

Clear​

Clear and reset any existing data stored in the connector.

Function​

from wrangles.connectors import memory
import pandas as pd

df = pd.read_csv('example.csv')
memory.write(df=df, id='1234')
memory.clear()