填滿它,我有這樣的熊貓數據框:添加到大熊貓的數據幀列與NA
SourceDomain 1 2 3
0 www.theguardian.com profile.theguardian.com 1 Directed
1 www.theguardian.com membership.theguardian.com 2 Directed
2 www.theguardian.com subscribe.theguardian.com 3 Directed
3 www.theguardian.com www.google.co.uk 4 Directed
4 www.theguardian.com jobs.theguardian.com 5 Directed
我想補充一個新的列是這樣創造了一個熊貓系列:
Weights = Weights.value_counts()
然而,當我嘗試添加使用edgesFile[4] = Weights
新列其與NA而非實際的值來填充它:
SourceDomain 1 2 3 4
0 www.theguardian.com profile.theguardian.com 1 Directed NaN
1 www.theguardian.com membership.theguardian.com 2 Directed NaN
2 www.theguardian.com subscribe.theguardian.com 3 Directed NaN
3 www.theguardian.com www.google.co.uk 4 Directed NaN
4 www.theguardian.com jobs.theguardian.com 5 Directed NaN
如何添加保留值的新列? 謝謝?
達尼
謝謝!它正在工作,我剛剛學到了一件非常有趣的事情。我會盡快接受答案。 –