我正在清理一个域名列表。你知道吗
我想删除某些“符合”条件的行。我已经成功地确定了第一个标准,第二个将很容易做到。你知道吗
但是,我不能删除行。我试过几种解决办法,但我最好的办法是如下。你知道吗
from wordsegment import segment
import pandas as pd
def assignname():
dfr = pd.read_csv('data.net.date.csv')
for domainwtld in dfr.domain:
dprice = dfr.price
domainwotld = domainwtld.replace(".net", "")
seperate = wordsegment.segment(domainwotld)
dlnt = (min(seperate, key=len))
slnt = len(dlnt)
if slnt <= 1:
baddomains = domainwtld
a = dfr.loc[dfr['domain'] < (baddomains)]
print (a)
当我运行这段代码时,我收到一个输出,在删除“baddomains”中的第一个项目之后,它将在“dfr”中打印整个项目。直到循环完成。你知道吗
如何根据域过滤“原始”csv文件?你知道吗
相关问题 更多 >
编程相关推荐