Percentage from Total SUM after GROUP BY SQL Server

You don’t need a cross join. Just use window functions: SELECT P.PersonID, SUM(PA.Total), SUM(PA.Total) * 100.0 / SUM(SUM(PA.Total)) OVER () AS Percentage FROM Person P JOIN Package PA ON P.PersonID = PA.PackageFK GROUP BY P.PersonID; Note that you do not need the JOIN for this query: SELECT PA.PersonID, SUM(PA.Total), SUM(PA.Total) * 100.0 / SUM(SUM(PA.Total)) OVER … Read more

video.js size to fit div

In version 5 of videojs you can use vjs-16-9 vjs-4-3 class on video object, <video class=”video-js vjs-default-skin vjs-16-9″ …> … </video> or use fluid option <video class=”video-js vjs-default-skin” data-setup='{“fluid”: true}’ …> … </video> Source: https://coolestguidesontheplanet.com/videodrome/videojs/

Convert percent string to float in pandas read_csv

You were very close with your df attempt. Try changing: df[‘col’] = df[‘col’].astype(float) to: df[‘col’] = df[‘col’].str.rstrip(‘%’).astype(‘float’) / 100.0 # ^ use str funcs to elim ‘%’ ^ divide by 100 # could also be: .str[:-1].astype(… Pandas supports Python’s string processing functions on string columns. Just precede the string function you want with .str and … Read more

Format number as percent in MS SQL Server

In SQL Server 2012 and later, there is the FORMAT() function. You can pass it a ‘P’ parameter for percentage. For example: SELECT FORMAT((37.0/38.0),’P’) as [Percentage] — 97.37 % To support percentage decimal precision, you can use P0 for no decimals (whole-numbers) or P3 for 3 decimals (97.368%). SELECT FORMAT((37.0/38.0),’P0′) as [WholeNumberPercentage] — 97 % … Read more