Я думаю, что jupytext
будет подходить к делу: кажется популярным и поддерживаемым. У меня все еще не получается, что он работает идеально, но у него больше обещаний.
pip3 install jupytext
jupytext --to notebook /git/prdnlp/python/readct.py
jupyter-notebook /git/prdnlp/python/readct.ipynb
Ячейка markdown
обозначается как
#%% [markdown]
Так что код теперь выглядит так:
#%%
import pandas as pd
from pandasql import sqldf
#%% [markdown]
"""
## Clinical Trials Postgres queries
We are using data from [ClinicalTrials.gov](https://clinicaltrials.gov/ct2/results?term=recurrent&cond=Glioblastoma+Multiforme&age_v=&gndr=&type=&rslt=With&Search=Apply)
- The data is synced to the AACT database daily
- The conditions and interventions are identified within specific tables
"""
#%%
ct = pd.read_csv('~/Downloads/SearchResults.tsv',delimiter='\t')
ctIdsDf = sqldf("select `NCT Number` nct_id, * from ct order by 1")
ctIds = ctIdsDf['nct_id']
#%%
Обратите внимание, что тройные кавычки все еще отображаются в выводе: поэтому мне неясно, как заставить их быть "вырезанными" с помощью jupytext
: