You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It might also be that this doesn't work entirely yet because of the annotate() call.
Also adding a more complex example
importpandasaspdfromdjango.db.modelsimportF, Subquery, OuterRef# First, create a subquery to get only .fcs artifactsfcs_artifacts= (
Biosample.artifacts.through.objects
.filter(artifact__key__endswith='.fcs')
.filter(biosample=OuterRef('pk'))
.values('artifact__key')
)
# Now use this subquery in the main queryqueryset= (
wl.Biosample.filter(
created_at__gt="2024-12-01"
).annotate(
artifacts__key=Subquery(fcs_artifacts[:1])
).filter(artifacts__key__isnull=False)
)
# Convert to DataFrame with all fieldsdf=pd.DataFrame.from_records(
queryset.values()
)
The text was updated successfully, but these errors were encountered:
Given how common this is, it'd be nice to create a few biosamples in the toy data. Or maybe do it with ULabels. 🤔
Something along these lines:
It might also be that this doesn't work entirely yet because of the
annotate()
call.Also adding a more complex example
The text was updated successfully, but these errors were encountered: