How to copy multiple input cells in Jupyter Notebook

前端 未结 5 1456
别跟我提以往
别跟我提以往 2021-02-05 05:12

Basically I want to copy (Ctrl+C) only the code portions from multiple cells without also copying the output or the In[1]: and Out[1]:

What is

5条回答
  •  执笔经年
    2021-02-05 05:51

    Just do: File > Export Notebook As > Export Notebook to Asciidoc and it will be easy to copy paste. This is what an Asciidoc file looks like:

    +*In[ ]:*+
    [source, ipython3]
    ----
    import pandas as pd
    
    df = pd.read_csv("data/survey_results_public.csv")
    
    df.tail(10)
    
    df.shape
    
    pd.set_option("display.max_columns", 85)
    pd.set_option("display.max_rows", 85)
    
    schema_df = pd.read_csv("data/survey_results_schema.csv")
    
    schema_df.head(10)
    
    
    ----
    

提交回复
热议问题