df filter is not filtering

39 Views Asked by At

Im trying to use:

df_pca_filt = df_pca[df_pca['cdf'].astype(float) > 0.975]

But it doesn't work. I ran the program once and everything was fine. But then I ran it again, everything was exactly the same and it stopped filtering

I tried:

df_pca_filt = df_pca[df_pca['cdf'] > 0.975]



df_pca_filt = df_pca[df_pca['cdf'].values > 0.975]

But it gives me all the values for df_pca['cdf'] from 0 to 1. Idk what happend

I also tried using conda upgrade pandas in the prompt.

The data type for cdf is float64

This is my real data for df['cdf'] (I know I have to remove some decimals to make it more optimal, but it doesn't matter, the code should work anyway):

           cdf
0   12.842872998255906
1   22.467100047566195
2   29.451403202790548
3   36.16616457903916
4   41.98509592516252
5   47.05882352941176
6   52.04534644046298
7   56.98430315522436
8   60.496273981290635
9   63.78626922467101
10  66.996987474235
11  70.19185032503569
12  73.28365308387508
13  75.89979387981609
14  78.46836847946727
15  80.91009988901222
16  82.82860313936897
17  84.57269700332965
18  86.1106706833677
19  87.45837957824641
20  88.52861899476774
21  89.5037260187094
22  90.43126684636121
23  91.3508799746314
24  92.24671000475665
25  92.95227524972256
26  93.65784049468847
27  94.30791184398291
28  94.95798319327734
29  95.48121135246555
30  96.00443951165374
31  96.43253527826228
32  96.82892024734426
33  97.13810052322819
34  97.39178690344065
35  97.63754558427146
36  97.87537656572066
37  98.11320754716984
38  98.34311082923738
39  98.57301411130493
40  98.77120659584591
41  98.93768828286034
42  99.10416996987476
43  99.24686855874427
44  99.38956714761377
45  99.52433803710164
46  99.61947042968133
47  99.69874742349771
48  99.77009671793246
49  99.83351831298557
50  99.88901220865706
51  99.92072300618362
52  99.95243380371018
53  99.96828920247346
54  99.9762169018551
55  99.98414460123674
56  99.99207230061837
57  100.00000000000003
0

There are 0 best solutions below