您几乎可以使用列表理解来创建一个新列表,并分配给DF ['c'],如下所示;
df['c'] = [np.array(x)*2 for x in df['a'].to_list()]
我的同样问题,这意味着您的机器上安装了纱线,但纱线的可执行文件目录不在系统的路径中。
按照下面的步骤操作:
检查纱线安装目录:
NPM bin -g
添加YARN的安装目录(从上一步生成
path/to/your/your/your/your/your/your/your/your/your/bin
)到系统路径
linux/macOS:
添加导出路径=“ path:/path/to/yarn/bin”
到〜/.bashrc
或〜/.zshhrc
或〜/.bash_profile
Windows:
控制面板>系统>高级系统设置>环境变量
编辑路径变量可包括目录(path/to/your/your/your/your/your/bin
)。
重新启动终端或命令提示或git bash
验证纱线安装
纱线 - Version
那些解决了我的问题的人
为了清楚起见,您应该继续进行以下操作:
import numpy as np
r1 = np.array([[150. , 132.5001244 , 115.00024881],
[ 97.50037321, 80.00049761, 62.50062201],
[ 45.00074642, 27.50087082, 10.00099522]])
# make a copy and shuffle the copy
r2 = r1.copy()
np.random.shuffle(r2.ravel())
# get the index of the max
idx = np.unravel_index(r2.argmax(), r2.shape)
# swap first and max
r2[idx], r2[(0, 0)] = r2[(0, 0)], r2[idx]
print(r2)
如果
最初排序阵列,则可以使用阵列的平坦视图:
r1 = np.array([[150. , 132.5001244 , 115.00024881],
[ 97.50037321, 80.00049761, 62.50062201],
[ 45.00074642, 27.50087082, 10.00099522]])
r2 = r1.copy()
# r2.ravel() returns a view of the original array
# so we can shuffle only the items starting from 1
np.random.shuffle(r2.ravel()[1:])
可能的输出:
[[150. 80.00049761 62.50062201]
[ 97.50037321 132.5001244 115.00024881]
[ 45.00074642 27.50087082 10.00099522]]
另一个dplyr
+ purrr
选项可能是:
dta %>%
mutate(pmap_dfr(across(-ID), ~ `[<-`(c(...), seq_along(c(...)) > match(1, c(...)), 1)))
ID Q0 Q1 Q2 Q3 Q4
1 A 0 0 0 0 0
2 B 0 1 1 1 1
3 C 0 0 1 1 1
4 D 0 0 0 1 1
5 E 0 NA NA NA NA
6 F 0 1 1 1 1
指定相互依存的链接库的顺序是错误的。
如果库相互依赖,则链接的库的顺序确实很重要。通常,如果库a
取决于库b
,则liba
必须在libb 在链接标志中。
例如:
// B.h
#ifndef B_H
#define B_H
struct B {
B(int);
int x;
};
#endif
// B.cpp
#include "B.h"
B::B(int xx) : x(xx) {}
// A.h
#include "B.h"
struct A {
A(int x);
B b;
};
// A.cpp
#include "A.h"
A::A(int x) : b(x) {}
// main.cpp
#include "A.h"
int main() {
A a(5);
return 0;
};
创建库:
$ g++ -c A.cpp
$ g++ -c B.cpp
$ ar rvs libA.a A.o
ar: creating libA.a
a - A.o
$ ar rvs libB.a B.o
ar: creating libB.a
a - B.o
编译:
$ g++ main.cpp -L. -lB -lA
./libA.a(A.o): In function `A::A(int)':
A.cpp:(.text+0x1c): undefined reference to `B::B(int)'
collect2: error: ld returned 1 exit status
$ g++ main.cpp -L. -lA -lB
$ ./a.out
为了重复重复,顺序做很重要!
我建议使用build-in 格式>格式>格式> /a> - 呼吸而不是F弦:它更具用途,因为您可以制作一个模板字符串,该模板字符串在其他“人”的数据中共享。可以通过将其传递给模板的字典理解来收集人均数据。注意字典的键值扩展,**
。
# form per person
string_template = "{name}, is a {profession} for {no_of_years} years in {cities}, {states}"
keys = 'name', 'profession', 'no_of_years', 'cities', 'states'
data = {k: input(f'Insert {k}: ') for k in keys}
print(string_template.format(**data)) # key-value expansion
要进一步减少键
和string_format
之间的依赖关系,一个人可以使用(再次)String- 格式
函数:
# per person
keys = 'name', 'profession', 'no_of_years', 'cities', 'states'
string_template = "{}, is a {} for {} years in {}, {}".format(*map('{{{}}}'.format, keys))
...
注意in
{ {{}}}
需要两个括号来逃脱符号,最后一个用format
替换。
这里可能的交互式程序:
keys = 'name', 'profession', 'no_of_years', 'cities', 'states'
string_format = "{}, is a {} for {} years in {}, {}".format(*map('{{{}}}'.format, keys))
data_people = []
while True:
main_menu_selection = input('[enter] Add a person\n[q] Quit')
if main_menu_selection == 'q':
print('Quit.')
break
data_person = {k: input(f'Insert {k}: ') for k in keys}
data_person_str = string_format.format(**data_person)
data_people.append(data_person_str)
print(*data_people, sep='\n')
父母的过滤器总是会影响孩子,然后您可以使用:: pseudo元素来解决它
.parent {
width: 100px;
height: 150px;
position: relative;
}
.parent::after {
content: '';
width: 100%;
height: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
display: block;
background-image: url(https://cdn.pixabay.com/photo/2022/06/07/15/56/child-7248693_1280.jpg);
background-size: cover;
background-position: center;
filter: blur(5px);
z-index: -1;
}
.child {
z-index: 1;
}
<div class="parent">
<p class="child">
text
</p>
</div>
答案是display:inline-block
,但是如果您想要这种行为,则应使用span
,因为默认情况下跨度为内联元素。它不需要任何其他样式
p {
display: inline-block;
}
<p>aaaaaaaaaaaaaaa</p>
<p>bbbbbbbbbbbbbbb</p>
这与您的问题无关,但是您要在功能调用中使用=
而不是&lt; -
。如果您使用&lt; -
,最终将创建变量y1
和y2
在您工作的任何环境中:
d1 <- data.frame(y1 <- c(1, 2, 3), y2 <- c(4, 5, 6))
y1
# [1] 1 2 3
y2
# [1] 4 5 6
这赢了' T在数据框架中创建列名的效果看似所需的效果:
d1
# y1....c.1..2..3. y2....c.4..5..6.
# 1 1 4
# 2 2 5
# 3 3 6
另一方面,=
运算符将使您的向量与参数与data.frame.frame
相关联。
至于您的问题,列出数据帧很容易:
d1 <- data.frame(y1 = c(1, 2, 3), y2 = c(4, 5, 6))
d2 <- data.frame(y1 = c(3, 2, 1), y2 = c(6, 5, 4))
my.list <- list(d1, d2)
您访问数据帧,就像您访问其他列表元素一样:
my.list[[1]]
# y1 y2
# 1 1 4
# 2 2 5
# 3 3 6
经过进一步的调查, nat 似乎是答案。
根据这些解释 > loopback 接口和 docker0 桥。
由于以下内容,因此Windows的Docker Desktop无法识别这一点(“ nofollow noreferrer”> source ):
由于Windows的Docker桌面中实现了网络的方式,因此您在主机上看不到Docker0接口。该接口实际上在虚拟机中。
但是,为什么编译器认为L2的静态型与L1相同? ((
因此,没有编译器错误)
,因为它们完全相同。变量的编译时类型l1
和l2
均为list&lt;扩展数字&gt;
。
在方法中可能发生运行时错误
NO中发生,运行时错误不会发生。任务是完全安全的。可以用l2
的类型指向的任何东西都可以用l1
的类型指出。
由于使用了通配符,因此它们的类型可能是继承的任何东西
从数字。
我认为您正在考虑这样一个事实,例如,您可以将列表&lt; integer&gt;
作为第一个参数,而list&lt; double&gt;
作为第二个参数。是的,这很好。然后,l1
将指向list&lt; integer&gt;
和l2
将指向list&lt; double&gt;
。然后,当您做l1 = l2;
时,您可以同时进行l1
和l2
指向list&lt; double; double&gt;
。很好。由于l1
具有类型列表&lt;?扩展数字&gt;
,有时可以指向list&lt; integer&gt;
,而在其他时候则指向list&lt; double&gt;
。考虑一个更简单的示例:
public void func4(Object o1, Object o2) {
o1 = o2;
}
我可以将字符串
作为第一个参数,而整数
作为第二个参数,这很好。分配O1 = O2;
将导致o1
和o2
指向Integer
对象和o1
和o2
可以做到这一点,因为它们具有对象
。
日期非常烦人。确保您使用正确日期的最佳选择是使用日期函数,然后根据需要格式化输出:
Sub DateConvert()
Dim ws As Worksheet: Set ws = ActiveWorkbook.Worksheets("Sheet1")
Dim rData As Range: Set rData = ws.Range("C2", ws.Cells(ws.Rows.Count, "C").End(xlUp))
If rData.Row < 2 Then Exit Sub 'No data
'Load range data into an array
Dim aData() As Variant
If rData.Cells.Count = 1 Then
ReDim aData(1 To 1, 1 To 1)
aData(1, 1) = rData.Value
Else
aData = rData.Value
End If
'Loop over array and perform conversion
Dim aDateValues As Variant
Dim i As Long
For i = 1 To UBound(aData, 1)
aDateValues = Split(Replace(aData(i, 1), "Invoice Date:", vbNullString), "/") 'Remove the extra text and pull the date values
aData(i, 1) = DateSerial(aDateValues(2), aDateValues(1), aDateValues(0)) 'Use DateSerial to guarantee correct date
Next i
'Output results to sheet with desired date format
With rData
.Value = aData
.NumberFormat = "dd/mm/yyyy"
End With
End Sub
您需要为此调整变压素。我这样做了,它对我有用:
You'll want to adjust the transformOrigin for that. I did it like this and it worked for me:
MUI-如何将选择选项定位在选择组件上方