The following code to generate a quick plot of some data works fine when I run it in the cell within my notebook:
def xyz_plot(df=df, sensor='acc', position='t', activity='walking_treadmill_flat',
person=np.random.randint(1,9)):
sensors = [f'{position}_{i}{sensor}' for i in ['x','y','z']]
subset = df.query(f"person=='{person}' & activity=='{activity}'")
for j in sensors:
sns.lineplot(subset.seconds[100:200], subset[f'{j}'][100:200], label=f'{j}', legend='full').set(xlabel='', ylabel='Seconds', title=f'Person:{person}')
However, when I save it in my_functions.py
file which I have imported as follows it no longer works and cannot find my data frame. How can I fix this?
from my_functions import xyz_plot