删除对象为NaN的行

时间:2018-07-12 07:41:15

标签: python pandas object nan del

这是我数据框的fin.Factory列,我的目标是仅具有实际观察值,消除空白行

0         chittagong asian apparels ltd
1           divine textile ltd (unit 2)
2                        elite garments
3                      fashion asia ltd
4                  fortune apparels ltd
5                glory fashion wear ltd
6                      hams fashion ltd
7                         hams garments
8             hams washing & dyeing ltd
9                   kattali textile ltd
10                  fashion (miles + 1)
11               kwun tong apparels ltd
12                   lenny apparels ltd
13                   lenny fashions ltd
14            meghna knit composite ltd
15                    miles fabrics ltd
16             mohar asian apparels ltd
17                        multifabs ltd
18         northern corporation limited
19                     northern garment
20                  orchid garments ltd
21              printers & printers ltd
22                rabab fashion ind ltd
23                   sepal garments ltd
24              sepal washing plant ltd
25               shams style - standard
26                shams style - sitches
27                       stylecraft ltd
28                           tm garment
29                          tm textiles
30               tosrifa industries ltd
31                           univogue 1
32                           univogue 4
33    univogue garments co ltd (unit 2)
34    univogue garments co ltd (unit 3)
35                    world ye apparels
36                     akh fashions ltd
37                 akh eco apparels ltd
38             akh knitting & dying ltd
39               energypac fashions ltd
40        clifton textiles and apparels
41                   alpha clothing ltd
42     bangladesh spinners and knitters
43                         bando design
44            liberty knitwear ltd  (1)
45                 midland knitwear ltd
46                      micro fibre ltd
47                      a-one polar ltd
48            liberty knitwear ltd  (2)
49                             geebee 1
50                             geebee 2
51                          continental
52                       tcel (3 units)
53               transworld sweater ltd
54                         youngones ii
55                       cordial design
57                                  NaN
58                                  NaN

我拼命试图摆脱带有nan值的行,但我不明白为什么下面的代码现在可以正常工作

fin = fin[fin.Factory != np.NaN]

0 个答案:

没有答案