您可以使用 groupby
检查
d = {x : y for x, y in df.groupby(['Doctor','Patient']) if len(y) > 1}
d
Out[36]:
{('Aaron', 'Josh'): Doctor Patient Days
1 Aaron Josh 46
2 Aaron Josh 71, ('Jess', 'Manny'): Doctor Patient Days
3 Jess Manny 55
4 Jess Manny 85
5 Jess Manny 46}
您的代码不会在网页的上下文中运行,而是在扩展上下文(弹出,选项,背景脚本/页面等)中,该上下文与单独的浏览器选项卡相似dom,文档
,窗口
和 chrome-extension://
url。
解决方案:使用 content Script 访问网页或互动及其内容。
- 内容脚本在网页中执行,而不是扩展名中。
- 默认情况下,内容脚本是隔离的,请参见如何在页面上下文中运行代码(又称主要世界)。
- 不要将内容脚本加载到扩展页面中。
- 要检查扩展名的每个上下文使用自己的devtools 。
方法1。声明清单
。JSON:
"content_scripts": [{
"matches": ["*://*.example.com/*"],
"js": ["contentScript.js"]
}],
页面加载时它将自动运行。在此之后,使用消息传递。
Chrome中的消息传递不支持DOM元素,MAP,SET,ARRAYBUFFER,类,功能等。它只能发送与JSON兼容的简单对象和类型,因此您需要手动提取所需的数据并将其作为简单的数组或对象传递。
⚠️您需要重新注射内容脚本在重新加载/安装扩展程序后。
方法2。程序化
-
清单v3 :
使用 chrome.scripting.scripting.executscript.executscript 扩展脚本(如弹出窗口)将内容脚本/函数注入需求选项卡。
此方法的结果是内容脚本中的最后一个表达式,因此可以用于提取数据。数据必须与JSON兼容,请参见上面的警告。
必需
permissions
在subest.json中:-
“脚本”
- 强制性; -
“ activetab”
- 理想场景,适用于A响应用户操作(通常单击工具栏中的扩展图标)。安装扩展时不会显示任何权限警告。
如果不可能进行理想的方案,将允许的站点添加到
host_permissions
in asutest.json:-
“*://////gy.com/”
加上您想要的任何其他网站。 -
“< all_urls>“
或”*://*/“
这些将使您的扩展名将您的扩展名放在Chrome Web中的超慢评论队列中由于广泛的主机权限而存储。
-
-
清单v2与上述差异:
- 使用 chrome.tabs.executescript 代替
chrome。 scipting.executescript
。 - 指定网站或
“ activetab”
“权限” ,无需“脚本”
。
。
- 使用 chrome.tabs.executescript 代替
本周早些时候,我与MongoDB有一个问题的连接工作室3T,这消耗了整个工作日,因此我放弃了使用Studio 3T来确保时间和其他替代方案。今天,我发现了Studio 3T的简短视频教程,介绍了如何将Studio 3T与MongoDB连接起来。遵循指示,我惊讶于成功建立了联系。
对于您的解决方案,我建议您观看此视频: https://wwww.youtube。 com/watch?v = _ka3-hgnlye
如果此答案对您有所帮助,请记住要为他人突出显示它。
我的猜测是基于您的错误,您正在尝试将空字符串转换为整数,这显然是行不通的。我将使用或操作员检查空字符串,然后简单地解析为零: int(arg或“ 0”)
有两种情况:
- 如果您没有用户中实现的平等和哈希代码方法:
最简单的方法是获取所有用户识别符,例如databaseID或用户名。将其持续到哈希结构中,以进行快速搜索。然后浏览所有用户,接受本集合中未包含的所有用户。
创建一组已记录的用户标识符:
Set<Long> loggedUserIdentifiers = loggedUsers.stream()
.map(User::getId) // I have chosen Id
.collect(toSet());
现在您可以找到所有未燃烧的用户:
List<User> unloggedUsers = allUsers.stream()
.filter( user -> !loggedUserIdentifiers.contains(user.getId()))
.collect(toSet());
-
如果您实现了平等和哈希代码,则可以简单地将所有记录的用户从所有用户集合的副本中删除。只需记住先创建一个副本,否则您只会以记录和未登录的用户结束。
set&lt;用户&gt; AlluserCopy =新的Hashset&lt;&gt;(Allusers); //在列表上也有效 AlluserCopy.RemoveAll(Loggedusers); 设置&lt;用户&gt; notloggedusers = set.copyof(alluserCopy);
现在,您将拥有一个只有未记录的用户的集合。
CREATE temp TABLE table_name (
state boolean,
id uuid PRIMARY KEY,
bsa text
);
INSERT INTO table_name (state, id, bsa)
VALUES (FALSE, 'b18bde5d-aeb4-492d-b0de-c45437da94ac', 'PPCM');
-Main功能:
CREATE OR REPLACE FUNCTION misc (IN tempdata jsonb)
RETURNS void
AS $
DECLARE
_id uuid;
_state boolean;
_bsa text;
BEGIN
RAISE NOTICE 'jsonb.state: %', tempdata['state']::text;
RAISE NOTICE 'jsonb.id: %', tempdata['id']::text;
RAISE NOTICE 'jsonb.bsa: %', tempdata['bsa']::text;
_id := (tempdata ->> 'id')::text::uuid;
_state := tempdata['state']::text::boolean;
_bsa := tempdata ->> 'bsa'::text;
INSERT INTO table_name (state, id, bsa)
VALUES (_state, _id, _bsa)
ON CONFLICT (id)
DO UPDATE SET
state = excluded.state;
END
$
LANGUAGE plpgsql;
测试它:
SELECT
*
FROM
misc ('{"bsa": "PCM","state": true,"id": "b18bde5d-aeb4-492d-b0de-c45437da94ac"}');
通过,
,获取第3个,将其转换为整数,然后总和。
arrays.inject(0) { |acc, triplet| acc += triplet.split(/,/)[2].to_i; acc }
首先,让我们澄清为什么 5b:7df
仅显示0x5b和0x7b。您基本上掩盖了以下内容:
b00001011011 <- 0x5B
b11111011111 <- 0x7DF (mask)
------------
b00001011011 <- bitwise AND
只能通过掩盖0x7DF给出相同结果的消息。鉴于0x7DF中只有一个零,只有0x7b可以工作:
b00001111011 <- 0x7B
b11111011111 <- 0x7DF (mask)
------------
b00001011011 <- bitwise AND
现在让我们在掩码的右侧添加零:
b00001011011 <- 0x5B
b11111000000 <- 0x7C0 (mask) (edit : fix typo copy/paste)
------------
b00001000000 <- bitwise AND
遵循相同的逻辑,此掩码将通过B00001000000(0x40)的ID允许消息通过B0000001111111(0x7F)。
如您所见,位面罩不能很好地适应此类范围(HEX/DEC)。例如,更容易滤除0x182、0x282、0x382和0x482(因此, canopen )。
最好的选择是将二进制友好切片范围分开:
- 0x5b(B1011011)
- 0x5C至0x5F(B1011100至B10111111)
- 0x60至0x6F(B1100000到B1101111)
- 等...
希望这会有所帮助:
df <- df %>% mutate( ev_1 = case_when
(Col1 <5 ~ paste("Evaluauation: Col1) This Number is Low."),
Col1 >5 ~ ("Evaluauation: Col1) This Number is High.")),
ev_2 = case_when
(Col2 <9 ~ paste("Col2) This number is Low."),
Col2>9 ~ paste("Col2) This number is High.")),
Evaluation = paste(ev_1 , ev_2)) %>%
select(-ev_1, -ev_2)
df
Col1 Col2 Evaluation
1 1 15 Evaluauation: Col1) This Number is Low. Col2) This number is High.
2 2 14 Evaluauation: Col1) This Number is Low. Col2) This number is High.
3 3 13 Evaluauation: Col1) This Number is Low. Col2) This number is High.
4 4 12 Evaluauation: Col1) This Number is Low. Col2) This number is High.
5 5 11 NA Col2) This number is High.
6 6 10 Evaluauation: Col1) This Number is High. Col2) This number is High.
7 7 9 Evaluauation: Col1) This Number is High. NA
8 8 8 Evaluauation: Col1) This Number is High. Col2) This number is Low.
9 9 7 Evaluauation: Col1) This Number is High. Col2) This number is Low.
10 10 6 Evaluauation: Col1) This Number is High. Col2) This number is Low
您可以像文本一样分享代码吗?此外,您不使用外部任务传感器,您必须正确使用时间差,例如dag_b schedue_interval应该比dag_a早。否则,它将不起作用,我认为您没有提到时间表间隔,在DAG A中的Morevoer也无法正确地读取有关它的时间执行Delta
鉴于您的属性中心XML相对平坦,请考虑新的IO方法, pandas.read_xml
。然后,合并
两个数据帧或使用 concat
在数据帧列表上运行迭代加入,该列表要求DateTime设置为索引。
pd.merge
final_df = pd.merge(
pd.read_xml('PTU.xml'), pd.read_xml('AMS.xml'),
on = "DataSrvTime", how = "outer"
)
pd.concat
df_list = [
pd.read_xml(f).set_index("DataSrvTime")
for f in
['PTU.xml', 'GPS.xml', 'AMS.xml']
]
final_df = pd.concat(df_list, axis=0)
您应该首先使用“ .netFramework”选择该项目。
Winform基于屏幕中间或父表中间的中间实现通用表单。
我演示了一个简单的登录功能,并弹出了一个新窗口。
父表格显示在屏幕中间。
子形式处于父母形式的中间。
代码逻辑是:封装操作数据库的实体类并控制表单的位置。通过查询数据库来实现登录功能,并显示子形式。并在屏幕中间和子形式中间的子形式形成父母形式。
public Form1()
{
InitializeComponent();
//Set the form screen to center
FormBaseOPC.SetScreenMiddle(this);
}
private void button1_Click(object sender, EventArgs e)
{
if(textBox1.Text != "" && textBox2.Text != "")
{
Login();
}
else
{
MessageBox.Show("Enter empty options, please re-enter");
}
}
public void Login()
{
Dao dao = new Dao();//Entity classes encapsulate database operations
string sql = $"select * from t_user where id='{textBox1.Text}' and psw='{textBox2.Text}'";//sql query database
IDataReader dc = dao.read(sql);
if (dc.Read())
{
Data.UID = dc["id"].ToString();
Data.UName = dc["name"].ToString(); //Data entity class encapsulates the data queried from the database
MessageBox.Show("login successful");
user1 user = new user1();
// Make the child form in the middle of the parent form
FormBaseOPC.SetFormMiddle(user);
}
else
{
MessageBox.Show("Login failed");
}
dao.DaoClose();
}
封装操作表单的位置的实体类:
internal class FormBaseOPC
{
/// <summary>
/// 1- Center the form screen
/// </summary>
/// <param name="form">The form that needs to be centered</param>
public static void SetScreenMiddle2(Form form)
{
if (form != null)
{
//Get the screen setting centering effect
form.SetBounds((Screen.GetBounds(form).Width / 2) - (form.Width / 2),
(Screen.GetBounds(form).Height / 2) - (form.Height / 2),
form.Width, form.Height, BoundsSpecified.Location);
}
}
/// <summary>
/// 1-The form screen is centered (the system comes with it)
/// </summary>
/// <param name="form">The form that needs to be centered</param>
public static void SetScreenMiddle(Form form)
{
if (form != null)
{
form.StartPosition = FormStartPosition.CenterScreen;
}
}
/// <summary>
/// 2- Set to center and open relative to the form
/// </summary>
/// <param name="form">The form that needs to be centered</param>
public static void SetFormMiddle(Form form)
{
if (form != null)
{
//Set the form to center relative to the parent form
form.StartPosition = FormStartPosition.CenterParent;
// show the form
form.ShowDialog();
//set focus to current form
form.Focus();
}
}
}
Entity类封装代码:
internal class Dao
{
SqlConnection conn;
public SqlConnection connection()
{
// write database connection string
string connStr = "Data source=localhost;Initial Catalog=student;User ID=sa;Password=123456";
conn = new SqlConnection(connStr);
conn.Open();
return conn;
}
public SqlCommand command(string sql)
{
SqlCommand cmd = new SqlCommand(sql, connection());
return cmd;
}
public int Execute(string sql)
{
return command(sql).ExecuteNonQuery();
}
public SqlDataReader read(string sql)
{
return command(sql).ExecuteReader();
}
public void DaoClose()
{
conn.Close();
}
}
internal class Data
{
public static string UID = "", UName = "";
}
欢迎形式的代码逻辑:
public user1()
{
InitializeComponent();
label1.Text = $"Welcome to {Data.UName}";
}
Winform根据屏幕中间或父级表格的中间实现通用表单:通过登录函数。登录页面位于屏幕的中间,子形式位于父级的中间。希望它可以帮助您。
是的。有几种选择,具体取决于您的特定单词的特殊性。
在您的情况下,第一个更易于测试和实现,不需要音频数据进行培训。
通常,您只能通过网络发送可序列化值。地图不是可序列化的:
const map = new Map();
map.set('key', 'value');
console.log(JSON.stringify(map));
要么发送可以将其转换为客户端上的地图的数组数组,要么使用其他数据结构(例如普通对象)。例如:
router.get("/list", async (req, res) => {
try {
const users = await userCollection.find();
accessedListEmbed(req);
const userDataArr = [];
users.forEach((user) => {
userDataArr.push([user.userName, user.status]);
});
res.json(userDataArr); // make sure to use .json
} catch (error) {
// send JSON in the case of an error too so it can be predictably parsed
res.json({ error: error.message });
}
});
然后在客户端上:
fetch(..)
.then(res => res.json())
.then((result) => {
if ('error' in result) {
// do something with result.error and return
}
const userDataMap = new Map(result);
// ...
或类似的东西。
您将需要将文件转换为编码的字节数组,然后将文件转换为字符串以保存。
看到这个帖子
将发布的文件转换为字节数组
映射的文件字段可以是字符串,也可以是字节数组,必须通过编程将图像路径添加到图片字段的方式来给出值。
You will need to convert your file to a encoded byte array and then to string to save it.
See this SO post
Convert posted file to byte array
The not mapped file field can be a string or may be byte array and must be given value by programming the way image path is added to picture field.
将图像上传到.NET 6中的数据库