Template talk:Historical populations

Merger proposal
I've created this template to combine the features of Template:USCensusPop and Template:Histpop, both excellent templates. I think it's preferable to have one template rather than two templates that do the same thing in slightly different ways. This template is very simple to use, and can easily substitute for either of the above templates. I also tried to streamline it to make it easier to modify, as well as improve its markup. It should be pretty extensible, and I welcome any comments/criticism.

Don't worry, I won't be mass-changing any templates already in use unless I can get a consensus that this template is suitable. If people are resistant, I'll be happy to delete this (or merge it into the other two). —Werson (talk) 01:48, 13 June 2008 (UTC)


 * If you somehow merge them, you'll need a template parameter that makes the years wikilink appropriately to US Census, but only sometimes... you wouldn't do it if the article isn't a US article, and you wouldn't do it if it is a US article but the year isn't an official census year. How do you plan on doing that? Timneu22 (talk) 11:00, 13 June 2008 (UTC)


 * Take a look at the examples. —Werson (talk) 00:04, 14 June 2008 (UTC)
 * Yes I love the new one!!!! I have decided to implement in my editing of city articles. Spacing conforms better. I doubt anyone will oppose you if you systematically migrate pages with the old template to the new one. .:DavuMaya:. 10:05, 15 June 2008 (UTC)

If this merger takes place, please do so in a way that the old templates continue to function while referencing the new templates in the backend. This prevents us from having to change thousands of articles. Also, this allows older historical versions of articles to still be rendered properly. In order for this to be functional, this template must have a superset of the functionality of the other templates. I don't think that is currently the case, as I don't see a way for this template to have footnote on a particular line like USCensusPop does. --ChrisRuvolo (t) 18:50, 10 July 2008 (UTC)

I really don't think the lines are necessary. They are aesthetically unpleasing, and it's not difficult at all to read without them.  Psych  less   00:10, 11 July 2008 (UTC)


 * Histpop can be safely deprecated, but USCensusPop has additional features and cannot easily be merged. How about making this template a metatemplate for ? --fryed-peach (talk) 15:30, 14 February 2009 (UTC)


 * I tried to replace Histpop by Historical populations in Sophia, but it didn't work well. Debresser (talk) 18:43, 24 September 2009 (UTC)

The necessity of this
There are a few advantages to this combined template, and a bunch of drawbacks.

Drawbacks:
 * The current templates are just fine, there is no pressing need to change anything
 * Having a template with two "modes" is not much simpler than two templates
 * This template is more complicated to edit
 * This just isn't worth the effort it would require

Advantages:
 * There will be a standard appearance between templates
 * There will be less overhead in adding new features/fixing bugs, and it will be easier to discuss changes (one talk page)
 * It will be less confusing for new editors, who see one template that doesn't fit their needs and don't realize the other one exists
 * It's extensible (more "types" can be added as needed, and different shading styles are a possibility)
 * The XHTML is a little cleaner (I'm not really into this, but it doesn't hurt)

Let me know what you think. —Werson (talk) 00:04, 14 June 2008 (UTC)

Expand this template?
Can you include U.S. Rank like above? We are going to be re-evaluating Minneapolis and I would like to use this template for it. .:davumaya:. 23:58, 14 July 2008 (UTC)

I really like this template. Can the number of lines be increased? I think HistPop has 45. I could have used three more for New York City. Station1 (talk) 18:47, 16 August 2008 (UTC)

Column Option?
Is is possible to have an option to arrange this template in 2 or more columns? A long table can cause problems with formatting the rest of the page. hjuk (talk) 12:02, 17 June 2009 (UTC)

Bug
Could you address issues, seen on this page(Thomastown), with this template. Relates to dates no population is known. Mrchris (talk) 12:45, 1 August 2009 (UTC)

Please include show/hide functionality
This template is being mass-added to Irish towns, villages, etc., using census data. Fine, but it's a long, ugly template, especially when it dwarfs a stub article or crosses several sections. Could someone please include a 'Show/Hide' option, with the default set to hidden? Bastun Ėġáḍβáś₮ŭŃ! 15:03, 1 August 2009 (UTC)
 * I really don't know much about templates, but think this is the one causing some general discontent at WikiProject Ireland. It has been suggested that it might be more acceptable if the template could be made collapsible and default set to the closed position, or made to present the info. horizontally. The issue is being discussed here. As stated by Bastun, it is currently being widely applied to Ireland related articles and is quite intrusive, especially on shorter articles. The applying editor refuses to discuss its use, for whatever reason. Could anyone who was involved in building the template please reply. Thanks. RashersTierney (talk) 14:58, 1 August 2009 (UTC)
 * OK, I added show/hide functionality. Add  to the template to have it collapsed by default. You'll have to add this manually to all the existing ones. I agree that this information is often uninteresting, and certainly doesn't need to be added to every city/town/village article. —Werson (talk) 04:12, 2 August 2009 (UTC)
 * That works great. Thank you. RashersTierney (talk) 08:18, 2 August 2009 (UTC)
 * Aye, thanks indeed! Bastun Ėġáḍβáś₮ŭŃ! 08:21, 2 August 2009 (UTC)

Column heading alignment
The Pop. column heading appears to be aligned left which makes it look odd since the column contents are all numbers that are aligned right. The +/-% change has a similar problem although not as obvious as the population heading. Can the second column heading be aligned right please?

GrandpaDave (talk) 03:07, 5 September 2009 (UTC)

Change in the method of calculating the percentage
I like this table and have been adding it to Canadian cities, but I'm wondering if it is possible to modify the % change column to automatically calculate the annual % change so it remains comparable despite differing lengths between census data. I have no idea how to program so I cannot do it myself. Thanks! Mattximus (talk) 17:49, 2 March 2012 (UTC)
 * Here's how: now it's done by (cur - prev) / prev * 100%, but it should be done by (1 + (cur - prev) / prev) ^ (1 / (cur_year - prev_year)) - 1, also call it +-% p.a.. So how to actually implement it, I don't know... --Sigmundur (talk) 06:03, 1 May 2012 (UTC)
 * Before there is any change, note that there will remain the need for the existing formula as well, since some communities will not have differing lengths between census data. If there is a change, either create a new optional average annual change column in addition to the existing column, or build it within the existing column with a parameter where you can choose which method (formula) to use. Hwy43 (talk) 08:00, 1 May 2012 (UTC)
 * Would this new calculation not be superior to the old one regardless if censuses are taken at even or uneven intervals since now every wiki city page can be compared with a standardized "annual growth %" instead of the more arbitrary "% growth since last census"?Mattximus (talk) 00:31, 2 May 2012 (UTC)
 * Not necessarily. The most appropriate formula to use will depend on the country, the source of the data, etc. The national statistical agencies I am familiar with present growth rates over a period rather than compounded average annual growth rates over the course of the period. Using a formula to calculate a growth rate that results in a different growth rate than what is presented by the reliable source is counterintuitive. Hwy43 (talk) 04:50, 2 May 2012 (UTC)


 * Resolution: I have added the option to say   (percentage growth rate) in the template's sandbox which uses Template:PGR to calculate the growth rate based on the number of years between population counts. It is a fairly simple change and I have tested it in several scenarios. If there is no objection, I will roll these changes into the main template in a few days (and update the documentation). Vernhart (talk) 13:56, 9 June 2012 (UTC)


 * Thanks for taking a stab at this. I believe your test is located at Template:Historical populations/testcases. Please confirm and I will take a closer look. Hwy43 (talk) 19:26, 10 June 2012 (UTC)

If the two tables at the bottom at Template:Historical populations/testcases are the results of the test, it appears the above discussion may not have been interpreted as intended. Essentially, an additional parameter to generate the two variants of the table below is sought. The first table shows the "percent growth rate between periods" (existing default method), while the second table shows the "percent average growth rate per annum" (desired optional method):

As for the name of the parameter, I suggest "pagr" (per annum growth rate) or "aagr" (average annual growth rate) instead of "pgr", which is ambiguous and could be mistaken for the existing default "percent growth rate between period" method. Hwy43 (talk) 21:16, 10 June 2012 (UTC)


 * I think that my testcase may have been confusing. I have reworked it and also include it here. The left table is the current display and the right-hand table is with my percentages=pgr parameter. Using pagr is acceptable to me.

To be clear, I have used the formula and definitions as described on the Population growth topic. Vernhart (talk) 01:01, 11 June 2012 (UTC)


 * This is exactly what I was hoping for. It will come in particular handy for countries that have not had regular censuses, so now we can compare over time reasonably well despite irregularities in sampling. Thanks for the programming. Mattximus (talk) 02:15, 11 June 2012 (UTC)


 * Thanks for clarifying. I should have waited until you confirmed first. I see the natural logarithm formula at Population growth rate was used, rather than the formula provided above by Sigmundur, which is what I use for calculating average annual growth rates. Going down the "Rate" column, the other formula produces 6.51%, 5.06%, 3.72%, 2.65% and 2.78% instead of what is shown. I'm new to the natural logarithm formula, and wonder:
 * which of the two is most commonly used,
 * what are the pros and cons of each, and
 * which is preferred by the editors here?
 * As for the definition, I see from Population growth rate that the result of the PGR formula (or "Rate") is not expressed as a percentage (it would result in 0.0123 rather than 1.23%), so perhaps the Sigmundur's originally suggested "±%% p.a." would be more appropriate. Population growth rate goes on to say that PGR can be expressed as Percentage growth = Growth rate × 100. Hwy43 (talk) 03:40, 11 June 2012 (UTC)


 * It would seem that the natural log formula is the one commonly used by experts when they talk about population. At least that is what my research has shown. I have changed the sandbox to use the suggested heading. Vernhart (talk) 04:57, 11 June 2012 (UTC)


 * Thanks for changing to the suggested heading. As we are not hearing anything from the others, I suggest rolling through the changes, and we can revisit again in future if there is interest. Thanks for taking this on! Hwy43 (talk) 03:44, 15 June 2012 (UTC)

Done. I'll watch here for any reported problems. Vernhart (talk) 06:34, 15 June 2012 (UTC)

Another possible bug
I've been using this template to update South Dakota's county populations. Every year the Census Bureau comes out with mid-year estimates and I know how to put in the estimate syntax (estyear= and estimate= ), but the growth percentage seems to be calculating from the 2000 Census entry instead of the 2010 Census entry. For example, Bennett County, South Dakota has a 2011 estimate of 3,441...which is 10 people more than the 2010 calculation of 3,431...yet when I put it in the table, it shows a growth rate of -3.7% (which is the growth rate since 2000) and the growth rate is supposed to be +0.3%. Why is it skipping the 2010 Census when calculating growth rate? Coulraphobic123 (talk) 00:37, 6 April 2012 (UTC)
 * When I look at Bennett County, South Dakota I see 0.3% for the percentage change on the estimate. The template hasn't changed in months so I'm unsure what might have happened to fix this but it does not appear to be a problem at this time. Vernhart (talk) 22:45, 12 June 2012 (UTC)

Another bug
I like this template more than other existing ones, but it has one serious bug: it is transparent to bullets or numbered lists that follow it. I don't know how to revise it, or I would. Can someone take this on? Ksnow (talk) 13:44, 25 April 2012 (UTC)Ksnow
 * I don't understand. Do you have an example of this bug? Vernhart (talk) 22:30, 12 June 2012 (UTC)

A Horizontally-Oriented Version
Is it possible to produce a version of this template that is not a vertical row format to one that is horizontal column format? I am presently revising Sussex County, New Jersey where this template is used with a 23-row data set (not including titles/notes) from 1790-2010. The size of this template is jarring in how it stretches into other sections. I am hoping that a horizontally-oriented version would be placed on the bottom of the section like the templates for monthly climate data (like the one i use in an earlier section of the article). Would it be better to make a 3-column or 4-column table? Please advise. --ColonelHenry (talk) 16:05, 8 July 2012 (UTC)


 * As a workaround, I simply collapse the table so that it doesn't jar the following sections while it is hidden. Not sure if this would be a suitable workaround for your situation. Hwy43 (talk) 19:59, 9 July 2012 (UTC)


 * I like the style used by historical population tables in the French wikipedia, for example Évolution démographique de Assay. This doesn't have the percentage change, but I think that's overkill anyway. Kiwipete (talk) 22:05, 9 July 2012 (UTC)


 * I think it would be relatively easy to create a horizontal version if no consideration is made for how wide it can get. It might even be easy to add a parameter that causes the table to wrap to a 2nd row after reaching a certain number of columns. I'll take a stab at writing this in the next week or so, time permitting. Vernhart (talk) 20:43, 12 July 2012 (UTC)


 * Okay, here's a first pass at a horizontal version of the Historical populations template. I didn't add a table wrap so it will continue to get wider and wider as you add more years. Fine-tuning of the table layout is probably in order, and the documentation page needs to be fleshed out. Template:Historical populations horizontal --Vernhart (talk) 23:50, 5 August 2012 (UTC)

See Rich Farmbrough, 16:19, 25 August 2012 (UTC).

, your first pass at the horizontal version above is redlinked. as suggested by doesn't work as it doesn't include a row for percent change and the formatting (e.g., colours) is inconsistent. If a horizontal version was created here, could be deleted or redirected to here. See Talk:Winnipeg for what has triggered the need to revisit this. Hwy43 (talk) 05:18, 31 August 2014 (UTC)
 * working on it. I started splitting the generation of the table content, from the rendering of the table.  should be done in about 24 hours. Frietjes (talk) 18:02, 31 August 2014 (UTC)
 * nearly finished, see test 13 and 14 in the testcases. I still need to work out the padding and dividers.  I think we probably want a bit more padding, and some dividers between multiple rows.  the other possible concern is how this will render on narrow screens, but I suppose there is really no way around that problem, since we need to have headers for each row. Frietjes (talk) 17:05, 1 September 2014 (UTC)
 * progress is looking good on test 13. We'll need to bold the years, center-align the first column, hide cell borders and work on padding and dividers as you suggested. Rendering on narrow screens will always be a problem, but having horizontal as an option is beneficial when there are equally troubling or worse page restrictions when using the default vertical format. Hwy43 (talk) 03:19, 13 September 2014 (UTC)
 * worked on it some more, and tests 13 and 14 look pretty close to what I think we want. let me know if you see any issues, or have any suggestions for improvement. Frietjes (talk) 13:49, 13 September 2014 (UTC)

Change Pop. header input
I made some changes in the sandbox to change the population header from Pop. to a user output, which makes this box more generally useful. See here for a testcase. If there are no objections I will implement these changes to the template in several days. CRwikiCA (talk) 18:25, 16 March 2013 (UTC)


 * No objection here. Very useful. Hwy43 (talk) 04:31, 18 March 2013 (UTC)


 * I implemented these changes to the template and updated the documentation accordingly. CRwikiCA (talk) 00:29, 20 March 2013 (UTC)

Heading and cell alignment
As brought up once before Template talk:Historical populations, there are alignment conflicts among the "Pop." and "±%" column headings and the data within their cells below. First, the headings appear to be aligned right (or center) while the cells occupied by numbers within the rows below are aligned right. Headings and cell contents should be aligned the same, preferrably center. Second, the first cell under the "±%" column reports as "—". This is also aligned right (or center). This first "—" should also be aligned the same as both the heading and the numbers in the cell below. Can anyone undertake? Hwy43 (talk) 04:31, 18 March 2013 (UTC)
 * I made the changes to right alignment in the sandbox, the text was center aligned, the sandbox versions in the testcases now show the right-alignment. What is your opinion about that? CRwikiCA (talk) 13:38, 18 March 2013 (UTC)
 * I forgot to implement the alignment of "—", this is not included in the sandbox version, it comes from a sub-template. It is possible to align that as well, but it would show up in the main template as well right away. Let's first figure out how to align the header and numbers and then worry about the alignment of "—" after. CRwikiCA (talk) 16:27, 18 March 2013 (UTC)
 * Thanks for looking into this. Admittedly, the right-aligned column headers look odd, especially with the "±%" header being so tight to the right edge of the table. Would you be willing to test center alignment for the cells within the rows that follow the heading row? Cheers, Hwy43 (talk) 03:14, 19 March 2013 (UTC)
 * Centering the cell items would not align the comma's on top of each other. In stead I used right alignment one the headers, but included some closing spaces to make it look better. What do you think, see testcases. CRwikiCA (talk) 17:07, 19 March 2013 (UTC)
 * If there are no comments or objections, then I will implement these changes in the main template. In addition I will align the stripe for the first entry in the % column a bit different as well. CRwikiCA  talk 20:02, 24 March 2013 (UTC)
 * If I'm interpreting your second-last message properly, it appears you added some closing spaces after the "±%" to make it look better. It does. My only other suggestion then would be to do the same for all cells below so the the % figures aren't too tight to the right edge of the table as well. Assuming that can be done, and the hyphen can be right-aligned with the same amount of closing spaces in its sub-template, I'd say go for it right away. Hwy43 (talk) 00:36, 25 March 2013 (UTC)
 * I implemented the changes to the column headers and the hyphen in the position of the first percentage entry. I didn't touch the percentages in the rest of the column, because then the space between that column and the population column becomes rather tight for percentages over 100% for the standard width of the table. CRwikiCA  talk 13:40, 25 March 2013 (UTC)
 * Thanks. What about the "Pop." header? I'd like to see this right-aligned as well. Show the first table at Cold Lake, Alberta to see how odd the center alignment looks when the figures are in the hundreds and thousands rather than the millions. Hwy43 (talk) 05:09, 26 March 2013 (UTC)
 * I changed the spacing a little, so it looks better for smaller populations. The solution is not ideal, it would be better to align it based on the maximum value in the table, but I would not know exactly how to go about that. CRwikiCA  talk 13:32, 26 March 2013 (UTC)
 * Thanks! Hwy43 (talk) 04:16, 27 March 2013 (UTC)

Error in the method of calculating the percentage
User:Johnmperry brought to my attention that the per annum percentages are calculated wrong. He wrote:
 * "The mathematics of population change is quite straightforward: it is the nth root of the change over the period, where n is the number of years. ...  However if you look at say Madridejos, Cebu, for the five year period 1995-2000, formula is:
 * (((((29020-26505)/26505)+1)^(1/5))-1)*100 which is, different from what box gives (1.81) For three-year period 2007-2010 annual change is (((((34905-30763)/30763)+1)^(1/3))-1)*100 = (box gives 4.31). This is what I call mathematically incorrect.  The results are wrong, and wrong in an unpredictable way..."

Can this issue please be corrected as soon as possible? -- P 1 9 9 ✉ 13:26, 11 April 2013 (UTC)


 * The actual math can be simplified to: (((29020/26505)^(1/5))-1)*100 for the first case and (((34905/30763)^(1/3))-1)*100. The actual numbers in the article right now (16:12, 11 April 2013 (UTC)) actually read and should read (((29020/26506)^(1/5))-1)*100 = 1.83% with 1.81% in the box (((34905/30673)^(1/3))-1)*100 = 4.40% with 4.31% in the box So the results are wrong at the moment, but differenf from the initial statement. I'll see whether I can figure the code out and change the formula to ( (P2/P1)^(1/N) - 1)*100, with P1 and P2 the populations at time 1 and time 2 and N the number of years (or periods) inbetween. CRwikiCA  talk 16:12, 11 April 2013 (UTC)


 * The issue is that the template that is used, does not actually compute the annual compounded growth rate, but this formula. Which means the effective output shown in the infoboxes is 100*ln( (P2/P1)^(1/N) ). This is an approximation for which I see no use, I would suggest creating a new template that uses the exact formula ( (P2/P1)^(1/N) - 1)*100 and use that in stead. CRwikiCA  talk 16:33, 11 April 2013 (UTC)


 * The old template was PGR, I create PAGR to compute the exact annual growth rates. For the 2 examples above this leads to
 * {| class="wikitable"

! Numbers !! PGR !! PAGR
 * 26505 in 1995 to 29020 in 2000|| ||
 * 30673 in 2007 to 34905 in 2010|| ||
 * }
 * If these are the results you want then the row sub-template would need to be changed to call PAGR instead of PGR and the problem would be fixed. CRwikiCA  talk 16:55, 11 April 2013 (UTC)
 * That's great! Before switching to PAGR, we need to check if it will work for the default setting ("total percent") as well. -- <b style="color:#199199;">P 1 9 9</b> ✉ 17:07, 11 April 2013 (UTC)
 * Actually, as far as I can see, PGR is used in Historical populations/Row only to calculate per annum growth rate. Can you double check? If so, we can substitute the template. -- <b style="color:#199199;">P 1 9 9</b> ✉ 17:22, 11 April 2013 (UTC)
 * The normal percentage is computed directly. I made the change in the Row sub-template. CRwikiCA  <i style="color:navy">talk</i> 17:42, 11 April 2013 (UTC)
 * Thanks! -- <b style="color:#199199;">P 1 9 9</b> ✉ 18:38, 11 April 2013 (UTC)
 * Hooray! The proper formula was suggested once previously above, but a different formula was used under the assertion that it was more commonly used by experts. I wasn't in a position to be sure it was otherwise. Glad this has been resolved. Cheers, Hwy43 (talk) 02:19, 12 April 2013 (UTC)
 * On the Talk:Population growth there are also several objections to using the approximate logarithmic formula. It seems like it is one authors preference, but I do not see the value of such an approximation anymore in the digital age. At least it is fixed now for this infobox. CRwikiCA  <i style="color:navy">talk</i> 13:15, 12 April 2013 (UTC)
 * Hooray! The proper formula was suggested once previously above, but a different formula was used under the assertion that it was more commonly used by experts. I wasn't in a position to be sure it was otherwise. Glad this has been resolved. Cheers, Hwy43 (talk) 02:19, 12 April 2013 (UTC)
 * On the Talk:Population growth there are also several objections to using the approximate logarithmic formula. It seems like it is one authors preference, but I do not see the value of such an approximation anymore in the digital age. At least it is fixed now for this infobox. CRwikiCA  <i style="color:navy">talk</i> 13:15, 12 April 2013 (UTC)

Please include functionality to remove the "line"
Hello, could someone include functionality to remove the "line" who appears every 5 years ! Thank you. Historymating (talk) 15:56, 2 June 2013 (UTC)
 * Use  in the template to do this. Note that it might be harder to visually interpret the table though.  CRwikiCA  <i style="color:navy">talk</i> 16:26, 2 June 2013 (UTC)
 * Thanks ! Historymating (talk) 15:55, 4 June 2013 (UTC)

Is it possible to NOT do the rounding ?
For example : for the year 2007, is it possible to have 0.70% instead of 0.7% ? I don't like when the numbers are not aligned.

Historymating (talk) 18:55, 11 June 2013 (UTC)
 * yes, this would be possible. Frietjes (talk) 19:48, 11 June 2013 (UTC)
 * I believe the change would be to Template:PAGR. if you don't use pagr, the template uses Decimals which does the alignment as you indicate. Frietjes (talk) 19:51, 11 June 2013 (UTC)
 * I included an extra line with no change and updated the subtemplate PAGR to incorporate this change. CRwikiCA  <i style="color:navy">talk</i> 19:53, 11 June 2013 (UTC)
 * looks good, I added a line to check negatives as well. Frietjes (talk) 19:56, 11 June 2013 (UTC)
 * Awesome, thank you for the quick replies ! Historymating (talk) 22:52, 11 June 2013 (UTC)

Another question !
Sorry but i have a question again !

How can we have multiple tables side by side ?

Below are two tables but i want to have five or more tables side by side. Is it possible ?

Historymating (talk) 20:04, 13 June 2013 (UTC)
 * you can always embed them in a columns template, with auto passed to the columns template, or if you want to allow them to wrap based on browser width try left and none.


 * Example 1
 * Example 2


 * notice what happens if you make the browser window narrower or wider than the width of four boxes. Frietjes (talk) 20:33, 13 June 2013 (UTC)
 * by the way, if you are using this as a method for compressing a long single table, it would be even better to have an option in this template to use multiple columns, since other ways the percentages won't be linked. Frietjes (talk) 20:34, 13 June 2013 (UTC)
 * Thank you ! Historymating (talk) 20:50, 13 June 2013 (UTC)

Multiple columns
Can we add an option for multiple columns? Similar to the example below? This would be good where the data has become a long list and creates formatting issues, like at Demographics of Hungary. -- <b style="color:#199199;">P 1 9 9</b> ✉ 16:59, 24 October 2013 (UTC)


 * created something in Historical populations/sandbox, will sync it with the live template after some further testing. Frietjes (talk) 17:55, 24 October 2013 (UTC)


 * Thanks, that's great. Maybe there should be a light grey vertical bar between the tables for clarity... -- <b style="color:#199199;">P 1 9 9</b> ✉ 18:02, 24 October 2013 (UTC)
 * I commented to early, seeing it is still work in progress, but a slightly wider separation between tables would likely help clarity. Thanks again. -- <b style="color:#199199;">P 1 9 9</b> ✉ 18:05, 24 October 2013 (UTC)
 * how's that? I added 0.5em margin to the left/right in the subtables. Frietjes (talk) 18:16, 24 October 2013 (UTC)
 * Beautiful. You're probably already working on it, but the header should span across all tables. -- <b style="color:#199199;">P 1 9 9</b> ✉ 18:31, 24 October 2013 (UTC)
 * I had it as colspan=0, which is supposed to work in all browsers. I just changed it to colspan=50, which is a hack.  can you tell me which browser you are using? Frietjes (talk) 18:38, 24 October 2013 (UTC)
 * Actually I checked 2 browsers: Chrome and IE. Now it works. -- <b style="color:#199199;">P 1 9 9</b> ✉ 18:49, 24 October 2013 (UTC)
 * okay, it looks like colspan and rowspan = 0 only works in FF and Opera :( which is unfortunate, but colspan=50 seems to have no rendering problems, so we can go with that. Frietjes (talk) 18:51, 24 October 2013 (UTC)
 * Looks good! Thanks. -- <b style="color:#199199;">P 1 9 9</b> ✉ 18:56, 24 October 2013 (UTC)
 * I just experimented and changed the percol value to a unreasonable number. So maybe there should be a constraint on this, say a limit of 2 columns (or 3 max)? -- <b style="color:#199199;">P 1 9 9</b> ✉ 18:59, 24 October 2013 (UTC)
 * I will look into this, and see how expensive it is to count the total number of rows, could probably be done in log-time. Frietjes (talk) 19:16, 24 October 2013 (UTC)
 * the live version is now updated to support percol. I will see about the row counter later, but this new version is output-identical to the old version when   is blank, and seems to do a reasonable job when percol is set to a sane value.  there are some slightly differing spacing quirks depending on browser, but it seems reasonably good for now. Frietjes (talk) 20:51, 24 October 2013 (UTC)
 * It looks good, exactly what I had in mind. The only thing is that, by using a percol parameter, it is up to the editor to ensure even columns, otherwise it may look like the table above. Anyway, I appreciate your work! -- <b style="color:#199199;">P 1 9 9</b> ✉ 13:40, 25 October 2013 (UTC)
 * new version in the sandbox which supports 2 rather than, once this has been tested a bit more and synced with the live template, we can probably deprecate the 'percol' method (see the testcases). Frietjes (talk) 20:31, 25 October 2013 (UTC)

Bug for type=US: non-linked years being treat as redlinks
When the template is used with the parameter type=US, it automatically links the years that correspond to existing articles titled "YYYY United States Census" to those articles. A whole bunch of pages for towns and cities in Massachusetts use this template, with populations for census years (years divisible by 10) through 2010. The year is linked in each case. It also lists estimated populations for the years 2001-2009 (each marked with an asterisk). Those years are not linked&#8212;but somehow Wikipedia is acting as though they were linked.

Take a look at Special:WhatLinksHere/2001* United States Census. All those places in Massachusetts are listed. Yet none of those pages contains a link to 2001* United States Census. How is Wikipedia getting the impression that these links exist?

The reason this came up is that these nonexistent census pages are now all listed at WP:Most wanted articles based on the false report that over 120 links to each of them exist on Wikipedia. An editor who saw these decided to create the article 2007*_United_States_Census. I came across it and submitted it for deletion (on the grounds that there was no 2007 census), but then learned why it had been created. See Talk:2007* United States Census for that conversation.

How is this happening, and can it be fixed?

—Largo Plazo (talk) 18:11, 2 November 2013 (UTC)
 * I think I fixed it, but not in the most satisfactory manner. Basically, I added some logic to make sure the year is greater than or equal to 1790, and divisible by 10 before the 'ifexist' check.  I pinged  to see if she has a more robust fix.  The number of false links should start going down once the job queue catches up.  Thanks! Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  20:54, 2 November 2013 (UTC)


 * Yes, the Massachusetts pages are now all gone from the likes of Special:WhatLinksHere/2001* United States Census. I don't understand why the fix worked since it seems you specified not to put brackets around the year unless it's divisible by 10, but there already weren't brackets around them--or, at least, they weren't hyperlinked in the displayed page. Anyway, thanks! —Largo Plazo (talk) 21:34, 2 November 2013 (UTC)
 * I probably has something to do with the method being used to check to see if the page exists. For example, it used to be that a cheaper way to see if a template existed was to write  .  This relied on the fact that  would expand to Template:Sometemplate if the template did not exist.  However, this method would then generate links to Sometemplate, both as a transclusion and as a link.  This does not happen with '#ifexist', but using '#ifexist' was slower at the time.  Checking the module, it looks like we are using some convoluted method for 'ifexist', so I imagine that method is effectively internally generating redlinks, but not rendering them.  Definitely a hard bug to spot if you don't know to look for it.  I am pretty sure that one can import the standard '#ifexist' function into the module, but with some expense.  I will ask over at WT:Lua and see if anyone there has any suggestions.  Thanks! Plastikspork <sub style="font-size: 60%">―Œ <sup style="margin-left:-3ex">(talk)  21:43, 2 November 2013 (UTC)
 * thank you for fixing this. it appears there is no way to use 'ifexist' without generating an incoming link, so checking if the year is potentially valid first is a good compromise.  I plan to remove the ifexist all together since we can just check (year >= 1790 and year <= current_year and mod(year,10) == 0) which should always generate valid links.  the only potential redlink might be at the very start of a census year when the census hasn't been conducted yet.  I will update the module. Frietjes (talk) 17:28, 8 November 2013 (UTC)

Wrapping Bug
There's a bug that prevents the Historical Populations template from wrapping around French Commune Infoboxes properly. See Rochefort, Charente-Maritime for an example. Esszet (talk) 15:11, 20 April 2014 (UTC)
 * Do you want to align it to the left? To get it proper you might want to use the stack template, see Barendrecht for an example of how I used that. CRwikiCA  <i style="color:navy">talk</i> 15:16, 20 April 2014 (UTC)
 * I tried that; it didn't work. I also realized that the problem isn't that the Historical Population box is being prevented from wrapping around the French Commune infobox; it's that it's aligning with the picture below it for some reason.  Get rid of the picture, and it's fine. Esszet (talk) 02:34, 21 April 2014 (UTC)
 * did you try none? Frietjes (talk) 15:13, 21 April 2014 (UTC)
 * No, I didn't. Thank you.  Is there a help page that describes alignment for templates like this? Esszet (talk) 16:13, 21 April 2014 (UTC)
 * the alignment options match the alignment for images, which is generally described in Help:Visual file markup and in Extended image syntax and in Picture tutorial. there may be a more general description somewhere about how to avoid this 'float blocking' problem, where left/right floating elements block each other from floating up.  but, I can't seem to find anything at the moment. Frietjes (talk) 17:15, 21 April 2014 (UTC)
 * After experimenting a little, I've found that the problem occurs only if a) there are multiple images (or other multimedia objects) on one side and b) the image or other multimedia object on the other side comes after the other ones in the source code. It looks as though there's something wrong with Wikipedia's source code; where do I report this? Esszet (talk) 20:26, 21 April 2014 (UTC)
 * I am assuming you have discovered what happens in this example, where the left images cannot float above the top of the last right image. you can try WP:VPT, but I am pretty sure they will tell you that it's not fixable, since it has to do with how your browser is rendering the HTML per the spec. if you want to allow the left images to float up, you either (a) reorder them, or (b) use stack to group them, which has its own set of problems. Frietjes (talk) 20:39, 21 April 2014 (UTC)

Title
Maybe it would be possible to take the default title, when title is empty? Currently, it is like this:

Not like when the title parameter isn't represented in template.

-- Edgars2007  (talk/contribs) 15:36, 13 June 2014 (UTC)
 * done. Frietjes (talk) 15:09, 14 June 2014 (UTC)
 * Thanks :) -- Edgars2007  (talk/contribs) 18:31, 14 June 2014 (UTC)

Allow fractional years for the purpose of pagr calculation, but only display integer years
I've modified the Module:Historical populations/sandbox to allow years with fractional parts for the somewhat unique situation where the Reference Date is different from year to year. This is true in particular for Philippine censuses that are conducted in between the regular census years. For instance, 2010.3315 would refer to 2010 May 1 (since May 1 is the 121st day of 2010 and 121/365 is about .3315). My modifications allow fractional years which get passed on to the percent annum growth rate calculation but are rendered as simple integers in the histpop table.

I've also given the Module the ability to be called directly (rather than from within a template) to make testing easier. Vernhart (talk) 09:52, 4 August 2014 (UTC)

Accommodating population adjustments due to boundary changes
Is it possible to incorporate population adjustments due to boundary changes in this template? See the two tables at Cold Lake, Alberta. Cold Lake was a community on its own when Canada's 1996 census was undertaken. A few months later, it amalgamated with two other communities. The following 2001 census therefore published the population of amalgamated Cold Lake, and compared it back to an adjusted 1996 population based on its expanded boundaries (see here and expand Division No. 12). The barrier to consolidating the two tables at the Cold Lake article is that it would be incorrect to present that Cold Lake grew by NaN% (or by 7,431 residents) from 4,089 in 1996 to 11,520 in 2001. Truth is those residents did exist in 1996 but were located beyond Cold Lake's former boundaries. To resolve, it would be helpful to include second entries for census years so that Cold Lake's adjusted 1996 population of 11,791 based on its 2001 boundaries can be included in addition to its original 1996 population in order to accurately present its 1996 to 2001 population change of NaN%. Many articles would benefit from this as plenty of larger communities use this template and have experienced multiple boundary adjustments over their histories due to amalgamations and annexations. Hwy43 (talk) 06:36, 13 September 2014 (UTC)
 * , if you could create a hard-coded example of the desired output, that would be helpful. one undocumented method for combining tables is to use y


 * it's probably not exactly what you are seeking, but it does provide the ability to put multiple lists in the same table. Frietjes (talk) 12:55, 13 September 2014 (UTC)

Column heading for Philippines
Consensus on seems to be that the growth column header be expanded to include an explanatory note. Footnotes and refs in templates are often problematical. Best solution here would be to extend the around the heading, thus:

<abbr title="Per annum growth rate. Executive Order 135 §6 states that for &amp;quot;census years&amp;quot; (years divisible by 10) the reference date would be May 1st, but for all other years, the reference date is to be the &amp;quot;middle of the year&amp;quot;.  This means that growth rates, although correct, are not necessarily simple year-on-year comparisons.">±% p.a.

That's in this little piece of the lua code:<pre style="overflow:auto"> -- percentages cell if( percentages ~= 'off' ) then if( percentages == 'pagr' ) then percentname = '<abbr title="Per annum growth rate">±% p.a. ' else percentname = '<abbr title="Percent change">±% ' end end | V <pre style="overflow:auto"> -- percentages cell if( percentages ~= 'off' ) then if( percentages == 'pagr' ) then percentname = '<abbr title="Per annum growth rate. Executive Order 135 §6 states that for &amp;quot;census years&amp;quot; (years divisible by 10) the reference date would be May 1st, but for all other years, the reference date is to be the &amp;quot;middle of the year&amp;quot;.  This means that growth rates, although correct, are not necessarily simple year-on-year comparisons.">±% p.a. ' else percentname = '<abbr title="Percent change">±% ' end end Produces <abbr title="Per annum growth rate. Executive Order 135 §6 states that for &quot;census years&quot; (years divisible by 10) the reference date would be May 1st, but for all other years, the reference date is to be the &quot;middle of the year&quot;.  This means that growth rates, although correct, are not necessarily simple year-on-year comparisons.">±% p.a.

Need to pay attention to quotes. Unbuttered parsnip (talk) mytime= Sun 09:45, wikitime=  01:45, 26 October 2014 (UTC)
 * Except for not all countries are the Philippines, so the place to modify percent_name would be in Philippine Census‎, not here. Frietjes (talk) 15:43, 26 October 2014 (UTC)
 * Oh I thought it was a Phils-only param. Problem then is that as you can see, percent_name is a local variable, not passed from caller.  Maybe way to go would be to change Philippine Census‎ to pass a different value of percentage – currently "pagr", but let's make it "phil" for instance.  Then this module needs to do the same arithmetic for "pagr" or "phil" but the code I indicated above needs to be split into a head for "pagr" (as now), and an extra for "phil".  Unbuttered parsnip  (talk) mytime= Wed 22:16, wikitime=  14:16, 29 October 2014 (UTC)
 * [//en.wikipedia.org/w/index.php?title=Template%3APhilippine_Census&diff=631198513&oldid=621212878 already done]. Frietjes (talk) 19:03, 29 October 2014 (UTC)
 * Thanks Frietjes, that's perfect. Unbuttered parsnip  (talk) mytime= Thu 09:27, wikitime=  01:27, 30 October 2014 (UTC)

Aesthetically pleasing way to demonstrate amalgamations?
Is there an aesthetically pleasing way to demonstrate an amalgamation or deamalgamations at a certain period in time? Perhaps a line of some kind? I often see population tables with 5% growth, then 5%, then 5%, then 2592%, then 5%... I've created something like this but I'm not sure it's the best option. Thanks for your ideas! Mattximus (talk) 23:43, 12 November 2014 (UTC)
 * Mattximus, see directly above. Frietjes (talk) 00:39, 13 November 2014 (UTC)
 * for your case, it would looks something [//en.wikipedia.org/w/index.php?title=Greater_Sudbury&oldid=633600717 like this]. it's possible there is a more elegant solution, but at the moment, that's it. Frietjes (talk) 00:42, 13 November 2014 (UTC)


 * Ooops! Apologies, I missed the thread above. Thanks! Mattximus (talk) 01:13, 13 November 2014 (UTC)

References for each year separately
When I'm adding for every year, it can't add commas and looks weird.

Example:

VjacheslavWolski (talk) 20:54, 17 October 2015 (UTC)


 * VjacheslavWolski, should work now, along with percentages. Frietjes (talk) 01:30, 14 November 2015 (UTC)


 * Seems to have double column – see Bantayan Island (Philippine Census) – Unbuttered parsnip  (talk) mytime= Sat 18:35, wikitime=  10:35, 14 November 2015 (UTC)
 * Unbuttered Parsnip, fixed. for some reason none of the testcases included whitespace before the population number.  Frietjes (talk) 13:31, 14 November 2015 (UTC)

Clear problems?
Can anyone explain (and remove!) the unwanted whitespace between the Population heading and the table in Umhausen?

This is the behaviour I would expect from an unwanted  in the table, causing it to clear itself below the article infobox. Yet it shouldn't do that here, with either the left or an explicit left. Thanks Andy Dingley (talk) 10:58, 7 November 2016 (UTC)
 * Andy Dingley, I [//en.wikipedia.org/w/index.php?title=Umhausen&type=revision&diff=753159768&oldid=748277858 fixed it for you]. this is a feature of all floating elements, including images.  if you float two items right, then float an item to the left, the left floating item is pushed down by the last right floating item.  in other words, the right floating image after the infobox was the problem.  the solution, in this particular case is to not float the populations table.  another solution would have been to put the image after the table. Frietjes (talk) 15:05, 5 December 2016 (UTC)

Division by zero
It appears that this module divides by 0, so percent changes become "nan" and "inf", as shown in this example:

I think it makes more sense to simply display dash, as it does in the first row. The "infinity" is, in some sense, correct, but users should never see the divide-by-0 error, "nan". MathPerson (talk) 02:19, 9 August 2017 (UTC)
 * fixed. thank you. Frietjes (talk) 15:58, 20 August 2017 (UTC)
 * Works much better, thanks! But programming is never as simple as we would like: if two consecutive rows are 0, would it make sense to display 0% change in the second row? MathPerson (talk) 16:04, 20 August 2017 (UTC)
 * okay. Frietjes (talk) 16:10, 20 August 2017 (UTC)
 * Now, that's perfect! MathPerson (talk) 16:11, 20 August 2017 (UTC)

Source(s)
Please change Source to Source(s) because there are multiple references in some cases. --Obsuser (talk) 00:28, 26 July 2019 (UTC)

Alignment of mdash in first ±% cell
Please, let's use css  (or even , depending on the desired effect) instead of sloppily approximating it with an arbitrary number of  s. ―cobaltcigs 08:18, 27 September 2019 (UTC)

Edit request November 2019
Let's use standard text size in the table headers, as per the Module:Historical populations/sandbox (i.e. match the module to the sandbox version). There is really no reason for the unsightly big headers, better to have uniformity with other templates. Thanks. --  P 1 9 9  ✉ 19:14, 14 November 2019 (UTC)
 * I remove the font-size declaration completely. Frietjes (talk) 15:26, 15 November 2019 (UTC)
 * Thank you/hartelijk bedankt. --  P 1 9 9  ✉ 18:26, 15 November 2019 (UTC)

convert top th field to caption
As per MOS:TABLECAPTION and Village_pump_(technical) the first th field should be converted to an caption as an accessibility measure. It is shown in this diff how this would be done. There may or may not be other changes in the sandbox unrelated to this change. Allready tested the change on Template:Historical populations/testcases.--Snaevar (talk) 23:00, 15 July 2020 (UTC)
 * ✅ * Pppery * <sub style="color:#800000">it has begun... 03:04, 16 July 2020 (UTC)
 * and : This edit appears to have caused Linter to complain about unclosed tags in every table. I have removed what appears to be a spurious, empty set of <tr ></tr> tags that were inside the <caption ></caption> tags, and that seems to have fixed the problem. Let me know if I broke anything. – Jonesey95 (talk) 19:42, 16 July 2020 (UTC)

Reference column
Hi - can I request the addition of a reference column on the far right? I am using this template where there are different references for most every data entry. I saw you can add a ref tag just next to the population number entry, but that would look terrible given that I am using rp alongside each ref tag. ɱ (talk) 23:46, 1 September 2020 (UTC)

Chart
Hi, in the discussion we're having at WT:WikiProject France we're looking for user-friendly alternatives for the present Table Population Town and Chart Population Town that use database templates like Database Population Ablon. See Ablon for an example of the present situation. One idea that came up is to convert the population data to a format that can be fed to Historical populations, and to add an optional chart to this template that uses the same data. I made a chart template myself that uses Graph:Chart (see Ballay for a demonstration with stand-alone chart), but I wouldn't know how to append that to Historical populations. Do you think it's a good idea to add a chart functionality to Historical populations, and does anyone know how to do that correctly? Markussep Talk 16:54, 10 December 2020 (UTC)


 * User:Frietjes is working on the idea to add a graph to the population table, see this first attempt. Suggestions for improvement and functionality to be added are welcome! Markussep Talk 08:02, 7 January 2021 (UTC)
 * Is there any progress on this? I think it would be absolutely brilliant if each historic population table had a button where you can click and it forms an automatic graph. My only advice would be to colour the points (if line graph) or bars (if bar graph) two different colours depending on if it is an estimate or an actual census count. One can dream... Mattximus (talk) 14:26, 19 September 2021 (UTC)


 * Yes, it's been operational since January, see the examples at Historical populations/doc. No automatic graph for all tables though, that's a nice suggestion too. Markussep Talk 18:28, 19 September 2021 (UTC)

Template-protected edit request on 13 January 2022
This should be a simple request. Last year, the articles for each 10-year census was moved in which "NNNN United States Census" moved to "NNNN United States census"

The code in Module:Historical populations would just need to be changed in Lines 49-52:

to:

– The Grid  ( talk )  21:53, 13 January 2022 (UTC)
 * ✅. For the record, relevant consensus is here. --  Tamzin  [ cetacean needed ] (she/they) 00:03, 14 January 2022 (UTC)

Add a UK type
Like with the US type linking to US censuses, a UK type could easily do the same for British censuses. I would do it, but the page is protected. Benjamin Bryztal (talk) 09:20, 22 July 2022 (UTC)

Population table graph - position
I would like the graph next to (right) of the table, probably double-width table. Auntie Kathleen (talk) 03:12, 6 January 2023 (UTC)

Getting better, but I would like right-but-next-to-table-not-at-right-margin Auntie Kathleen (talk) 01:04, 7 January 2023 (UTC)
 * I see now that there are hidden parameters with graph-pos=left or graph-pos=right

Making Same template for historical debt
Marking similar template for historical external debts of countries... 103.241.226.231 (talk) 08:20, 11 June 2023 (UTC)

Changes to style
This template was designed at a point where Wikipedia rendered tables and especially an article's table of contents differently. I've done some changes to the sandbox styles. These won't affect anyone still using the legacy Vector theme or the older Monobook theme. The current desktop theme (Vector 2022) and the current mobile theme (Minerva) do not display any border around the table, so the border on the caption does not connect to anything in the live version. This looks especially odd on mobile where the table is entirely left-aligned. The proposed changes are: removal of the partial border, removal of the partial background color, a horizontal line separator when there are multiple columns, and no-wrapping on the header abbreviations. Check out the testcases page for examples: desktop, mobile Rjjiii  (talk) 14:21, 13 July 2024 (UTC)


 * It's usually better to have a consistent set of styles cross-skin. Pick whatever styles you're going to use and then use them, rather than making it pretty in specific skins. It's a maintainability nightmare otherwise. Izno (talk) 23:15, 13 July 2024 (UTC)