Float无法转成Decimal类型,这个在一些数据很大,需要做图的地方可能会成为问题。Float没有找到提取指数的地方
可以用下面方法设定符号为整数:
| plot.ggbland <- function(df, alpha = 0.05) { | |
| z_score = qnorm(1 - alpha/2) | |
| temp_df <- df %>% | |
| mutate(diff = `mEDV` - `sEDV`) %>% | |
| mutate(avg = (`mEDV`+ `sEDV`)/ 2) | |
| mean_diff <- mean(temp_df$diff) | |
| lower <- mean_diff - z_score * sd(temp_df$diff) | |
| upper <- mean_diff + z_score * sd(temp_df$diff) | |
| ggplot(temp_df, aes(x = avg, y = diff)) + | |
| geom_point(size=2) + |
| """ | |
| ### 例子 | |
| 正常男性尿检中位数$M_0$为$0.33\mu mol/L$,抽取工厂血铅含量如下,求是否符合正常。 | |
| """ | |
| import statsmodels.stats as sts | |
| M_0 = 0.33 | |
| M = [0.29, 0.31, 0.34, 0.37, 0.38, 0.41, 0.47, 0.52, 0.69, 0.72, 0.73, 0.77, 0.78, 0.80, 0.83, 0.92, 0.95, 0.97] | |
| sts.descriptivestats.sign_test(M, M_0) # (7.0, 0.001312255859375) 有显著差异 |
| import numpy as np | |
| import scipy.stats as st | |
| from statsmodels import api | |
| ALPHA = 0.05 | |
| x = [1.29, 1.30, 1.32, 1.33, 1.34, 1.37, 1.40, 1.43, 1.45, 1.49, 1.53, 1.58, 1.63] | |
| t_x = (np.mean(x) - 1.48) / (np.std(x) / np.sqrt(len(x))) | |
| standard_t = st.t.ppf(1 - ALPHA/2, len(x) - 1) |
| /* | |
| 如学生去图书馆,他一天内什么时候都可以去,另一个人也是,求他俩同时在图书馆的时间段 | |
| */ | |
| def libraryInterTime(a: List[(Int, Int)], b: List[(Int, Int)]): List[(Int, Int)] = { | |
| def helper(a: List[Tuple2[Int, Int]], b: List[Tuple2[Int, Int]], res: List[(Int, Int)]): List[(Int, Int)] = { | |
| if (a.length == 0 ||b.length == 0) {return res} // 如果有一个为空就停止计算 | |
| else { | |
| val (setA, setB) = (a.head, b.head) | |
| if (setA._2 <= setB._1) { | |
| return helper(a.tail, b, res) // 如果setA整个在setB前面 |
| { | |
| // Place your snippets for markdown here. Each snippet is defined under a snippet name and has a prefix, body and | |
| // description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are: | |
| // $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the | |
| // same ids are connected. | |
| // Example: | |
| // "Print to console": { | |
| // "prefix": "log", | |
| // "body": [ | |
| // "console.log('$1');", |
streamlit无法直接使用image的地址来读取,要使用PIL读取数据后展示:
from PIL import Image
fire_dir = "/dir/to/image"
image = Image.open(fire_dir)
st.image(image)| from typing import List | |
| from math import log10, ceil | |
| def split_int(a: int) -> List[int]: | |
| retrurn [a // 10 ** i % 10 for i in range(ceil(log10(a))-1, -1, -1)] |
from typing import NoReturn
import torch.nn as nn
import torch
import plotly.express as px
import pandas as pd
class View(nn.Module):
def __init__(self, *shape):
super().__init__()