本文整理匯總了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)
示例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]