Questions tagged [percentage]

Percentage is a ratio or fraction of a quantity that shows the ratio from whole part of quantity. Percentage demonstrates how much is there out of 100.

The ratio or fraction from a quantity that consider out of 100 is called Percentage.

The Percentage is calculate by following formula:

percentage = (part of quantity * 100)/total quantity
2714 questions
271
votes
24 answers

How to make rounded percentages add up to 100%

Consider the four percentages below, represented as float numbers: 13.626332% 47.989636% 9.596008% 28.788024% ----------- 100.000000% I need to represent these percentages as whole numbers. If I simply use Math.round(), I end…
poezn
  • 4,009
  • 4
  • 25
  • 27
103
votes
1 answer

Height 100% on flexbox column child

I'm having troubles with a flexbox column in that children of the flex'd element don't respond to height in percentages. I've only checked this in Chrome, and from what I understand it's a Chrome only problem. Here's my example: HTML
CourtDemone
  • 5,772
  • 6
  • 23
  • 25
102
votes
10 answers

Translate X and Y percentage values based on elements height and width?

Translating an elements Y axis 50% will move it down 50% of its own height, not 50% of the parents height as I would expect. How do I tell a translating element to base it's translation percentage on the parent element? Or am I not understanding…
Andrew Tibbetts
  • 2,874
  • 3
  • 23
  • 28
84
votes
5 answers

Get frequency of item occurrences in a column as percentage

I want to get a percentage of a particular value in a df column. Say I have a df with (col1, col2 , col3, gender) gender column has values of M, F, or Other. I want to get the percentage of M, F, Other values in the df. I have tried this, which…
SANM2009
  • 1,918
  • 2
  • 12
  • 30
73
votes
2 answers

How do I calculate the percentage of a number?

I would like to calculate, in PHP, the percentage of a number. For example: $percentage = 50; $totalWidth = 350; For this example, 50% of 350 = 175 How can I do that?
John Smeuth
  • 805
  • 1
  • 7
  • 7
65
votes
13 answers

Calculate percentage Javascript

I have a question about javascript logic what I use to get percent of two inputs from my text fields. Here is my code: var pPos = $('#pointspossible').val(); var pEarned = $('#pointsgiven').val(); var perc = ((pEarned/pPos) *…
espresso_coffee
  • 5,980
  • 11
  • 83
  • 193
61
votes
7 answers

Format number as percent in MS SQL Server

I am trying to simply format a number as a percent with two decimal places. If it is 37 divided by 38 (aka .973684210526315789), I would like it to show 97.36 % in the SQL output. I know it is recommended to do formatting in the Application, however…
user3513237
  • 995
  • 3
  • 9
  • 26
53
votes
2 answers

Convert percent string to float in pandas read_csv

Is there a way to convert values like '34%' directly to int or float when using read_csv in pandas? I want '34%' to be directly read as 0.34 Using this in read_csv did not work: read_csv(..., dtype={'col':np.float}) After loading the csv as 'df'…
KieranPC
  • 8,525
  • 7
  • 22
  • 25
52
votes
5 answers

CSS3 Box shadow size – percent units?

I'm working on a project that needs to use CSS3 box-shadow property. That's fine, but I have found out that spread size of shadow can't be set to a percentage of parent object. I fully understand that box-shadow is not additive, thus it doesn't take…
Jozko Remen
  • 591
  • 1
  • 5
  • 5
45
votes
6 answers

video.js size to fit div

I have a video in a div with a 40% width. In the html, width="100%" height="auto" makes the video disappear. Setting a specific size in pixels won't fit the div. Leaving the html blank leaves the video the wrong size and with black bars on the…
user2671810
  • 451
  • 1
  • 4
  • 4
43
votes
4 answers

How do I print the percent sign(%) in C?

Why doesn't this program print the % sign? #include main() { printf("%"); getch(); }
Paul Filch
  • 867
  • 2
  • 7
  • 13
41
votes
2 answers

Summarizing by subgroup percentage in R

I have a dataset like this: df = data.frame(group = c(rep('A',4), rep('B',3)), subgroup = c('a', 'b', 'c', 'd', 'a', 'b', 'c'), value = c(1,4,2,1,1,2,3)) group | subgroup | value ------------------------ A | …
oliver13
  • 996
  • 2
  • 7
  • 19
38
votes
6 answers

How do I print a '%' sign using string formatting?

I've made a little script to calculator percent; however, I wish to actually include the % within the message printed... Tried this at the start - didn't work... oFile.write("Percentage: %s%"\n" % percent) I then tried "Percentage: %s"%"\n" %…
Eric1989
  • 619
  • 3
  • 9
  • 17
38
votes
1 answer

MySQL Calculate Percentage

I have a MySQL database with 4 items: id (numerical), group_name, employees, and surveys. In my SELECT I need to calculate the percentage of 'employees' who, by the number in 'surveys', have taken the survey. This is the statement I have…
user2232709
  • 383
  • 1
  • 3
  • 5
33
votes
6 answers

Percentage from Total SUM after GROUP BY SQL Server

I have these results: PersonID SUM(PA.Total) ------------------------- 1 75 2 75 3 15 4 15 5 60 6 60 With the table like: PersonID Total ------------------ …
Ryan Gadsdon
  • 2,272
  • 4
  • 31
  • 56
1
2 3
99 100