![](/img/trans.png)
[英]PyCharm - how do I debug (like in Jupyter Notebook) without having to re-run the full script every-time that I modify code?
[英]How do I modify and run a chunk of code from my .py file without having to read the whole .xlsx file every time?
import pandas as pd
import matplotlib.pyplot as plt
# Read the data
filepath = "data.xlsx"
data = pd.read_excel(filepath, index_col = 0)
print(data)
問題:data.xlsx 中有超過一百萬行。 假設我在這下面有一些代碼,我希望重復修改並再次運行我的 python 文件,我該如何在不等待我的計算機一遍又一遍地讀取所有 100 萬行數據的情況下這樣做?
最簡單的解決方案可能是使用基於單元的 IDE。 Jupyter Notebook是一款非常流行的基於單元的 IDE,可在您的瀏覽器中運行,並附帶Anaconda (一種流行的科學 python 分布)。
在這種情況下,您在每個單元格中獨立運行代碼,因此您只運行一次加載代碼,並且可以有許多其他單元格的代碼與您的data
變量一起使用,而無需每次都重新加載它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.