import numpy as np
def trunc(values, decs=0):
stepper = 10.0 ** decs
return np.trunc(values * stepper) / stepper
a = np.random.sample((10, 5))
print(a)
a = trunc(a, 2)
print(a)
[[0.80774294 0.49759797 0.12831778 0.0507127 0.93884821]
[0.40449397 0.66256411 0.68941394 0.9249191 0.24395077]
[0.04315995 0.18290855 0.5908672 0.2102119 0.81539927]
[0.35844866 0.5186572 0.29508712 0.57636076 0.64102832]
[0.94639274 0.09793527 0.73766807 0.80979653 0.84808608]
[0.46454466 0.58734548 0.63087822 0.10865253 0.82981857]
[0.8473419 0.23920123 0.3373125 0.4772781 0.35829208]
[0.03148842 0.70653864 0.85633527 0.72635685 0.47321859]
[0.76828975 0.08494009 0.45071368 0.79358861 0.6005338 ]
[0.3820037 0.02684243 0.1404288 0.04466791 0.32699522]]
[[0.8 0.49 0.12 0.05 0.93]
[0.4 0.66 0.68 0.92 0.24]
[0.04 0.18 0.59 0.21 0.81]
[0.35 0.51 0.29 0.57 0.64]
[0.94 0.09 0.73 0.8 0.84]
[0.46 0.58 0.63 0.1 0.82]
[0.84 0.23 0.33 0.47 0.35]
[0.03 0.7 0.85 0.72 0.47]
[0.76 0.08 0.45 0.79 0.6 ]
[0.38 0.02 0.14 0.04 0.32]]
usecols: int, str, list-like, or callable default None
If None, then parse all columns.
If str, then indicates comma separated list of Excel column letters and column ranges (e.g. “A:E” or “A,C,E:F”). Ranges are inclusive of both sides.
If list of int, then indicates list of column numbers to be parsed.
If list of string, then indicates list of column names to be parsed.
New in version 0.24.0.
If callable, then evaluate each column name against it and parse the column if the callable returns True.
Returns a subset of the columns according to behavior above.
data_designation = ["Дата заключения", "Валюта", "Код финансового инструмента", "Операция", "Количество", "Цена", "Объём сделки"]
securities_transactions = pandas.read_excel(file_location, usecols = data_designation)
securities_transactions = securities_transactions[data_designation]
securities_transactions = securities_transactions.values.tolist()
bue.remove(bue[0])
security_papers = {
"акция": "1",
"пай": "2",
"офз": "3",
"корпоративная облигация": "4"
}
user_input = str(input("Введите тип инструмента (Акция, ПАЙ, ОФЗ, Корпоративная облигация)"))
if user_input.lower() in security_papers:
print(security_papers[user_input])
else:
print('incorrect input')