小编Dav*_*ies的帖子

将数据框转换为字典

我有一个数据框,我希望它选择一些列并以某种方式将其转换为Dictionary

数据框:

数据框:

这是我想要的输出

{20: [4.6, 4.3, 4.3, 20],
21: [4.6, 4.3, 4.3, 21],
 22: [6.0, 5.6, 9.0, 22],
 23: [8.75, 5.6, 6.6, 23]}
Run Code Online (Sandbox Code Playgroud)

我已经试过了

items_dic = data[["Length","Width","Height","Pid" ]].set_index('Pid').T.to_dict('list')

items_dic = {20: [4.6, 4.3, 4.3],
 21: [4.6, 4.3, 4.3],
 22: [6.0, 5.6, 9.0],
 23: [8.75, 5.6, 6.6]}
Run Code Online (Sandbox Code Playgroud)

但这不包括值列表中的Pid有人可以解释为什么吗?

python dictionary dataframe python-3.x pandas

10
推荐指数
2
解决办法
506
查看次数

用于C#核心的Docker构建需要互联网连接

我正在使用docker-compose在C#.NET核心(VS 2017)中编写,使用build for linux容器.

当我构建图像(或发布)时,由于nuget的使用,总是引用互联网.

遇到最后一个错误(我在nuget上停止了停机,但无论如何 - 任何停机时间都不应导致构建/发布中的异常).

/usr/share/dotnet/sdk/2.1.503/NuGet.targets(114,5):错误:无法加载源https://api.nuget.org/v3/index.json的服务索引....

我想构建图像,即使nuget已关闭,甚至没有intet连接

yml文件如下所示:

services:

 myProj:
 image: my_proj
 build:
  context: ./all_projects/base_solution/
  dockerfile: myProj/Dockerfile 
Run Code Online (Sandbox Code Playgroud)

似乎"dotnet publish ..."命令从Internet恢复恢复.

如果我使用--no-restore运行发布,代码未编译,但我想从我自己的预构建计算机中恢复nuget包.

我该怎么做?没有互联网连接?为什么我要依靠互联网来恢复每个版本的nuget?

为什么我不能从我自己的预构建图像中恢复nuget包,而不是总是?!从nuget获取(实际上nuget包在我的代码中偶尔不会改变).

我可以从nuget复制文件夹,而不是使用"COPY"命令吗?

我做了以下事情:

从'common'项目构建图像,该项目使用所有nuget包.

在内置图像中为新的其他图像添加引用,如下所示:

创建一个新的公共图像:#没有运行时.

FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY TestDock/TestDock.csproj TestDock/

FROM build AS publish
RUN dotnet publish TestDock.csproj -c Release -o /app
Run Code Online (Sandbox Code Playgroud)

在原始图像:FROM microsoft/dotnet:2.1-runtime AS基础WORKDIR/app

# FROM microsoft/dotnet:2.1-sdk AS build do:
FROM my_common_image AS build
WORKDIR /src
COPY TestDock/TestDock.csproj TestDock/

# Added the following. I tried to copy …
Run Code Online (Sandbox Code Playgroud)

nuget docker-compose asp.net-core

8
推荐指数
1
解决办法
360
查看次数

Vue 复选框不随数据更改而更新

我在 Vue 更新 UI 中的数据出现问题,但似乎只有复选框存在此问题。

我试图一次只允许选中一个复选框,因此我在单击其中之一时将所有复选框设置为 false。但是,这在数据中有效,但在复选框中无法正确呈现。

HTML:

<table class="buildings-modify--table table-full table-spacing">
    <thead>
       <tr>
          <th>Name</th>
          <th>Primary</th>
          <th>Address</th>
          <th>City/Town</th>
          <th>Province</th>
          <th>Postal Code</th>
          <th>Phone</th>
          <th>Active</th>
       </tr>
     </thead>
     <tbody>
       <tr v-for="landlord in selectedLandlords" :key="landlord.id">
         <td>{{ landlord.name }}</td>
         <td>                            
           <input type="checkbox" :value="landlord.is_primary" @change.prevent="makePrimaryLandlord(landlord)">
         </td>
         <td>{{ landlord.address }}</td>
         <td>{{ landlord.city }}</td>
         <td>{{ landlord.province}}</td>
         <td>{{ landlord.postal_code}}</td>
         <td>{{ landlord.phone }}</td>
         <td>{{ landlord.is_active ? "Yes" : "No" }}</td>
       </tr>
   </tbody>
Run Code Online (Sandbox Code Playgroud)

视图代码:

export default {
    data: function() {
        return {
            selectedLandlords: []
        }
    },
    methods: {
        makePrimaryLandlord: function(landlord) { …
Run Code Online (Sandbox Code Playgroud)

checkbox vue.js

7
推荐指数
1
解决办法
9141
查看次数

如何创建一个使用带有 tailwindcss 的奇子伪选择器的类

我在课堂上使用奇数子伪选择器时遇到一些困难。odd:bg-blue-200 内联使用时效果很好。但我想提取这种样式,以便在给定类 .tr 时,我的所有表行都具有这种样式。我一直在查看文档,但解决方案一直困扰着我。我希望这里有人可以提供帮助。

到目前为止,我已经尝试过:

.tr:odd {
  @apply bg-blue-200;
}
Run Code Online (Sandbox Code Playgroud)

@variants odd {
  .tr {
    @apply bg-blue-200;
  }

}
Run Code Online (Sandbox Code Playgroud)

在 tailwind.config.js 中,我添加了 backgroundColor 变体:

variants: {
'backgroundColor': ['responsive', 'odd', 'hover']
},
Run Code Online (Sandbox Code Playgroud)

css tailwind-css

6
推荐指数
1
解决办法
8300
查看次数

Neo4j 浏览器的凭据是什么

我刚刚从这里安装了 neo4j桌面和服务器。

还安装了JDK

接下来,我提取了 neo4j 社区,然后在该位置的 bin 目录中使用管理命令提示符,我使用以下命令安装了服务

neo4j.bat install-service.
Run Code Online (Sandbox Code Playgroud)

成功安装服务后,我现在可以浏览到http://localhost:7474/browser/

但现在怎么办?登录凭据应该是什么。

我看到以下消息

数据库访问不可用。请使用 :server connect 建立连接。有一张图表在等你。

连接到 Neo4j 数据库访问需要经过身份验证的连接。

Neo4j浏览器认证问题

authentication neo4j

4
推荐指数
1
解决办法
2734
查看次数

TailWinCSS 最大高度

所以我想知道如何在 TailWindCSS Config 中设置最大高度媒体断点。iPad Pro 因其宽度而被视为笔记本电脑。也就是说,它们对于笔记本电脑 CSS 来说太高了,让我的网站看起来很糟糕。

欢迎任何帮助,谢谢,贾斯汀。

css media-queries tailwind-css

2
推荐指数
1
解决办法
5739
查看次数

试图用正则表达式解析数字

我正在尝试解析文本中的所有数字:

text 2030 text 2,5 text 2.000.000 2,000,000 -200 +31600000000. 200. 2.5 200? 1:200
Run Code Online (Sandbox Code Playgroud)

基于此正则表达式:

text 2030 text 2,5 text 2.000.000 2,000,000 -200 +31600000000. 200. 2.5 200? 1:200
Run Code Online (Sandbox Code Playgroud)

但结局喜欢.?!,右后数不匹配。我只想与进行完整比赛preg_match_all。(见图片)

比赛概述

我想问题出在我的正则表达式的最后一部分(?!\S)。我尝试了不同的方法,但是我不知道该如何解决。

php regex

1
推荐指数
1
解决办法
46
查看次数