<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python solution to convert single column into multiple columns in Python Questions</title>
    <link>https://community.esri.com/t5/python-questions/python-solution-to-convert-single-column-into/m-p/483704#M37744</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have generated a summary statistics table based on service area analysis areas (5 min, 10 min, 15min etc) for each settlement area that I'm determining travel times from individual buildings within a settlement to a social facilities (i.e. Clinics, Schools etc)&lt;/P&gt;&lt;P&gt;My output from my summary statistics table has the following columns:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;TOWN = Town Name&lt;/LI&gt;&lt;LI&gt;SETTLEMENTNAME = Settlement Name&lt;/LI&gt;&lt;LI&gt;NAME = Social Facility Name (i.e. School Name or Health Care Name)&lt;/LI&gt;&lt;LI&gt;TIME = Service Area Time Interval ( 5 min, 10 min, 15min - 60 min)&lt;/LI&gt;&lt;LI&gt;COUNT_NAME = The number of buildings within each service area (5 min, 10 min - 60 min)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to convert the following Summary Statistics results table into the following format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;TOWN&lt;/LI&gt;&lt;LI&gt;SETTLEMENTNAME&lt;/LI&gt;&lt;LI&gt;NAME&lt;/LI&gt;&lt;LI&gt;0 - 5 MIN&amp;nbsp; = The number of buildings within 0 - 5 min of the Social Facility&lt;/LI&gt;&lt;LI&gt;5 - 10 MIN&amp;nbsp; = The number of buildings within 5 - 10 min of the Social Facility&lt;/LI&gt;&lt;LI&gt;10 - 15 MIN&amp;nbsp; = The number of buildings within 10 - 15 min of the Social Facility&lt;/LI&gt;&lt;LI&gt;15 - 20 MIN&amp;nbsp; = The number of buildings within 15 - 20 min of the Social Facility&lt;/LI&gt;&lt;LI&gt;20 - 25 MIN&amp;nbsp; = The number of buildings within 20 - 25 min of the Social Facility&lt;/LI&gt;&lt;LI&gt;25 - 30 MIN&amp;nbsp; = The number of buildings within 25 - 30 min of the Social Facility&lt;/LI&gt;&lt;LI&gt;30 - 60 MIN&amp;nbsp; = The number of buildings within 30- 60 min of the Social Facility&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached a print screen of the Summary Statistics Table as well as the Output Results Table that I'm trying to achieve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've briefly read that either Numpy or Pandas would be able to achieve the results that I'm looking for, but I'm a novice with Numpy and have never used Pandas. Any help would be appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 30 Mar 2016 20:53:21 GMT</pubDate>
    <dc:creator>PeterWilson</dc:creator>
    <dc:date>2016-03-30T20:53:21Z</dc:date>
    <item>
      <title>Python solution to convert single column into multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/python-solution-to-convert-single-column-into/m-p/483704#M37744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have generated a summary statistics table based on service area analysis areas (5 min, 10 min, 15min etc) for each settlement area that I'm determining travel times from individual buildings within a settlement to a social facilities (i.e. Clinics, Schools etc)&lt;/P&gt;&lt;P&gt;My output from my summary statistics table has the following columns:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;TOWN = Town Name&lt;/LI&gt;&lt;LI&gt;SETTLEMENTNAME = Settlement Name&lt;/LI&gt;&lt;LI&gt;NAME = Social Facility Name (i.e. School Name or Health Care Name)&lt;/LI&gt;&lt;LI&gt;TIME = Service Area Time Interval ( 5 min, 10 min, 15min - 60 min)&lt;/LI&gt;&lt;LI&gt;COUNT_NAME = The number of buildings within each service area (5 min, 10 min - 60 min)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd like to convert the following Summary Statistics results table into the following format:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;TOWN&lt;/LI&gt;&lt;LI&gt;SETTLEMENTNAME&lt;/LI&gt;&lt;LI&gt;NAME&lt;/LI&gt;&lt;LI&gt;0 - 5 MIN&amp;nbsp; = The number of buildings within 0 - 5 min of the Social Facility&lt;/LI&gt;&lt;LI&gt;5 - 10 MIN&amp;nbsp; = The number of buildings within 5 - 10 min of the Social Facility&lt;/LI&gt;&lt;LI&gt;10 - 15 MIN&amp;nbsp; = The number of buildings within 10 - 15 min of the Social Facility&lt;/LI&gt;&lt;LI&gt;15 - 20 MIN&amp;nbsp; = The number of buildings within 15 - 20 min of the Social Facility&lt;/LI&gt;&lt;LI&gt;20 - 25 MIN&amp;nbsp; = The number of buildings within 20 - 25 min of the Social Facility&lt;/LI&gt;&lt;LI&gt;25 - 30 MIN&amp;nbsp; = The number of buildings within 25 - 30 min of the Social Facility&lt;/LI&gt;&lt;LI&gt;30 - 60 MIN&amp;nbsp; = The number of buildings within 30- 60 min of the Social Facility&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've attached a print screen of the Summary Statistics Table as well as the Output Results Table that I'm trying to achieve.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've briefly read that either Numpy or Pandas would be able to achieve the results that I'm looking for, but I'm a novice with Numpy and have never used Pandas. Any help would be appreciated.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 20:53:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-solution-to-convert-single-column-into/m-p/483704#M37744</guid>
      <dc:creator>PeterWilson</dc:creator>
      <dc:date>2016-03-30T20:53:21Z</dc:date>
    </item>
    <item>
      <title>Re: Python solution to convert single column into multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/python-solution-to-convert-single-column-into/m-p/483705#M37745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so a more elaborate multicolumn version of histogram (in numpy).. I have several variants, but look at this first and state what is missing or do you want the output matrix ordered in a different way.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migration-blogpost/55577"&gt;Free Frequency ... join the cause  &lt;/A&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;as indicated before &lt;A href="https://community.esri.com/group/1732"&gt;NumPy Repository&lt;/A&gt;​ has other documents for those that are interested in array works&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 21:00:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-solution-to-convert-single-column-into/m-p/483705#M37745</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-03-30T21:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: Python solution to convert single column into multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/python-solution-to-convert-single-column-into/m-p/483706#M37746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Dan&lt;/P&gt;&lt;P&gt;Thanks for your assistance once again, truly appreciated. I'm not sure Frequency Analysis is what I looking for. The COUNT_NAME field already has the number of buildings determined for each particular time interval. If you take "&lt;STRONG&gt;Asla Park B&lt;/STRONG&gt;" as an example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;STRONG&gt;Town&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Settlement Name&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TIME Field ( 15 - 25 min)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TIME Field ( 20 - 25 min)&lt;/STRONG&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Mossel Bay&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Asla Park B&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 6 Buildings = COUNT_NAME&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 148 Buildings = COUNT_NAME&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me kow if I've not explained it clearly enough. Thanks again &lt;IMG src="https://community.esri.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 21:21:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-solution-to-convert-single-column-into/m-p/483706#M37746</guid>
      <dc:creator>PeterWilson</dc:creator>
      <dc:date>2016-03-30T21:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: Python solution to convert single column into multiple columns</title>
      <link>https://community.esri.com/t5/python-questions/python-solution-to-convert-single-column-into/m-p/483707#M37747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;sort of fuzzy, but I assume that you are trying to find the Asia Park B's broken down by time zone, I was more interested on the input data form which looks like table you want, but not what you have.&amp;nbsp; I haven't got time right now to check, but there is an abbreviated section on how to take data, sort it by a column and get the counts for other columns, so if you had a bunch of Asia Park B's records with 0 1 or 2 counts which....when summarized... gave you 6 buildings in the 15-25 min time zone and 148 in the 20-25 time zone etc... then it is doable.&amp;nbsp; there is the small problem of your horrid field names... but that is minor.&amp;nbsp; TableToNumPyArray will produce a recarray,, you access fields using a field name (like in Pandas), you can determine the unique entries, and summarize the various columns accordingly.&amp;nbsp; Have a read through some of the samples, and let me know.&amp;nbsp; Of course right now, your table work could be expedited using dcount dsum and the like if the data are already in spreadsheet form, but I find spreadsheet database summary more confusing that array stuff.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Mar 2016 21:38:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-questions/python-solution-to-convert-single-column-into/m-p/483707#M37747</guid>
      <dc:creator>DanPatterson_Retired</dc:creator>
      <dc:date>2016-03-30T21:38:33Z</dc:date>
    </item>
  </channel>
</rss>

