十六岁半

文章 评论 浏览 28

十六岁半 2025-02-20 05:49:21

这是演员和转换的示例:

using System;

public T CastObject<T>(object input)
{   
    return (T) input;   
}

public T ConvertObject<T>(object input) 
{
    return (T) Convert.ChangeType(input, typeof(T));
}

Here is an example of a cast and a convert:

using System;

public T CastObject<T>(object input)
{   
    return (T) input;   
}

public T ConvertObject<T>(object input) 
{
    return (T) Convert.ChangeType(input, typeof(T));
}

使用类型对象或字符串类型铸造

十六岁半 2025-02-20 05:47:27

可能不需要循环,但是使用dplyr:它似乎可以很好地工作。

library(dplyr)

counter <- function(id, row) {
  count_up <- case_when(
    id != lag(id) ~ TRUE,
    id == lag(id, n = 2L) & row %% 2 == 0 ~ FALSE,
    id == lag(id, n = 2L) ~ TRUE,
    TRUE ~ FALSE
  )
  
  n <- 1
  
  output <- vector(mode = "integer", length = length(id))
  
  for (i in seq_along(count_up)) {
    if (count_up[i]) {
      n <- n + 1
      } 
    output[i] <- n
  }
  output
}

df |> 
  group_by(Current_Record_ID) |> 
  mutate(row = row_number()) |> 
  ungroup() |> 
  mutate(New_Record_ID = counter(Current_Record_ID, row)) |> 
  select(-row)

# A tibble: 20 × 3
   Stores Current_Record_ID New_Record_ID
    <dbl>             <dbl>         <dbl>
 1      1                 1             1
 2      2                 1             1
 3      3                 2             2
 4      4                 3             3
 5      5                 3             3
 6      6                 3             4
 7      7                 4             5
 8      8                 4             5
 9      9                 4             6
10     10                 4             6
11     11                 4             7
12     12                 4             7
13     13                 4             8
14     14                 5             9
15     15                 5             9
16     16                 6            10
17     17                 7            11
18     18                 7            11
19     19                 7            12
20     20                 8            13

There may be no need for a for loop, but it seems to work well enough, using dplyr:

library(dplyr)

counter <- function(id, row) {
  count_up <- case_when(
    id != lag(id) ~ TRUE,
    id == lag(id, n = 2L) & row %% 2 == 0 ~ FALSE,
    id == lag(id, n = 2L) ~ TRUE,
    TRUE ~ FALSE
  )
  
  n <- 1
  
  output <- vector(mode = "integer", length = length(id))
  
  for (i in seq_along(count_up)) {
    if (count_up[i]) {
      n <- n + 1
      } 
    output[i] <- n
  }
  output
}

df |> 
  group_by(Current_Record_ID) |> 
  mutate(row = row_number()) |> 
  ungroup() |> 
  mutate(New_Record_ID = counter(Current_Record_ID, row)) |> 
  select(-row)

# A tibble: 20 × 3
   Stores Current_Record_ID New_Record_ID
    <dbl>             <dbl>         <dbl>
 1      1                 1             1
 2      2                 1             1
 3      3                 2             2
 4      4                 3             3
 5      5                 3             3
 6      6                 3             4
 7      7                 4             5
 8      8                 4             5
 9      9                 4             6
10     10                 4             6
11     11                 4             7
12     12                 4             7
13     13                 4             8
14     14                 5             9
15     15                 5             9
16     16                 6            10
17     17                 7            11
18     18                 7            11
19     19                 7            12
20     20                 8            13

我们可以通过分组列构建R函数/逻辑以获取记录ID

十六岁半 2025-02-20 02:15:46

您需要执行此操作:

在父标签中创建一个结构,将CSS代码应用于生成多边形。

需要在需要集中元素后,

<style>

#box{ display:flex;width:100vw;height:100vh;flex-direction:row;align-items:center;justify-content:center;background:#ddd;}
#left{ height: 300px; width: 40%; background:#333;display:flex;position:absolute;left:0;clip-path: polygon(0% 0%, 100% 0, 85% 55%, 74% 100%, 0% 100%);}
#right{height: 300px; width: 40%; background:#666;display:flex;position:absolute;right:0;clip-path: polygon(25% 0, 100% 0%, 100% 100%, 0 100%, 13% 48%);}

</style>

    <div id="box"> 
        <div id="left"> 
        </div>
        <div id="right"> 
        </div>
    </div>

You need do this:

Create a structure in the parent tag

After you need centralize the elements, apply the css code for generate a polygon.

<style>

#box{ display:flex;width:100vw;height:100vh;flex-direction:row;align-items:center;justify-content:center;background:#ddd;}
#left{ height: 300px; width: 40%; background:#333;display:flex;position:absolute;left:0;clip-path: polygon(0% 0%, 100% 0, 85% 55%, 74% 100%, 0% 100%);}
#right{height: 300px; width: 40%; background:#666;display:flex;position:absolute;right:0;clip-path: polygon(25% 0, 100% 0%, 100% 100%, 0 100%, 13% 48%);}

</style>

    <div id="box"> 
        <div id="left"> 
        </div>
        <div id="right"> 
        </div>
    </div>

如何在CSS中制作Div曲线的1侧

十六岁半 2025-02-19 19:09:26

另一个可能的解决方案:

library(dplyr)

dta %>% 
  mutate(t(apply(.[-1], 1, \(x) {if (max(x, na.rm = T) == 1) 
    x[which.max(x):length(x)] <- 1 else x; x})) %>% as_tibble)

#>   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

Another possible solution:

library(dplyr)

dta %>% 
  mutate(t(apply(.[-1], 1, \(x) {if (max(x, na.rm = T) == 1) 
    x[which.max(x):length(x)] <- 1 else x; x})) %>% as_tibble)

#>   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

从一列到下一个给定条件的复制值

十六岁半 2025-02-19 17:13:02

有一个带有C ++模板的干净解决方案,而无需使用sizeof。以下getsize()函数返回任何静态数组的大小:

#include <cstddef>

template<typename T, std::size_t SIZE>
constexpr std::size_t getSize(T (&)[SIZE]) {
    return SIZE;
}

这是一个带有 foo_t 结构的示例:

#include <cstddef>
#include <cstdio>

template<typename T, std::size_t SIZE>
constexpr std::size_t getSize(T (&)[SIZE]) {
    return SIZE;
}

struct foo_t {
    int ball;
};

int main()
{
    foo_t foos3[] = {{1},{2},{3}};
    foo_t foos5[] = {{1},{2},{3},{4},{5}};
    std::printf("%u\n", getSize(foos3));
    std::printf("%u\n", getSize(foos5));
}

输出:输出:

3
5

There is a clean solution with C++ templates, without using sizeof. The following getSize() function returns the size of any static array:

#include <cstddef>

template<typename T, std::size_t SIZE>
constexpr std::size_t getSize(T (&)[SIZE]) {
    return SIZE;
}

Here is an example with a foo_t structure:

#include <cstddef>
#include <cstdio>

template<typename T, std::size_t SIZE>
constexpr std::size_t getSize(T (&)[SIZE]) {
    return SIZE;
}

struct foo_t {
    int ball;
};

int main()
{
    foo_t foos3[] = {{1},{2},{3}};
    foo_t foos5[] = {{1},{2},{3},{4},{5}};
    std::printf("%u\n", getSize(foos3));
    std::printf("%u\n", getSize(foos5));
}

Output:

3
5

如何找到数组的大小(从指向第一个元素数组的指针)?

十六岁半 2025-02-19 08:56:49

就我而言,错误是在SSL证书状态中。
我尝试了Postman的请求并收到警告,该DE SSL证书是不可能的。 “无法验证第一个证书”

更改为使用SSL正确验证并起作用的另一个域。

In my case the error was in SSL certificate status.
I tried request from postman and receive an warning, that de SSL Certificate is unabled to verify. "Unable to verify the first certificate"

Change to another domain with SSL correctly verified and works.

Elementor表格:“发生错误”当我使用自定义Webhook URL时

十六岁半 2025-02-18 13:58:45

Permanently modify the timezone of mysql in a Docker container

Valid for mysql docker image 5.7 ~ latest

Enter the docker image that has run successfully

docker exec -it mysql bash

View the database time zone configuration:

show variables like'%time_zone';

View database time zone results:

mysql> show variables like "%time_zone";
+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| system_time_zone | UTC    |
| time_zone        | SYSTEM |
+------------------+--------+

View the database character set configuration:

SHOW VARIABLES LIKE 'character%';

View database character set results:

mysql> SHOW VARIABLES LIKE 'character%';
+--------------------------+--------------------------------+
| Variable_name            | Value                          |
+--------------------------+--------------------------------+
| character_set_client     | latin1                         |
| character_set_connection | latin1                         |
| character_set_database   | latin1                         |
| character_set_filesystem | binary                         |
| character_set_results    | latin1                         |
| character_set_server     | latin1                         |
| character_set_system     | utf8                           |
| character_sets_dir       | /usr/share/mysql-8.0/charsets/ |
+--------------------------+--------------------------------+

Upgrade the apt package management tool (reason: you cannot download vim without upgrading)

apt-get update

Download vim after apt upgrade is complete

apt-get install vim

If vim modifies the docker.cnf or mysqld.cnf image file, it will take effect 。您可以修改其中任何一个。

vim /etc/mysql/conf.d/docker.cnf

OR:

vim /etc/mysql/conf.d/mysql.cnf

The default display in the file (the following are all taking docker.cnf as an example):

[mysqld]
skip-host-cache
skip-name-resolve

Add time zone configuration: Dongba District (China)

[mysqld]
default-time_zone = '+8:00'

Increase database server utf8 character set configuration

[mysqld]
character_set_server=utf8

Increase database client utf8 character set configuration

[client]
default-character-set=utf8

After the addition is completed, it will be displayed as:

[mysqld]
skip-host-cache
skip-name-resolve
default-time_zone = '+8:00'
character_set_server=utf8

[client]
default-character-set=utf8

After the configuration is saved, restart the database (valid for 5.7)

service mysql restart

**It is recommended to exit the container and restart the container directly (because you still need to start the image after restarting mysql, it is better to exit the container and restart the image directly)

docker restart mysql

Enter docker image mysql again to see if the modification is successful

Time zone view:

show variables like "%time_zone";

time zone view results:

mysql> show variables like "%time_zone";
+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| system_time_zone | UTC    |
| time_zone        | +08:00 |
+------------------+--------+

Character set view:

SHOW VARIABLES LIKE 'character%';

Character set view result:

mysql> SHOW VARIABLES LIKE 'character%';
+--------------------------+--------------------------------+
| Variable_name            | Value                          |
+--------------------------+--------------------------------+
| character_set_client     | utf8mb3                        |
| character_set_connection | utf8mb3                        |
| character_set_database   | utf8mb3                        |
| character_set_filesystem | binary                         |
| character_set_results    | utf8mb3                        |
| character_set_server     | utf8mb3                        |
| character_set_system     | utf8mb3                        |
| character_sets_dir       | /usr/share/mysql-8.0/charsets/ |
+--------------------------+--------------------------------+

Permanently modify the timezone of mysql in a Docker container

Valid for mysql docker image 5.7 ~ latest

Enter the docker image that has run successfully

docker exec -it mysql bash

View the database time zone configuration:

show variables like'%time_zone';

View database time zone results:

mysql> show variables like "%time_zone";
+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| system_time_zone | UTC    |
| time_zone        | SYSTEM |
+------------------+--------+

View the database character set configuration:

SHOW VARIABLES LIKE 'character%';

View database character set results:

mysql> SHOW VARIABLES LIKE 'character%';
+--------------------------+--------------------------------+
| Variable_name            | Value                          |
+--------------------------+--------------------------------+
| character_set_client     | latin1                         |
| character_set_connection | latin1                         |
| character_set_database   | latin1                         |
| character_set_filesystem | binary                         |
| character_set_results    | latin1                         |
| character_set_server     | latin1                         |
| character_set_system     | utf8                           |
| character_sets_dir       | /usr/share/mysql-8.0/charsets/ |
+--------------------------+--------------------------------+

Upgrade the apt package management tool (reason: you cannot download vim without upgrading)

apt-get update

Download vim after apt upgrade is complete

apt-get install vim

If vim modifies the docker.cnf or mysqld.cnf image file, it will take effect. You can modify any one of them.

vim /etc/mysql/conf.d/docker.cnf

OR:

vim /etc/mysql/conf.d/mysql.cnf

The default display in the file (the following are all taking docker.cnf as an example):

[mysqld]
skip-host-cache
skip-name-resolve

Add time zone configuration: Dongba District (China)

[mysqld]
default-time_zone = '+8:00'

Increase database server utf8 character set configuration

[mysqld]
character_set_server=utf8

Increase database client utf8 character set configuration

[client]
default-character-set=utf8

After the addition is completed, it will be displayed as:

[mysqld]
skip-host-cache
skip-name-resolve
default-time_zone = '+8:00'
character_set_server=utf8

[client]
default-character-set=utf8

After the configuration is saved, restart the database (valid for 5.7)

service mysql restart

**It is recommended to exit the container and restart the container directly (because you still need to start the image after restarting mysql, it is better to exit the container and restart the image directly)

docker restart mysql

Enter docker image mysql again to see if the modification is successful

Time zone view:

show variables like "%time_zone";

time zone view results:

mysql> show variables like "%time_zone";
+------------------+--------+
| Variable_name    | Value  |
+------------------+--------+
| system_time_zone | UTC    |
| time_zone        | +08:00 |
+------------------+--------+

Character set view:

SHOW VARIABLES LIKE 'character%';

Character set view result:

mysql> SHOW VARIABLES LIKE 'character%';
+--------------------------+--------------------------------+
| Variable_name            | Value                          |
+--------------------------+--------------------------------+
| character_set_client     | utf8mb3                        |
| character_set_connection | utf8mb3                        |
| character_set_database   | utf8mb3                        |
| character_set_filesystem | binary                         |
| character_set_results    | utf8mb3                        |
| character_set_server     | utf8mb3                        |
| character_set_system     | utf8mb3                        |
| character_sets_dir       | /usr/share/mysql-8.0/charsets/ |
+--------------------------+--------------------------------+

在文件模式下修改Docker Image MySQL的时区和字符集

十六岁半 2025-02-18 08:50:07

1。对于其他许多人来说,这是第一个绊脚石

,我与异步电话的相遇起初令人困惑。
我不记得细节,但我可能尝试了类似的事情:

let result;

$.ajax({
  url: 'https://jsonplaceholder.typicode.com/todos/1',
  success: function (response) {
    console.log('\nInside $.ajax:');
    console.log(response);
    result = response;
  },
});

console.log('Finally, the result: ' + result);
.as-console-wrapper { max-height: 100% !important; top: 0; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

whops!
线的输出
console.log('最后,结果:' +结果);
我认为将在另一个输出之前打印出上次
- 并且它不包含结果:它只是打印未定义的1
怎么会?

一个有用的见解,

我清楚地记得我的第一个 aha

1. A first stumbling step

As for many others, my encounter with asynchronous calls was puzzling at first.
I don't remember the details, but I may have tried something like:

let result;

$.ajax({
  url: 'https://jsonplaceholder.typicode.com/todos/1',
  success: function (response) {
    console.log('\nInside $.ajax:');
    console.log(response);
    result = response;
  },
});

console.log('Finally, the result: ' + result);
.as-console-wrapper { max-height: 100% !important; top: 0; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>

Whoops!
The output of the line
console.log('Finally, the result: ' + result);
which I thought would be printed last, is printed before the other output!
– And it doesn't contain the result: it just prints undefined. 1
How come?

A helpful insight

I distinctly remember my first aha (????) moment about asynchronous calls.
It was :

you actually don't want to get the data out of a callback; you want to get your data-needing action into the callback!
2

This is true in the example above.

2. Plain JavaScript and a callback function

Luckily, it is possible to write code after the asynchronous call that deals with the response once it has completed.

One alternative is the use of a callback function in a continuation-passing style :
3

const url = 'https://jsonplaceholder.typicode.com/todos/2';

function asynchronousFunc(callback) {
  const request = new XMLHttpRequest();
  request.open('GET', url);
  request.send();
  request.onload = function () {
    if (request.readyState === request.DONE) {
      console.log('The request is done. Now calling back.');
      callback(request.responseText);
    }
  };
}

asynchronousFunc(function (result) {
  console.log('This is the start of the callback function. Result:');
  console.log(result);
  console.log('The callback function finishes on this line. THE END!');
});

console.log('LAST in the code, but executed FIRST!');
.as-console-wrapper { max-height: 100% !important; top: 0; }

Note how the function asynchronousFunc is void. It returns nothing.
asynchronousFunc is called with an anonymous callback function,
(asynchronousFunc(function (result) {...});).
This executes the desired actions on the result after the request has completed – when the responseText is available.

Running the above snippet shows how I will probably not want to write any code after the asynchronous call (such as the line
LAST in the code, but executed FIRST!).
Why? – Because such code will run before the asynchronous call delivers any response data.
Doing so is bound to cause confusion when comparing the code with the output.

3. Promise with .then()

The .then() construct was introduced in the ECMA-262 6th Edition in June 2015.
The code below is plain JavaScript, replacing the old-school XMLHttpRequest with Fetch. 4

fetch('https://api.chucknorris.io/jokes/random')
  .then((response) => response.json())
  .then((responseBody) => {
    console.log('Using .then() :');
    console.log(responseBody.value + '\n');
  });
.as-console-wrapper { max-height: 100% !important; top: 0; }

4. Promise with async/await

The async/await construct was introduced in the ECMA-262 8th Edition in June 2017.

async function awaitAndReceivePromise() {
  const responseBody = (
    await fetch('https://api.quotable.io/quotes/random')
  ).json();
  console.log('Using async/await:');
  const obj = (await responseBody)[0];
  console.log('"' + obj.content + '" – ' + obj.author + '\n');
}

awaitAndReceivePromise();
.as-console-wrapper { max-height: 100% !important; top: 0; }

A word of warning is warranted if you decide to go with the async/await construct.
Note in the above snippet how await is needed in two places.
If forgotten in the first place, there will be no output at all.
If forgotten in the second place, the only output will be Using async/await: – nothing else gets printed.
Forgetting the async prefix of the function is maybe the worst of all – you'll get a "SyntaxError" – and likely no hint about the missing async keyword.


All the above examples succinctly convey how asynchronous calls may be used on toyish APIs. 5

References


1
Expressed by the asker of the question as they all return undefined.

2
Here is more on how asynchronous calls may be confusing at first.

3
Like the X in AJAX, the name XMLHttpRequest is misleading – it can be used to retrieve any type of data, not just XML.
These days, the data format of Web APIs is ubiquitously JSON, not XML.

4
Fetch returns a Promise.
I was surprised to learn that neither XMLHttpRequest nor Fetch are part of the ECMAScript standard.
The reason JavaScript can access them here is that the web browser provides them.
The Fetch Standard and the XMLHttpRequest Standard are both upheld by the Web Hypertext Application Technology Working Group which was formed in June 2004. \

5
You might also be interested in
How can I fetch an array of URLs with Promise.all?.

如何从异步电话中返回响应?

十六岁半 2025-02-17 19:56:20

我遇到了同样的例外,尽管在稍微不同的上下文中,试图设置泽西服务器时,看起来您正在在泽西 - 客户的设置中遇到这一点,但我怀疑这个问题是相同的。

就我而言,我使用的是泽西服务器2.28(org.glassfish.jersey.core:jersey-server:2.28),并追踪了类:org.glassfish.jersey.jersey.model.internal.internal.internal.commonconfig 来自Jersey-Common.jar(org.glassfish.jersey.core:jersey-common)。

看着我的班级路径中的罐子,我注意到Jersey-Common-3.1.0.jar已经进入了类路径,并相信这引起了问题。在删除了导致泽西 - 司令3.1.0被拉入班级路径的违法依赖之后,例外消失了。

我怀疑您正在使用泽西 - 客户版本:2.x,但在class path中有一个泽西 - 塞米式3.x罐子

I ran into the same exception, although in a slightly different context, when trying to set up a jersey-server, and looks like you are encountering this in the setup of jersey-client, but I suspect the issue is the same.

In my case, I was using jersey-server 2.28 (org.glassfish.jersey.core:jersey-server:2.28), and tracked down that the class: org.glassfish.jersey.model.internal.CommonConfig comes from the jersey-common.jar (org.glassfish.jersey.core:jersey-common).

Looking at the jars in my classpath I noticed that a jersey-common-3.1.0.jar had made it's way into the classpath and believe that was causing the issue. After removing the offending dependency that was causing jersey-common 3.1.0 to be pulled into the classpath, the exception went away.

I suspect you are using jersey-client version: 2.x but have a jersey-common 3.x jar in the classpath

java.lang.nosuchmethoderror:&#x27; void org.glassfish.jersey.model.internal.commonconfig。&lt; init

十六岁半 2025-02-17 03:33:02

CODESANDBOX已经警告过您。

CodeSandbox already warned you about that.

enter image description here

为什么一个简单的``usefeft''在扭曲“ setInterval/timeout”时不会采用更新值。里面

十六岁半 2025-02-17 01:55:07

您可以这样使用:
这就是错误来自新版本0.69.0和最后一个版本,您可以使用 npx React-nib init projectName -version 0.68.2
完成设置后,然后升级为v 0.69。

you can use like this :
That is error is from the new version 0.69.0 and last version , You can use npx react-native init ProjectName --version 0.68.2.
when finish setUp then upgrade to v 0.69.

当我使用COMAND“ NPX REACT-NITAGIT INIT SARFARAZ”安装React Antive应用程序时。

十六岁半 2025-02-17 00:59:03

考虑为每个计数使用一个子查询如下所示。

CREATE OR REPLACE TABLE TableC AS
SELECT (SELECT COUNT(id) FROM TableA) AS total,
       (SELECT COUNT(ref) FROM TableB) AS ref_total
;

输出:

”在此处输入图像描述“

但是日期范围是可选的。对于日期范围,我正在考虑将整个数据放在新表中,然后我可以在表C

上进行选择。

我认为您可以添加 date eftert 每个子查询的条款出于您的目的。

Consider using a subquery for each count like below.

CREATE OR REPLACE TABLE TableC AS
SELECT (SELECT COUNT(id) FROM TableA) AS total,
       (SELECT COUNT(ref) FROM TableB) AS ref_total
;

output:

enter image description here

But date range is something optional. For date range, I'm thinking to get whole data in new table then I can run select on table C

I think you can add date filter in WHERE clause of each subquery for your purpose.

使用多个表创建表

十六岁半 2025-02-16 20:54:28

解决了。

原来是log4shell工作,您需要一个脆弱的应用程序和易受伤害的Java版本;我以为我有,但是不。我有Java 11.0.15,并且需要Java 11(Ghidra需要Java 11的最小值,仅Java 11的弱势版本是第一个)。

下载并安装了Java 11,POC工作完美。

Solved it.

Turned out for log4shell to work you need a vulnerable app and a vulnerable version of Java; which I thought I had, but nope. I had Java 11.0.15, and needed Java 11 (Ghidra need Java 11 minimum, only vulnerable version of Java 11 is the first one).

Downloaded and installed Java 11, POC working perfectly.

log4shell POC:无HTTP重定向

十六岁半 2025-02-16 20:22:58

从文档看来,您应该这样使用它:

shouldDisableYear={(year) => singleYearsArray.includes(year)}

这将告诉选择器每年禁用单年列表中的每年。
请记住,作为回调中输入参数的“年”类型必须与列表中的年度类型相同。

From documentation it looks like you should use it like this:

shouldDisableYear={(year) => singleYearsArray.includes(year)}

This will tell the picker to disable each year which is contained in your singleYearsArray list.
Keep in mind that types of "year" as input paramter in callback must be the same as type of year in your list.

通过一年的材料材料和reactj中的一系列字符串禁用几年

十六岁半 2025-02-16 19:14:24

首先,我会将您的日期列和to_be_paid_date转换为dateTime,这样

df["to_be_paid_date"] = pd.to_datetime(df["to_be_paid_date"], format="%d-%m-%Y")
mortgage_amount_paid_date = datetime.strptime(mortgage_amount_paid_date,"%d-%m-%Y")

我就会用iterrows()在每一行上迭代,然后将to_be_be_paid_dateMortgage_amount_paid_date并从Mortgage_amount_paid中扣除您的Mortgage_Amount值,直到它达到零为止。

First I would convert your date column and to_be_paid_date to datetime like so

df["to_be_paid_date"] = pd.to_datetime(df["to_be_paid_date"], format="%d-%m-%Y")
mortgage_amount_paid_date = datetime.strptime(mortgage_amount_paid_date,"%d-%m-%Y")

Then I would iterate over each row with iterrows() and compare the to_be_paid_date with mortgage_amount_paid_date and deduct your mortgage_amount value in the row from mortgage_amount_paid until it hits zero.

python- pandas减去列中的列中的列值的值

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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