當前位置: 首頁>>代碼示例>>Python>>正文


Python DataFrame.pop方法代碼示例

本文整理匯總了Python中pandas.core.frame.DataFrame.pop方法的典型用法代碼示例。如果您正苦於以下問題:Python DataFrame.pop方法的具體用法?Python DataFrame.pop怎麽用?Python DataFrame.pop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pandas.core.frame.DataFrame的用法示例。


在下文中一共展示了DataFrame.pop方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: DataFrame

# 需要導入模塊: from pandas.core.frame import DataFrame [as 別名]
# 或者: from pandas.core.frame.DataFrame import pop [as 別名]
timestamps = bsedateutil.getBSEdays(startday,endday,timeofday)
dataobj = da.DataAccess('Investor')
symbols = np.array(['SOFIX', '0ALA', '0S8'])
marketsymbolpos = 0
close = dataobj.get_data(timestamps, dataobj.get_all_symbols(), "close",verbose=True)

#calculate NaNs
sharperatios = DataFrame(index = ['sr', 'NaNs'], columns = close.columns, dtype = float)
for sym in close.columns:
    nans = 0
    for price in close[sym]:
        if math.isnan(price):
            nans += 1
    if nans > len(timestamps) / 5:
        close.pop(sym)
        sharperatios.pop(sym)
    else:
        sharperatios[sym]['NaNs'] = nans
        sharperatios[sym]['sr'] = 0
        
sharperatios = sharperatios.T
#
# Plot the adjusted close data
#
plt.clf()
newtimestamps = close.index
pricedat = close.values # pull the 2D ndarray out of the pandas object

#normalize nans
for sym in close.columns:
    sharperatios['NaNs'][sym] = sharperatios['NaNs'][sym] / len(timestamps)
開發者ID:dimitarm,項目名稱:bse,代碼行數:33,代碼來源:BSE-analysis.py

示例2: DataFrame

# 需要導入模塊: from pandas.core.frame import DataFrame [as 別名]
# 或者: from pandas.core.frame.DataFrame import pop [as 別名]
xDataFrame = DataFrame(xVariables_cursor[0]["content"][1:]).convert_objects(convert_numeric = True)

yMongoColumn = list(argsDecoded['Y_Variable'].keys())[0]
y = yMongoColumn[yMongoColumn.find('.') + 1:]

xMongoColumn = list(argsDecoded['X_Variables'].keys())
x = ''

for item in xMongoColumn:
    x = x + item[item.find('.') + 1:] + ' + '

x = x[0:-3]
modelString = y + ' ~ ' + x

if (yMongoColumn in xMongoColumn):
    xDataFrame.pop(y)

modelDataFrame = concat([yDataFrame, xDataFrame], axis = 1)

results = smf.ols(modelString, data = modelDataFrame).fit()
results.summary()

params = {}

for key, value in json.loads(results.params.to_json()).items():
    params[key] = {}
    params[key]['Variable_Name'] = key
    params[key]['Coefficient'] = json.loads(results.params.to_json())[key]
    params[key]['Standard_Error'] = json.loads(results.bse.to_json())[key]
    params[key]['T_Value'] = json.loads(results.tvalues.to_json())[key]
    params[key]['P_Value'] = json.loads(results.pvalues.to_json())[key]
開發者ID:lee19840806,項目名稱:Online-Stats,代碼行數:33,代碼來源:ols_regression.py


注:本文中的pandas.core.frame.DataFrame.pop方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。