确保您已将所有必需的特权授予了您为管理数据库的创建的用户。
使用 psql 您可以使用以下命令进行:
GRANT ALL PRIVILEGES ON DATABASE mydb TO myuser;
此外,您应该为Postgres DB安装 psycopg2 与Django配对。
在终端执行以下执行:
pip install psycopg2
使用 data.table
的另一个选项:
library(data.table)
setDT(df)[,if(.N > 1) .SD, by=ID]
输出
ID tmt.pair year month level tmt val
1: 1 A 2021 A Low 1000 C 4.424811
2: 1 A 2021 A Low 4000 C 4.556058
3: 3 B 2021 J Low 1000 C 4.396996
4: 3 B 2021 J Low 4000 C 3.906065
5: 4 B 2020 O Low 1000 C 5.714706
6: 4 B 2020 O Low 4000 C 4.891188
或 dplyr
,其中我们只保留 id> id
S 1观察:
library(dplyr)
df %>%
group_by(ID) %>%
filter(n() > 1)
以下三种方法定义了服务的寿命,
-
addtransient
每次请求时,都会创建瞬态寿命服务。这一生最适合轻巧的无状态服务。 -
addScoped
每个请求一次创建一次范围的寿命服务。 -
添加
首次创建Singleton Lifetime服务(如果在此指定实例时运行Configureservices时),然后每个后续请求将使用同一实例。
想象您有一个ASPNET核心项目。
-
如果您只想在程序的运行时创建一次对象并每次使用相同的对象,则应使用添加ingingleton。
-
如果您希望每次在程序运行时收到请求时再次成为新(),则应使用AddScoped()。
-
如果您想要一个new()每个请求和响应的对象,则必须使用addTransient。
scanf()自动在尝试解析字符以外的其他转换之前。字符格式(主要是
%c
;还扫描集%[…]
- 和%n
)是例外;他们不跳过空格。
使用“%c”
带有领先的空白以跳过可选的空白。请勿在 scanf()
格式字符串中使用尾随空白。
请注意,这仍然不会消耗输入流中留下的任何尾随空格,甚至没有到一行的末端,因此,如果还使用 getchar()
或 fgets()
在同一输入流上。我们只是让Scanf在转换之前跳过Whitespace ,就像%D
和其他非字符转换一样。
请注意,非空间“指令”(使用 scanf中的文字文本(“ order =%d”,& order); 也不会跳过whitespace。文字顺序
必须匹配要读取的下一个字符。
因此,您可能想要“ order =%d”
如果要跳过上一行的新线。
更新下面的代码(相关问题要了解第一个代码调整:为什么MinMax(0,1fr)为长期元素工作时1fr dryn nn 't?)
* {
margin: 0;
}
.container {
display: flex;
justify-content: center;
background-color: firebrick;
}
.form {
display: flex;
flex-direction: column;
padding: 2rem;
margin: 2rem;
width: 25rem;
background-color: white;
}
.content {
border: 1px solid red;
display: grid;
grid-template-columns: repeat(2, minmax(0,1fr)); /* here */
grid-gap: 4rem;
}
/* here */
input {
max-width: 100%;
box-sizing: border-box;
}
<div class="container">
<form class="form">
<div class="content">
<div class="field">
<label for="title" class="label">Title</label>
<input type="text" placeholder="Job Title" id="title" class="input">
<i class="icon icon--success"></i>
<i class="icon icon--fail">
</i>
<small class="error-msg"></small>
</div>
<div class="field">
<label for="company" class="label">Company</label>
<select name="company" id="company" class="input">
<!-- options added in js -->
</select>
<i class="icon icon--success"></i>
<i class="icon icon--fail"></i>
<small class="error-msg"></small>
</div>
<div class="field">
<label for="location" class="label">Location</label>
<select name="location" id="location" class="input">
<!-- options added in js -->
</select>
<i class="icon"></i>
<i class="icon"></i>
<small class="error-msg"></small>
</div>
<div class="field">
<label for="wage" class="label">Wage</label>
<input type="text" placeholder="Wage" id="wage" class="input">
<i class="icon icon--success"></i>
<i class="icon icon--fail"></i>
<small class="error-msg"></small>
</div>
<div class="field">
<label for="type" class="new-job__label">Type</label>
<select name="type" id="type" class="input">
<!-- options added in js -->
</select>
<i class="icon icon--success"></i>
<i class="icon icon--fail"></i>
<small class="error-msg"></small>
</div>
<div class="field">
<label for="position" class="label">Position</label>
<select name="position" id="position" class="input">
<!-- options added in js -->
</select>
<i class="icon icon--success"></i>
<i class="icon icon--fail"></i>
<small class="error-msg"></small>
</div>
<div class="field">
<label for="pqe" class="label">PQE</label>
<select name="pqe" id="pqe" class="input">
<!-- options added in js -->
</select>
<i class="icon icon--success"></i>
<i class="icon icon--fail"></i>
<small class="error-msg"></small>
</div>
<div class="field">
<label for="featured" class="label">Featured</label>
<select name="featured" id="featured" class="input">
<!-- options added in js -->
</select>
<i class="icon icon--success"></i>
<i class="icon icon--fail"></i>
<small class="error-msg"></small>
</div>
</div>
<button class="new-job__submit">Submit</button>
</form>
</div>
您可以使用两个 div
对其进行操作。
- 第一个Div与Border
- Second Div用于影子盒
.outer{
border:2px solid #333;
width:200px;
height:150px;
border-radius:20px;
}
.inner{
-webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);
-moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);
box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.75);
width:180px;
height:130px;
margin:10px;
}
<div class="outer">
<div class="inner">
</div>
</div>
从您在评论中共享的错误中,看起来您在定义的控制器时要在HTTP post请求中进行HTTP。
将您的控制器注释更改为以下任何一个
@PostMapping("/saveContact")
或
@RequestMapping(path = "/saveContact", method = RequestMethod.POST)
给定一个包含您想要的所有特征值的对角矩阵,您可以使用随机(但可逆)矩阵的相似性转换来完成您想要的事情:
>> lambda = [-1 -2 -3] % These are the eigenvalues you want
lambda =
-1 -2 -3
>> A = diag(lambda)
A =
-1 0 0
0 -2 0
0 0 -3
>> eig(A)
ans =
-3
-2
-1
>> S = rand(size(A)); % Random matrix of compatible size with A.
>> B = inv(S)*A*S % Random matrix with desired eigenvalues, using similarity transformation
B =
-2.7203 -0.5378 -0.9465
2.0427 -0.1766 1.2659
-2.0817 -1.8974 -3.1031
>> eig(B)
ans =
-3.0000
-1.0000
-2.0000
只需在内部检查条件检查 new-break长度内部即可。
您还可以用本地查找表限制对允许的核苷酸进行检查。
在输入中注意到三(3) n
。 wiki norefollow noreferrer“> nucletide- GAP) ,但预期输出&amp;您的错误输出没有它们。
#define LINE_BREAK_LEN 50
void
output (const char *seq, const int len) {
char nlt [256] = {0};
nlt ['A'] = nlt['G'] = nlt['C'] = nlt['T'] = nlt['U'] = 1;
//nlt ['a'] = nlt['g'] = nlt['c'] = nlt['t'] = nlt['u'] = 1; // in case you want to allow lower-case too
for (int i = 0, j = 0; i < len; i++) {
if (nlt [(unsigned char) seq[i]]) {
putc (seq[i], stdout);
j++;
if (0 == (j % LINE_BREAK_LEN))
putc ('\n', stdout);
}
}
putc ('\n', stdout);
}
答案是要卸载并重新安装Python,这次告诉它设置环境变量。那做了这个问题。
我相信您的目标如下。
- 您希望每周每周插入水平线。
- 运行脚本时,在运行“清除Google Sheet”的脚本后,运行“将DF_Final写为Google Sheep”的脚本是运行的。
- 数据是从第1个选项卡中的单元格“ B7”放置的。
- 您想使用python使用googleapis实现这一目标。
在您的脚本中,以下修改后的脚本怎么样?
修改后的脚本:
请设置 dreversheet_id
和 sheet_id
的值。
spreadsheet_id = "###" # Please set Spreadsheet ID.
sheet_id = 0 # Please set the sheet ID.
# 1. Clear sheet. In this case, the values and the horizontal lines are removed.
service.spreadsheets().batchUpdate(
spreadsheetId=spreadsheet_id, body={"requests": [{
"repeatCell": {
"range": {
"sheetId": sheet_id
},
"fields": "userEnteredValue,userEnteredFormat.borders"
}
}
]}).execute()
# 2. Put the values from the dataframe to Spreadsheet.
cell_range_insert = 'B7'
# values = df_final.to_json() # It seems that this is not used.
# body = {'values': values} # It seems that this is not used.
response_date = service.spreadsheets().values().append(
spreadsheetId=spreadsheet_id,
valueInputOption='RAW',
range=cell_range_insert,
body=dict(
majorDimension='ROWS',
values=df_final.T.reset_index().T.values.tolist()
)
).execute()
# 3. Set the horizontal lines.
temp = -1
n = []
for index, row in df_final.iloc[:, 5:8].iterrows():
s = ''.join(row.astype(str).tolist())
if temp != s:
n.append(index)
temp = s
offset = 7
requests = [{
"repeatCell": {
"cell": {
"userEnteredFormat": {
"borders": {
"top": {
"style": "SOLID_THICK"
}
}
}
},
"range": {
"sheetId": sheet_id,
"startRowIndex": e + offset,
"endRowIndex": e + 1 + offset,
"startColumnIndex": 1,
"endColumnIndex": 10
},
"fields": "userEnteredFormat.borders"
}
} for e in n]
service.spreadsheets().batchUpdate(spreadsheetId=spreadsheet_id, body={"requests": requests}).execute()
-
运行此脚本时,使用batchupdate方法清除表。在这种情况下,删除了值和水平线。而且,数据将放在电子表格上。然后,使用batchupdate方法放置水平线(每个周末的“ B”列至“ J”)。
-
为了检查放置边框的行号,我使用了列“ G”,“ H”,“ I”的值。
-
在此示例中,我使用
solid_thick
作为边框。如果您想更改此问题,请更改它。 ref ref
注意:
-
上面脚本检查列“ G”,“ H”,“ I”。如果您只想检查“ i”列,而不是列“ g”,“ h”,“ i”,作为一个简单的修改,请按以下方式修改上述脚本。
-
来自
index,df_final.iloc [:,5:8] .ITERROWS():
-
to
索引,在df_final.iloc [:,7:8]中行().iterrows():
-
文献:
这可以帮助您:
#!/bin/bash
echo "script started at $(date +'%Y-%m-%dT%H:%M:%S%:z')"
echo "doing something"
sleep 2
echo "script finished at $(date +'%Y-%m-%dT%H:%M:%S%:z')"
如果调用完整命令对您来说笨拙,您可能需要创建一个别名。
这也可能很有用,所以我想我会在这里添加。
如果您想根据项目的值选择一个值,而不是该项目的索引,则可以执行以下操作:
您的选择列表:
<select id="selectBox">
<option value="A">Number 0</option>
<option value="B">Number 1</option>
<option value="C">Number 2</option>
<option value="D">Number 3</option>
<option value="E">Number 4</option>
<option value="F">Number 5</option>
<option value="G">Number 6</option>
<option value="H">Number 7</option>
</select>
jQuery:
$('#selectBox option[value=C]').attr('selected', 'selected');
$('#selectBox option[value=C]').prop('selected', true);
所选的项目现在为“ 2号”。
除了Mernst的接受答案外,我还找到了用于错误框架的Nullaway插件。
教程: https://wwwww.baeldung.com/java-nullaway
主页: https://github.com/uber/nullaway
重点,到目前为止,它们似乎都与我需要的东西相匹配。
不要尝试将零添加回零,只是不要首先删除它们,告诉
pandas.read_csv
列是字符串:输出:输出:
Don't try to add the zeros back, just don't delete them in the first place by telling
pandas.read_csv
that you column is a string:output:
如何使用Pandas从CSV中打印出CSV的电话号码?