Course Name: Unsupervised Learning in Trading, Section No: 20, Unit No: 5, Unit type: Notebook
How are the number of trades calculated within the clusters?
Course Name: Unsupervised Learning in Trading, Section No: 20, Unit No: 5, Unit type: Notebook
How are the number of trades calculated within the clusters?
clusters_trades = goog_train.groupby(['Cluster'])['fut_ret5_days'].count()
Here, we grouped the dataframe 'goog_train' by 'Cluster'. To find the length of the cluster (no. of trades within a cluster), we selected 'fut_ret5_days' column (can select any column) and calculated the number of elements in the column.