这是我的职能
def price_to_ephe(data):
converted = []
for i in data:
while i >= 360:
i = i - 360
converted.append (i)
return converted
这使得每个数字都小于360.我想将其应用于DataFrame中的列.
2009-01-01, 886.0
2009-01-02, 884.2
2009-01-03, 882.1
2009-01-04, 882.6
2009-01-05, 883.4
2009-01-06, 889.1
2009-01-07, 887.6
2009-01-08, 882.5
2009-01-09, 879.7
2009-01-10, 878.3
2009-01-11, 876.6
2009-01-12, 875.2
预期输出:
2009-01-01, 166.0
2009-01-02, 164.2
..............
...以此类推数字可以很大也可以很小:10000和20.
请帮我以最有效的方式做这件事.DataFrame非常大.我需要所有速度的Pandas !