我有两张桌子
表1:列名Key
价值观:
C1
C2
C3
C4
表2 ,其中包含三列Product
,Category
,count
P1-C1-2
P1-C3-4
P2-C1-3
P2-C2-4,
P2-C3-8,
P3-C3-10,
P3-C4-2,
需要输出:
P1-C1-2
P1-C2-0
P1-C3-0
P1-C4-0
P2-C1-3
P2-C2-4,
P2-C3-8,
P2-C4-0,
P3-C1-0,
P3-C2-0,
P3-C3-10,
P3-C4-2
有什么办法吗?
先谢谢
答案 0 :(得分:1)
您正在寻找if output_dir is not None:
output_dir = Path(output_dir)
if not output_dir.exists():
output_dir.mkdir()
nlp.meta['name'] = new_model_name #rename model
nlp.to_disk(output_dir)
print("Saved model to", output_dir)
# test the saved model
print("Loading from", output_dir)
nlp2 = spacy.load(output_dir)
doc2 = nlp2(test_text)
for ent in doc2.ents:
print(ent.label_, ent.text)
cross join
答案 1 :(得分:0)
答案 2 :(得分:0)
SELECT t2.Product,t2.Category, case when t2.Category=t1.Category then t2.count ELSE 0 END AS count
FROM table1 t1,table2 t2;