我正在尝试在 Visual Studio 2008 中输出俄语单词。我写道:
#include <iostream>
#include <locale.h>
using namespace std;
void main()
{
setlocale(LC_ALL,"rus");
cout << "? ???? ?????? ??? ??-??????!";
}
Run Code Online (Sandbox Code Playgroud)
当我在 Visual Studio 中按Ctrl+S保存文件时,收到以下提示:
此文件中的某些 Unicode 字符无法保存在当前代码页中。你想把它保存在 unicode 中吗?
我选择了“使用其他编码保存”选项并选择了“西里尔文 (Windows) - 代码页 1251”。但是,当我运行我的程序时,控制台输出显示如下:
???????? ??? ????
Run Code Online (Sandbox Code Playgroud) I have two dataframes df1
+---+---+----------+
| n|val| distances|
+---+---+----------+
| 1| 1|0.27308652|
| 2| 1|0.24969208|
| 3| 1|0.21314497|
+---+---+----------+
Run Code Online (Sandbox Code Playgroud)
and df2
+---+---+----------+
| x1| x2| w|
+---+---+----------+
| 1| 2|0.03103427|
| 1| 4|0.19012526|
| 1| 10|0.26805446|
| 1| 8|0.26825935|
+---+---+----------+
Run Code Online (Sandbox Code Playgroud)
I want to add a new column to df1 called gamma, which will contain the sum of the w value from df2 when df1.n == df2.x1 OR df1.n == df2.x2
我尝试使用 udf,但显然从不同的数据帧中选择是行不通的,因为值应该在计算之前确定
gamma_udf = udf(lambda n: float(df2.filter("x1 = …Run Code Online (Sandbox Code Playgroud)