import pandas as pdDF = pd.DataFrame(DICTIONARY, index = [r"$\lambda$="+str(i) for i in range(3)], columns = [r"$\xi$="+str(j) for j in range(3)])有幾次,當(dāng)我有一本字典(不是很大)并嘗試將其轉(zhuǎn)換為數(shù)據(jù)幀時(shí),上面的代碼會(huì)生成一個(gè)每個(gè)單元格為NaN. 但下面的代碼運(yùn)行良好。我想知道有什么區(qū)別?DF = pd.DataFrame(DICTIONARY, index = [r"$\lambda$="+str(i) for i in range(3)])DF.columns = [r"$\xi$="+str(j) for j in range(3)]
為什么使用 pandas 創(chuàng)建數(shù)據(jù)框時(shí)無法定義列名稱?
慕的地6264312
2023-10-06 19:29:29