QuantXでNaNをカウント

#通常のデバッグ
たまに小型株とか買うと

<img width="1363" alt="スクリーンショット 2019-04-30 13.53.53.png" src="https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/318447/8dd0af92-9aa6-36c7-f9bc-615df313dc80.png">

このように銘柄のデータがないよと怒られます。

よくあるデバッグの方法として
https://qiita.com/investor-gon/items/64acc909257fa3448e27

```
ctx.loggger.debug(cp)
```
と株価の終値をdebugするのが一般的ですが、、

#問題が

QuantXのcpですがこのようにDataFrameの形でdebugされます。
しかし、銘柄が多かったり期間が長かったりするとログが省略されます。

```
jp.stock.2914  jp.stock.3092      ...        jp.stock.5302  \
date                                          ...                        
2014-01-06         3425.0     848.666687      ...               2000.0   
2014-01-07         3375.0     816.666687      ...               2010.0   
2014-01-08         3290.0     814.000000      ...               2030.0   
2014-01-09         3180.0     833.666687      ...               2010.0   
2014-01-10         3195.0     844.000000      ...               2000.0   
2014-01-14         3172.0     813.666687      ...               1970.0   
2014-01-15         3221.0     833.333313      ...               2010.0   
2014-01-16         3220.0     822.333313      ...               2020.0   
2014-01-17         3186.0     845.666687      ...               2090.0   
2014-01-20         3200.0     813.666687      ...               2110.0   
2014-01-21         3231.0     827.666687      ...               2080.0   
2014-01-22         3235.0     831.333313      ...               2060.0   
2014-01-23         3227.0     840.000000      ...               2020.0   
2014-01-24         3173.0     796.000000      ...               1990.0   
2014-01-27         3128.0     756.666687      ...               1910.0   
2014-01-28         3068.0     763.333313      ...               1900.0   
2014-01-29         3129.0     787.000000      ...               1950.0   
2014-01-30         3026.0     752.333313      ...               1900.0   
2014-01-31         3197.0     763.333313      ...               1890.0   
2014-02-03         3135.0     764.333313      ...               1820.0   
2014-02-04         3070.0     730.000000      ...               1700.0   
2014-02-05         3138.0     749.666687      ...               1730.0   
2014-02-06         3107.0     719.000000      ...               1760.0   
2014-02-07         3186.0     731.000000      ...               1820.0   
2014-02-10         3285.0     773.000000      ...               1810.0   
2014-02-12         3347.0     750.000000      ...               1920.0   
2014-02-13         3319.0     726.333313      ...               1890.0   
2014-02-14         3280.0     701.666687      ...               1840.0   
2014-02-17         3291.0     717.666687      ...               1850.0   
2014-02-18         3357.0     736.333313      ...               1910.0   
...                   ...            ...      ...                  ...   
2017-02-17         3768.0    2452.000000      ...               2980.0   
2017-02-20         3774.0    2487.000000      ...               2990.0   
2017-02-21         3778.0    2487.000000      ...               2980.0   
2017-02-22         3798.0    2456.000000      ...               3000.0   
2017-02-23         3811.0    2384.000000      ...               2960.0   
2017-02-24         3805.0    2367.000000      ...               2910.0   
2017-02-27         3778.0    2346.000000      ...               2900.0   
2017-02-28         3757.0    2348.000000      ...               2890.0   
2017-03-01         3800.0    2418.000000      ...               2910.0   
2017-03-02         3776.0    2421.000000      ...               2930.0   
2017-03-03         3781.0    2409.000000      ...               2920.0   
2017-03-06         3782.0    2402.000000      ...               2970.0   
2017-03-07         3780.0    2378.000000      ...               2970.0   
2017-03-08         3766.0    2361.000000      ...               2960.0   
2017-03-09         3755.0    2361.000000      ...               3000.0   
2017-03-10         3804.0    2406.000000      ...               3000.0   
2017-03-13         3845.0    2407.000000      ...               3000.0   
2017-03-14         3840.0    2435.000000      ...               2990.0   
2017-03-15         3831.0    2436.000000      ...               2940.0   
2017-03-16         3783.0    2385.000000      ...               3200.0   
2017-03-17         3772.0    2373.000000      ...               3220.0   
2017-03-21         3856.0    2330.000000      ...               3170.0   
2017-03-22         3752.0    2293.000000      ...               3070.0   
2017-03-23         3753.0    2284.000000      ...               3080.0   
2017-03-24         3786.0    2302.000000      ...               3220.0   
2017-03-27         3725.0    2321.000000      ...               3180.0   
2017-03-28         3726.0    2382.000000      ...               3200.0   
2017-03-29         3701.0    2422.000000      ...               3360.0   
2017-03-30         3654.0    2441.000000      ...               3310.0   
2017-03-31         3618.0    2463.000000      ...               3340.0   

```

**そもそも長い**

#解決法
NaNをカウントすればいいのでは？

```
NaN_count = cp.isnull().sum()
ctx.logger.debug(NaN_count)
```

#結果

```
jp.stock.2121      0
jp.stock.2124      0
jp.stock.2337      0
jp.stock.2352      0
jp.stock.2371      0
jp.stock.2379      0
jp.stock.2391      0
jp.stock.2477      0
jp.stock.2914      0
jp.stock.3092      0
jp.stock.3543    608
jp.stock.3647      0
jp.stock.3665      0
jp.stock.3679      0
jp.stock.3712      0
jp.stock.3723      0
jp.stock.3750      0
jp.stock.3763      0
jp.stock.3772      0
jp.stock.3835      0
jp.stock.3848      0
jp.stock.3901    234
jp.stock.3922    548
jp.stock.3963    670
jp.stock.3969    727
jp.stock.3979    783
jp.stock.3997    794
jp.stock.4327      0
jp.stock.4368      0
jp.stock.4369      0
jp.stock.4507      0
jp.stock.4521      0
jp.stock.4704      0
jp.stock.4732      0
jp.stock.4792      0
jp.stock.4820      0
jp.stock.4849      0
jp.stock.4975      0
jp.stock.5194      0
jp.stock.5301      0
jp.stock.5302      0
jp.stock.6048    324
jp.stock.6080      0
jp.stock.6146      0
jp.stock.6157      0
jp.stock.6161      0
jp.stock.6196    603
jp.stock.6538    721
jp.stock.6539    722
jp.stock.6552    794
```

このようにNaNがあるものは数字が帰ってきます。