###this is question ###By using a list comprehension (or any other technique other than looping), I want to create a list list_ex that contains those slices of dfx in which the consecutive exercise is the same as the current exercise. As soon as the consecutive exercise is not the same as the one in the current row, the next dataframe slice begins. With respect to the example, that means that list_ex should contain 5 dataframes:
var mdMongo = new MetadataMongo();
var listWrites = new List<WriteModel<MetadataMongo>>();
foreach(var val in data){
mdMongo.ID = val.ID;
mdMongo.Type = val.TableTypes.Media;
mdMongo.TemplateType = val.TemplateType;
mdMongo.Output = val.Output;
mdMongo.IsMasterPage = val.IsMasterPage;
mdMongo.StartDate = val.StartDate;
mdMongo.EndDate = val.EndDate;
mdMongo.UpdatedOn = val.UpdatedOn;
mdMongo.CompanyID = val.CompanyID;
mdMongo.CreatedBy = val.CreatedBy;
mdMongo.Rating = val.Rating;
var filters = Builders<MetadataMongo>.Filter.Eq("Id", mdMongo.Id);
var update = updateDefination.Add(Builders<MetadataMongo>.Update.Set(mdMongo);
var updateRecords = new UpdateOneModel<MetadataMongo>(filters, update) { IsUpsert = false };
listWrites.Add(updateRecords );
}
await userCollection.BulkWriteAsync(listWrites);