From 2602518fed1cad1b446d8c9a7ab7ba7d14cae320 Mon Sep 17 00:00:00 2001 From: guanjihuan Date: Mon, 29 Jan 2024 21:15:33 +0800 Subject: [PATCH] 0.1.82 --- PyPI/setup.cfg | 2 +- PyPI/src/guan.egg-info/PKG-INFO | 2 +- PyPI/src/guan/others.py | 15 +++++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index 5c4e340..f517163 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.1.81 +version = 0.1.82 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan.egg-info/PKG-INFO b/PyPI/src/guan.egg-info/PKG-INFO index f0d697c..e8b2088 100644 --- a/PyPI/src/guan.egg-info/PKG-INFO +++ b/PyPI/src/guan.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: guan -Version: 0.1.81 +Version: 0.1.82 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/PyPI/src/guan/others.py b/PyPI/src/guan/others.py index ba74ddd..c18d916 100644 --- a/PyPI/src/guan/others.py +++ b/PyPI/src/guan/others.py @@ -318,15 +318,22 @@ def sorted_market_capitalization(num=10): import numpy as np import guan title, stock_data = guan.all_stocks() - list_index = np.argsort(stock_data[:, 17]) + new_stock_data = [] + for stock in stock_data: + if np.isnan(float(stock[9])): + continue + else: + new_stock_data.append(stock) + new_stock_data = np.array(new_stock_data) + list_index = np.argsort(new_stock_data[:, 17]) list_index = list_index[::-1] if num == None: num = len(list_index) sorted_array = [] for i0 in range(num): - stock_symbol = stock_data[list_index[i0], 1] - stock_name = stock_data[list_index[i0], 2] - market_capitalization = stock_data[list_index[i0], 17]/1e8 + stock_symbol = new_stock_data[list_index[i0], 1] + stock_name = new_stock_data[list_index[i0], 2] + market_capitalization = new_stock_data[list_index[i0], 17]/1e8 sorted_array.append([i0+1, stock_symbol, stock_name, market_capitalization]) return sorted_array