|
import numpy as np
import pandas as pd
from pandas import DataFrame,Series
ser=np.random.randn(200)
frame=DataFrame(ser.reshape(20,10))
new=frame.copy()
#计算行数
row=len(frame.index)
#计算列数
col=len((frame.T).index)
for i in xrange(0,col):
#找到第10大的数
temp=frame[i].order().values
num_ten=temp[10]
for j in xrange(0,row):
if frame[i][j]<num_ten:
new[i][j]=0.0 |
|