accept order conditionally

This commit is contained in:
2023-03-14 17:51:17 +08:00
parent 45a406961a
commit a8d50e1f81
8 changed files with 56 additions and 14 deletions

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 14,
"metadata": {},
"outputs": [
{
@@ -20,17 +20,50 @@
"17\n",
"81\n"
]
},
{
"data": {
"text/plain": [
"array([2, 2])"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import numpy as np\n",
"\n",
"np.random.randint(0.5, 3.5)\n",
"p_remove = 1\n",
"p_remove = 0.9\n",
"np.random.choice([True, False], p=[p_remove, 1-p_remove])\n",
"rng = np.random.default_rng(0)\n",
"for _ in range(10):\n",
" print(rng.integers(0,100))"
" print(rng.integers(0,100))\n",
"np.random.choice([1, 2, 3], 2, p=[0.4, 0.4, 0.2])\n"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"2"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"share = 0.8\n",
"list_succ_firms = [1, 1]\n",
"round(share * len(list_succ_firms)) if round(share * len(list_succ_firms)) > 0 else 1"
]
},
{