流星番茄

文章 评论 浏览 27

流星番茄 2025-02-21 01:30:36

首先,在导入数据框后,按顺序对第一行的值进行排序,

df
Out[26]: 
   0  1  2  3
0  0  1  0  1
1  1  2  5  8
2  2  3  6  9
3  3  4  7  0

df = df.sort_values(by = 0, axis = 1)

Out[30]:
   0  2  1  3
0  0  0  1  1
1  1  5  2  8
2  2  6  3  9
3  3  7  4  0

您应该具有带有第1行值的数据框架。之后,您可以使用 df.iloc 重命名您的列名称,然后删除第一行。

df.columns = df.iloc[0]

0  0  0  1  1
0  0  0  1  1
1  1  5  2  8
2  2  6  3  9
3  3  7  4  0

df.drop(0, inplace=True)

df.drop(0)
Out[51]: 
0  0  0  1  1
1  1  5  2  8
2  2  6  3  9
3  3  7  4  0

最终,您可以根据列名进行切片。

df_1 = df[1]

df_1
Out[56]: 
0  1  1
1  2  8
2  3  9
3  4  0

First of all, after importing the dataframe, sort the value of the first row in order

df
Out[26]: 
   0  1  2  3
0  0  1  0  1
1  1  2  5  8
2  2  3  6  9
3  3  4  7  0

df = df.sort_values(by = 0, axis = 1)

Out[30]:
   0  2  1  3
0  0  0  1  1
1  1  5  2  8
2  2  6  3  9
3  3  7  4  0

You should have a dataframe with ordered 1st row values. After that, you can use df.iloc to rename your column name and you will drop the first row.

df.columns = df.iloc[0]

0  0  0  1  1
0  0  0  1  1
1  1  5  2  8
2  2  6  3  9
3  3  7  4  0

df.drop(0, inplace=True)

df.drop(0)
Out[51]: 
0  0  0  1  1
1  1  5  2  8
2  2  6  3  9
3  3  7  4  0

Eventually, you can do slicing based on the column name.

df_1 = df[1]

df_1
Out[56]: 
0  1  1
1  2  8
2  3  9
3  4  0

按行值分开数据框

流星番茄 2025-02-20 23:20:52

这是 my-code-my-code-actions < /code> jialedu ,

  • 函数参数
  • 生成代码下面的代码 原始函数
  • 考虑 另一个警告“未发现变量...”

"my-code-actions.actions": {
    "[python]": {
        "create method {{diag:$1}}": {
            "diagnostics": ["\"(.*?)\" is not defined", "Undefined variable '(.*?)'"],
            "atCursor": "\\b{{diag:$1}}\\(([^)]*)\\)",
            "insertFind": "{{diag:$1}}\\((.*?)\\)",
            "text": "\ndef {{diag:$1}}({{atCursor:$1}}):\n    pass\n\n",
            "where": "afterLast",           
        },                    
    }


}

Here is an adapted version of the my-code-actions settings from JialeDu,

  • considering function arguments
  • generating the code below the original function call
  • considering another warning "Undfined variable ..."

"my-code-actions.actions": {
    "[python]": {
        "create method {{diag:$1}}": {
            "diagnostics": ["\"(.*?)\" is not defined", "Undefined variable '(.*?)'"],
            "atCursor": "\\b{{diag:$1}}\\(([^)]*)\\)",
            "insertFind": "{{diag:$1}}\\((.*?)\\)",
            "text": "\ndef {{diag:$1}}({{atCursor:$1}}):\n    pass\n\n",
            "where": "afterLast",           
        },                    
    }


}

单击VS代码Python创建不存在的函数

流星番茄 2025-02-20 05:55:50

默认情况下,当设置“需求”时,github操作将解释条件,如果:success()。因此,如果步骤中有任何失败,GH将把工作视为不成功。

您是否可以在 generate_build_number 作业中为每个步骤添加继续:true

,或

添加以下条件

 generate_build_number:
    needs: [ aws, azure, gcp ]
    name: Generate Build Number
    runs-on: ubuntu-latest
    if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
    outputs:
      build_number: ${{ steps.buildnumber.outputs.build_number }}
    steps:
    - name: Generate build number
      id: buildnumber
      uses: einaregilsson/build-number@v3 
      with:
        token: ${{secrets.github_token}}

  zip_files:
    needs: generate_build_number
    if: always()
    name: Generate Zip File
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: echo ${{needs.generate_build_number.outputs.build_number}} > world.txt
      - uses: montudor/action-zip@v1
        with:
          args: zip -qq -r terraform-latest.zip aws azure gcp world.txt
      - uses: actions/upload-artifact@v1
        with:
          name: terraform-latest
          path: ${{ github.workspace }}/terraform-latest.zip

By default, when "needs" is set, Github actions will interpret the condition if: success(). So if there are any failures in steps, GH will treat the job as not successful.

Either you can add continue-on-error: true for each step in generate_build_number job

or

add a condition like below

 generate_build_number:
    needs: [ aws, azure, gcp ]
    name: Generate Build Number
    runs-on: ubuntu-latest
    if: ${{ always() && contains(join(needs.*.result, ','), 'success') }}
    outputs:
      build_number: ${{ steps.buildnumber.outputs.build_number }}
    steps:
    - name: Generate build number
      id: buildnumber
      uses: einaregilsson/build-number@v3 
      with:
        token: ${{secrets.github_token}}

  zip_files:
    needs: generate_build_number
    if: always()
    name: Generate Zip File
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - run: echo ${{needs.generate_build_number.outputs.build_number}} > world.txt
      - uses: montudor/action-zip@v1
        with:
          args: zip -qq -r terraform-latest.zip aws azure gcp world.txt
      - uses: actions/upload-artifact@v1
        with:
          name: terraform-latest
          path: ${{ github.workspace }}/terraform-latest.zip

GitHub Action:即使上一份成功,下一个工作也被跳过了

流星番茄 2025-02-20 02:59:48

首先,您需要添加一个元素,而不是用另一个元素覆盖整个数组。第二个React Usestate变量您应该使用先前的值来更新新数组。您不能使用列表本身。 Try this:

const [list,setList]=useState([])

const addList=(id)=>{
    setList(pre => [...pre, id])
}

Or you can use this (it's in old javascript way):

const [list,setList]=useState([])

const addList=(id)=>{
    let newList = list
    newList.push(id)
    setList(newList)
}

First you need to add an element not override the whole array with another one. Second in react useState variable you should use the previous value to update the new array. You can't use the list itself. Try this:

const [list,setList]=useState([])

const addList=(id)=>{
    setList(pre => [...pre, id])
}

Or you can use this (it's in old javascript way):

const [list,setList]=useState([])

const addList=(id)=>{
    let newList = list
    newList.push(id)
    setList(newList)
}

在React对象中添加数据

流星番茄 2025-02-20 01:38:51

What your are looking for is Delphi IDE Colorizer that allows changing colors of almost every part of Delphi IDE. In fact as far as I know it is much more powerful than Dark Mode that has been made available in Delphi 10.2.

XE2的黑暗主题

流星番茄 2025-02-19 18:28:45

我相信您的目标如下。

  • 在显示样品电子表格中,您想知道检查复选框还是未选中。
  • 中说,今天我想搜索日期2022-03-30(下图中的标记号码),然后检索下面的值,以查看复选框是否勾选,,在这种情况下,您要检查是否检查了“ T12”的复选框。
  • 您想使用Google Apps脚本来实现此目标。

在这种情况下,以下示例脚本怎么样?

示例脚本:

请将以下脚本复制到电子表格的脚本编辑器。并且,请设置表名称,然后保存脚本。

function myFunction() {
  const sheetName = "Sheet1"; // Please set your sheet name.
  const oneMonth = { cols: 7, rows: 14 }; // Number of columns and rows of 1 month.
  const calendar = { cols: 4, rows: 3 }; // Order of months in your calendar.
  const spaceCol = 1; // I found an empty column between each month.
  const today = new Date(); // This is today date.

  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName);
  const months = [...Array(calendar.rows)].flatMap((_, i) => [...Array(calendar.cols)].map((_, j) => sheet.getRange(i * oneMonth.rows + 1, j * oneMonth.cols + 1 + j * spaceCol, oneMonth.rows, oneMonth.cols)));
  const res = months[today.getMonth()].createTextFinder(today.getDate()).findNext().offset(1, 0).isChecked();
  console.log(res) // You can see "true" or "false" in the log.
}
  • 当该脚本运行时,如果是今天(2022-07-05),则检索“ S20”的复选框。
  • 为了在一个月内搜索一天,我使用了TextFinder。

注意:

  • 此示例脚本适用于您提供的电子表格。因此,当您更改电子表格时,此脚本可能无法使用。 注意

  • 。 a>

I believe your goal is as follows.

  • In your showing sample Spreadsheet, you want to know whether the checkbox is checked or unchecked.
  • From let's say that today i want to search for the date 2022-03-30 (the marked number on the picture below) and retrieve the value underneath to see if the checkbox is ticked or not,, in this case, you want to check whether the checkbox of "T12" is checked.
  • You want to achieve this using Google Apps Script.

In this case, how about the following sample script?

Sample script:

Please copy and paste the following script to the script editor of Spreadsheet. And, please set the sheet name, and save the script.

function myFunction() {
  const sheetName = "Sheet1"; // Please set your sheet name.
  const oneMonth = { cols: 7, rows: 14 }; // Number of columns and rows of 1 month.
  const calendar = { cols: 4, rows: 3 }; // Order of months in your calendar.
  const spaceCol = 1; // I found an empty column between each month.
  const today = new Date(); // This is today date.

  const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName(sheetName);
  const months = [...Array(calendar.rows)].flatMap((_, i) => [...Array(calendar.cols)].map((_, j) => sheet.getRange(i * oneMonth.rows + 1, j * oneMonth.cols + 1 + j * spaceCol, oneMonth.rows, oneMonth.cols)));
  const res = months[today.getMonth()].createTextFinder(today.getDate()).findNext().offset(1, 0).isChecked();
  console.log(res) // You can see "true" or "false" in the log.
}
  • When this script is run, in the case of today (2022-07-05), the checkbox of "S20" is retrieved.
  • In order to search the day in a month, I used TextFinder.

Note:

  • This sample script is for your provided Spreadsheet. So, when you change your Spreadsheet, this script might not be able to be used. Please be careful about this.

Reference:

Google表格 - 在范围内搜索日期并在下面返回值?

流星番茄 2025-02-19 17:27:55

我认为这个问题尚未解决。
但是有一些建议的解决方案可以解决这个问题,
检查此帖子:
直接通过Selenium 按“ F12”键

I think this problem hasn't been solved yet.
but there are some suggested solutions to go around this,
Check this post:
Pressing "F12" key directly through Selenium

python硒函数键ernat(F5或F12)

流星番茄 2025-02-19 17:05:16

好吧,答案似乎很容易,我误解了一些东西。

我认为有必要宣布像

const exampleArray = {
    key1: "value1",
    key2: "value2"
}

JSON.Stringify(exkplearray)结果的数组;看起来好像

{
     "key1": "value1",
     "key2": "value2"
}

,但似乎确实

const key1 = "value1";
const key2 = "value2";
const exampleArray = {
      key1,
      key2,
}

返回了相同的结果...

所以我的代码,匹配的react/毁灭性分配终于看起来很

const { userName, userRoles } = this.state;
const roles = userRoles;
putData('api/User/EditUserRoles', { userName, roles }).then((result) => {
  const responseJson = result;
  if (responseJson) {
    this.setState({ msg: "User's roles updated successfully!" });
  }
});

感谢您的答案...尤其是pavlo demydiuk ^^

Well the answer seems pretty easy and i misunderstood something.

I thought it's necessary to declare an array like

const exampleArray = {
    key1: "value1",
    key2: "value2"
}

that the result of JSON.stringify(exampleArray); looks like

{
     "key1": "value1",
     "key2": "value2"
}

but it seems like that

const key1 = "value1";
const key2 = "value2";
const exampleArray = {
      key1,
      key2,
}

does return the the same result...

so my code, matching react/destructuring-assignment finally looks like

const { userName, userRoles } = this.state;
const roles = userRoles;
putData('api/User/EditUserRoles', { userName, roles }).then((result) => {
  const responseJson = result;
  if (responseJson) {
    this.setState({ msg: "User's roles updated successfully!" });
  }
});

Thank you for your answers... especially Pavlo Demydiuk ^^

通过考虑反应/破坏性分配来定义状态子阵列的最佳方法

流星番茄 2025-02-19 09:55:43

我想我发现了错误。

我错过了这个:

group_by(Month, **Year**) %>%

I think I spotted the error.

I was missing this:

group_by(Month, **Year**) %>%

ggplot2中的过滤和计算平均值

流星番茄 2025-02-18 19:39:30

取决于您要实现的目标:

  1. 如果您想使用真正的浏览器来重播记录的动作mbopgmdnpcbohhpnfglgohlbhfongabi?hl = en“ rel =“ nofollow noreferrer”> jmeter chrome扩展,它可以录制“仅浏览器”动作,以后可以使用 selenium taurus 框架
  2. 如果您想使用 框架, http request 带有自动检测和相关性的动态参数 blazemeter proxy recorder 在SmartJMX模式下录制的脚本。请参阅如何将jmeter脚本时间缩短80%< /a>文章以获取更多详细信息。

Depending on what you're trying to achieve:

  1. If you want to use real browser for replaying recorded actions you can check out JMeter Chrome Extension, it can record "browser only" actions which can later be replayed using Selenium executor of Taurus framework
  2. If you want to use HTTP Request samplers with automatic detection and correlation of the dynamic parameters check out BlazeMeter Proxy Recorder which is capable of exporting recorded scripts in SmartJMX mode. See How to Cut Your JMeter Scripting Time by 80% article for more details.

在jmeter中录制脚本不需要相关。就像LoadRunner中的Truclient

流星番茄 2025-02-18 19:01:38

当表单提交和查看返回响应页面将重新加载同一页面并再次致电帖子时,我使用

  1. 创建新路线进行修复,但呈现同一页面(如果您想呈现同一页面)
  2. 更改API返回返回httpresponserectirect( 'url new')
    审查:
def CartAddView(request):
cart = Cart(request)
if request.POST.get('action') == 'post':
    product_id = int(request.POST.get('productid'))
    product = get_object_or_404(Product, id=product_id)
    cart.add(product=product)
    response =JsonResponse({
        'price': product.price,
        'id': product.id, (here the id returned is always the id of the last element printed by the loop)
    })
    return HttpResponseRedirect('url')

when form submit and view return response page will reload the same page and call POST again, I fixed it with

  1. create a new route but render the same page (if you want to render the same page)
  2. change API return return HttpResponseRedirect('url-new')
    examaple:
def CartAddView(request):
cart = Cart(request)
if request.POST.get('action') == 'post':
    product_id = int(request.POST.get('productid'))
    product = get_object_or_404(Product, id=product_id)
    cart.add(product=product)
    response =JsonResponse({
        'price': product.price,
        'id': product.id, (here the id returned is always the id of the last element printed by the loop)
    })
    return HttpResponseRedirect('url')

django ajax向视图发布重复值

流星番茄 2025-02-18 11:37:28

由于您的电子应用程序将以不同的目录构建,因此您的用户在其选择的任何OS上的任何目录中的任何驱动器上运行,对文件路径的引用必须是相对的(不是绝对)。

以下是您的&lt; link&gt; href 的示例,取决于典型的目录结构。

示例1

平面渲染过程目录结构。

Project Root
 ├── src
 |   ├── main-process
 |   └── render-process
 |       ├── index.html
 |       ├── c5c3959c04004102ea46.woff2
 |       └── 535bc89d4af715503b01.woff2
 └── package.json

index.html (渲染过程)

<link rel="preload" href="c5c3959c04004102ea46.woff2" as="font" crossorigin="anonymous" />
<link rel="preload" href="535bc89d4af715503b01.woff2" as="font" crossorigin="anonymous" />

示例2

向下渲染过程目录结构。

Project Root
 ├── src
 |   ├── main-process
 |   └── render-process
 |       ├── index.html
 |       └── fonts
 |           ├── c5c3959c04004102ea46.woff2
 |           └── 535bc89d4af715503b01.woff2
 └── package.json

index.html (渲染过程)

<link rel="preload" href="fonts/c5c3959c04004102ea46.woff2" as="font" crossorigin="anonymous" />
<link rel="preload" href="fonts/535bc89d4af715503b01.woff2" as="font" crossorigin="anonymous" />

示例3

up/down 渲染过程目录结构。

注意使用 ../

这会使您提高一个文件夹级别。

html (文件夹) - &gt;到 Render-Process (文件夹)。

Project Root
 ├── src
 |   ├── main-process
 |   └── render-process
 |       ├── html
 |       |   └── index.html
 |       └── fonts
 |           ├── c5c3959c04004102ea46.woff2
 |           └── 535bc89d4af715503b01.woff2
 └── package.json

index.html (渲染过程)

<link rel="preload" href="../fonts/c5c3959c04004102ea46.woff2" as="font" crossorigin="anonymous" />
<link rel="preload" href="../fonts/535bc89d4af715503b01.woff2" as="font" crossorigin="anonymous" />

示例4

更深的上/下渲染过程目录结构。

注意使用 ../../

这使您提高两个文件夹级别。

main (文件夹) - &gt;到 HTML (文件夹) - &gt;到 Render-Process (文件夹)。

Project Root
 ├── src
 |   ├── main-process
 |   └── render-process
 |       ├── html
 |       |   └── main
 |       |       └── index.html
 |       └── css
 |           └── fonts
 |               ├── c5c3959c04004102ea46.woff2
 |               └── 535bc89d4af715503b01.woff2
 └── package.json

index.html (渲染过程)

<link rel="preload" href="../../css/fonts/c5c3959c04004102ea46.woff2" as="font" crossorigin="anonymous" />
<link rel="preload" href="../../css/fonts/535bc89d4af715503b01.woff2" as="font" crossorigin="anonymous" />

As your Electron application will be built in a different directory, run by your user(s) on any drive in any directory on any OS of their choosing, reference to file paths must be relative (not absolute).

Below are examples of what your <link> href would look like depending on a typical directory structure.

Example 1

Flat render-process directory structure.

Project Root
 ├── src
 |   ├── main-process
 |   └── render-process
 |       ├── index.html
 |       ├── c5c3959c04004102ea46.woff2
 |       └── 535bc89d4af715503b01.woff2
 └── package.json

index.html (render process)

<link rel="preload" href="c5c3959c04004102ea46.woff2" as="font" crossorigin="anonymous" />
<link rel="preload" href="535bc89d4af715503b01.woff2" as="font" crossorigin="anonymous" />

Example 2

Downwards render-process directory structure.

Project Root
 ├── src
 |   ├── main-process
 |   └── render-process
 |       ├── index.html
 |       └── fonts
 |           ├── c5c3959c04004102ea46.woff2
 |           └── 535bc89d4af715503b01.woff2
 └── package.json

index.html (render process)

<link rel="preload" href="fonts/c5c3959c04004102ea46.woff2" as="font" crossorigin="anonymous" />
<link rel="preload" href="fonts/535bc89d4af715503b01.woff2" as="font" crossorigin="anonymous" />

Example 3

Up / down render-process directory structure.

Note use of the ../

This moves you up one folder level.

Up from html (folder) -> to render-process (folder).

Project Root
 ├── src
 |   ├── main-process
 |   └── render-process
 |       ├── html
 |       |   └── index.html
 |       └── fonts
 |           ├── c5c3959c04004102ea46.woff2
 |           └── 535bc89d4af715503b01.woff2
 └── package.json

index.html (render process)

<link rel="preload" href="../fonts/c5c3959c04004102ea46.woff2" as="font" crossorigin="anonymous" />
<link rel="preload" href="../fonts/535bc89d4af715503b01.woff2" as="font" crossorigin="anonymous" />

Example 4

An even deeper up / down render-process directory structure.

Note use of the ../../

This moves you up two folder levels.

Up from main (folder) -> to html (folder) -> to render-process (folder).

Project Root
 ├── src
 |   ├── main-process
 |   └── render-process
 |       ├── html
 |       |   └── main
 |       |       └── index.html
 |       └── css
 |           └── fonts
 |               ├── c5c3959c04004102ea46.woff2
 |               └── 535bc89d4af715503b01.woff2
 └── package.json

index.html (render process)

<link rel="preload" href="../../css/fonts/c5c3959c04004102ea46.woff2" as="font" crossorigin="anonymous" />
<link rel="preload" href="../../css/fonts/535bc89d4af715503b01.woff2" as="font" crossorigin="anonymous" />

如何在电子/React应用程序中预加载字体?

流星番茄 2025-02-18 11:20:35

示例

<angular2-multiselect [data]="itemList" [(ngModel)]="selectedItems" [settings]="settings" (onSelect)="onItemSelect($event)" (onDeSelect)="OnItemDeSelect($event)"  (onSelectAll)="onSelectAll($event)" (onDeSelectAll)="onDeSelectAll($event)">
<c-badge>
<ng-template let-item="item">
    <label style="margin: 0px;" [style.backgroundColor]="item.color">{{item.itemName}}</label>
</ng-template>
</c-badge>
</angular2-multiselect>

您可以在其中使用模板 ://stackblitz.com/edit/angular2-multiselect-dropdown-sdyehz?file = src%2fapp%2fapp%2fapp.component.html“ rel =“ nofollow noreferrer”> demo

You can use there templating example something like

<angular2-multiselect [data]="itemList" [(ngModel)]="selectedItems" [settings]="settings" (onSelect)="onItemSelect($event)" (onDeSelect)="OnItemDeSelect($event)"  (onSelectAll)="onSelectAll($event)" (onDeSelectAll)="onDeSelectAll($event)">
<c-badge>
<ng-template let-item="item">
    <label style="margin: 0px;" [style.backgroundColor]="item.color">{{item.itemName}}</label>
</ng-template>
</c-badge>
</angular2-multiselect>

Demo

无法根据Angular2-Multiselect-Dropdown中的ItemName自定义背景颜色

流星番茄 2025-02-17 22:48:25

您应该实现 sup> [Wiki] ,因此返回重定向,以使浏览器将在下一步提出Get请求,从而阻止在刷新页面时提出另一个邮政请求:

def product_detail(request, product_id):
product = get_object_or_404(Product, pk=product_id)
if request.method == 'POST':
rating = request.POST.get('rating', 3)
content = request.POST.get('content', '')
Review.objects.create(
product=product,
rating=rating,
content=content,
created_by=request.user
)
# redirect to the same page

You should implement the Post/Redirect/Get architectural pattern [wiki], and thus return a redirect such that the browser will make a GET request next, and thus prevent making another POST request when refreshing the page:

def product_detail(request, product_id):
    product = get_object_or_404(Product, pk=product_id)
    if request.method == 'POST':
        rating = request.POST.get('rating', 3)
        content = request.POST.get('content', '')
        Review.objects.create(
            product=product,
            rating=rating,
            content=content,
            created_by=request.user
        )
        # redirect to the same page 🖟
        return redirect('product_detail', product_id=product_id)

    reviews = Review.objects.filter(product=product)
    context = {
        'product': product,
        'reviews': reviews
    }
    return render(request, 'products/product_detail.html', context)

刷新django之后的双职位

流星番茄 2025-02-17 16:28:53

您可以将该服务帐户的秘密固定为POD内部,并设置一个环境变量“ export google_application_credentials =” POD /部署定义中的POD内部的秘密路径。

You mount that Service Account secret as volumeMount inside the pod and set an Environment Variable "export GOOGLE_APPLICATION_CREDENTIALS="path to secret inside the pod" in pod /deployment definition.

从Tekton Pipeline身份验证私人Google Cloud trifact注册表

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文