Thanks, looks promising!
Meanwhile, I also came up with this:
# dataframe for annotating the observations
obs = pd.DataFrame()
obs['sample'] = df.columns
var_names = df.index
# dataframe for annotating the variables
var = pd.DataFrame(index=var_names)
# the data matrix
X = df.T.values
adata = anndata.AnnData(X, obs=obs, var=var, dtype='int32')
output:
AnnData object with n_obs × n_vars = 10 × 24514 obs: 'sample'
Hope it's also OK