0

When I use the diff function in my snippet:

for customer_id, cus in tqdm(df.groupby(['customer_ID'])):
        # Get differences
        diff_df1 = cus[num_features].diff(1, axis = 0).iloc[[-1]].values.astype(np.float32)

I get:

NotImplementedError

The exact same code did run without any error before (on Colab), whereas now I'm using an Azure DSVM via JupyterHub and I get this error.

I already found this pandas pd.DataFrame.diff(axis=1) NotImplementationError but the solution doesnt work for me as I dont have any Date types. Also I did upgrade pandas but it didnt change anything.

EDIT:
I have found that the error occurs when the datatype is 'int16' or 'int8'. Converting the dtypes to 'int64' solves it. However I leave the question open in case someone can explain it or show a solution that works with int8/int16.

paka
  • 55
  • 7

0 Answers0