pytorch中计算百分比
If you can calculate percentages in Excel, it comes in handy. For example, you might need to calculate the tax on a sale, or the percentage of change in sales from last month to this month. Here’s how you do it!
如果您可以在Excel中计算百分比,它会派上用场。 例如,您可能需要计算销售税或上个月到本月销售变化的百分比。 这是您的操作方式!
计算增长百分比 (Calculate Percent Increase)
To get started, let’s calculate the increase of one value over another as a percentage.
首先,让我们计算一个值相对于另一个值的增加百分比。
In this example, we want to find the percentage of increase in the sales of a product this month compared to last month. In the image below, you can see last month’s value of 430 in cell B3, and this month’s sales of 545 in cell C3.
在此示例中,我们要查找本月产品销售与上个月相比增长的百分比。 在下图中,您可以看到单元格B3中上个月的值430,以及单元格C3中本月的销售额545。
To calculate the difference as a percentage, we subtract this month’s value from last month’s, and then divide the result by last month’s value.
为了计算差异百分比,我们从上个月的值中减去本月的值,然后将结果除以上月的值。
=(C3-B3)/B3
The brackets around the subtraction part of the formula ensure that calculation occurs first.
公式的减法部分周围的方括号可确保首先进行计算。
To format the result as a percentage, click the “Percent Style” button in the “Number” section on the Home tab.
要将结果格式化为百分比,请单击“主页”选项卡上“数字”部分中的“百分比样式”按钮。
We see the percentage of increase is 27 percent.
我们看到增长百分比是27%。
If the percentage is negative, it means the sales of the product have decreased.
如果百分比为负,则表示该产品的销量下降了。
将值增加特定百分比 (Increase a Value by a Specific Percent)
You can also increase a value by a specific percentage.
您还可以按特定百分比增加值。
In this example, we want to increase the price of a product by five percent. To do this, we can multiply the product price by 1.05. This is shown in the formula below:
在此示例中,我们希望将产品价格提高5%。 为此,我们可以将产品价格乘以1.05。 在下面的公式中显示:
=B3*1.05
Or we could write the formula as:
或者我们可以将公式写为:
=B3*105%
These formulas simply multiply the value by five percent more than the whole of itself (100 percent).
这些公式仅将值乘以自身值(100%)的百分之五。
As a result, a 20 percent increase would be multiplied by 120 percent, and a 15 percent increase would be 115 percent (or 1.15).
结果,将20%的增长乘以120%,将15%的增长乘以115%(或1.15)。
翻译自: https://www.howtogeek.com/435374/how-to-calculate-percent-increases-in-excel/
pytorch中计算百分比