<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="306774" data-post-id="306774">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sehHeiden" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sehHeiden/120/31707_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sehHeiden
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/billylanchantin" rel="nofollow">@billylanchantin</a> I did it in Python Pandas and ilustrate it with some images.<br>
I start with a DataFrame with start and Enddates and some values:</p>
<p></p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/3X/c/a/ca65febf284f46818ffc9c5f190e94137430287e.png" data-download-href="https://forum.elixirforum.com/uploads/default/ca65febf284f46818ffc9c5f190e94137430287e" title="input" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/original/3X/c/a/ca65febf284f46818ffc9c5f190e94137430287e.png" alt="input" data-base62-sha1="sSuYiq3XrY9DlPwJxFE7EplEtLU" width="486" height="354"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">input</span><span class="informations">486×354 24 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p>Than I add a column (last column), that holds the days from start to end date:<br>
</p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/3X/d/4/d4bf6736af3f89d4c7e8aa028cc20cc66c8b082b.png" data-download-href="https://forum.elixirforum.com/uploads/default/d4bf6736af3f89d4c7e8aa028cc20cc66c8b082b" title="input_with_list" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/original/3X/d/4/d4bf6736af3f89d4c7e8aa028cc20cc66c8b082b.png" alt="input_with_list" data-base62-sha1="um3iNjSZFBdULsRYPAbDKjit01l" width="476" height="273"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">input_with_list</span><span class="informations">476×273 13.2 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><br>
You see the brackets. Which implies the list. Than I “explode” the DataFrame. So that from any value in the list, the other row values are copied and the row-exists n times.<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/3X/f/f/ffd87f3f2cce82f1e50ed919d3caa4a4cdd9ee4e.png" data-download-href="https://forum.elixirforum.com/uploads/default/ffd87f3f2cce82f1e50ed919d3caa4a4cdd9ee4e" title="input_exploded" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/original/3X/f/f/ffd87f3f2cce82f1e50ed919d3caa4a4cdd9ee4e.png" alt="input_exploded" data-base62-sha1="AvjB3PFZdYZ7rCQAkp6lnoU8eiW" width="690" height="246" data-dominant-color="381B57"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">input_exploded</span><span class="informations">927×331 7.43 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p>The image shows that line zero exists now 5 times, as the list in column <code>day</code> is exploded.</p>
<p>Here is the python code:</p>
<pre data-code-wrap="python"><code class="lang-python">from pandas import read_csv

data_df = read_csv("../doy_data.csv")
data_df["day"] = data_df.apply(lambda x: list(range(x["start_day"], x["end_day"]+1)), axis="columns")
data_df = data_df.explode("day")
data_df.to_csv("doy_data_unrolled.csv", index=False)
</code></pre>
<p>How would I reach the result in Explorer?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="306774" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/explorer-dataframe-with-startdate-and-enddate-columns-to-timeline/59395/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-306774" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="306774"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="306818" data-post-id="306818">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sehHeiden" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sehHeiden/120/31707_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sehHeiden
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/billylanchantin" rel="nofollow">@billylanchantin</a> I just checked Polars also can do that. <a href="https://pola-rs.github.io/polars/py-polars/html/reference/dataframe/api/polars.DataFrame.explode.html#polars.DataFrame.explode" rel="noopener nofollow ugc">Polars Explode</a></p>
<p>But it’s not in the explorer documentation, olso the types <a href="https://pola-rs.github.io/polars/py-polars/html/reference/api/polars.List.html#polars.List" rel="noopener nofollow ugc">list</a> and array…<br>
Am I right?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="306818" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/explorer-dataframe-with-startdate-and-enddate-columns-to-timeline/59395/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-306818" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="306818"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="306819" data-post-id="306819">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="billylanchantin" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/billylanchantin/120/28428_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  billylanchantin
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="sehHeiden" data-post="12" data-topic="59395">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sehheiden/48/31707_2.png" class="avatar"> sehHeiden:</div>
<blockquote>
<p>I did it in Python Pandas and ilustrate it with some images.</p>
</blockquote>
</aside>
<p>Thank you! That makes it <em>much</em> easier to answer.</p>
<p>So I think <a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a>’s answer was what you want (for now, see below):</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">df = DF.new([
  %{start_day: 244, end_day: 248, fw: 15.0},
  %{start_day: 247, end_day: 249, fw: 16.0}
])

df
|&gt; DF.to_rows()
|&gt; Enum.with_index()
|&gt; Enum.flat_map(fn {row, index} -&gt;
  row["start_day"]..row["end_day"]
  |&gt; Enum.map(&amp;Map.merge(row, %{"day" =&gt; &amp;1, "index" =&gt; index}))
end)
|&gt; DF.new()
|&gt; DF.arrange(index) # You can order by any column
|&gt; DF.print(limit: :infinity)
# +---------------------------------------------------------+
# |        Explorer DataFrame: [rows: 8, columns: 5]        |
# +-----------+-----------+---------+-----------+-----------+
# |    day    |  end_day  |   fw    |   index   | start_day |
# | &lt;integer&gt; | &lt;integer&gt; | &lt;float&gt; | &lt;integer&gt; | &lt;integer&gt; |
# +===========+===========+=========+===========+===========+
# | 244       | 248       | 15.0    | 0         | 244       |
# +-----------+-----------+---------+-----------+-----------+
# | 245       | 248       | 15.0    | 0         | 244       |
# +-----------+-----------+---------+-----------+-----------+
# | 246       | 248       | 15.0    | 0         | 244       |
# +-----------+-----------+---------+-----------+-----------+
# | 247       | 248       | 15.0    | 0         | 244       |
# +-----------+-----------+---------+-----------+-----------+
# | 248       | 248       | 15.0    | 0         | 244       |
# +-----------+-----------+---------+-----------+-----------+
# | 247       | 249       | 16.0    | 1         | 247       |
# +-----------+-----------+---------+-----------+-----------+
# | 248       | 249       | 16.0    | 1         | 247       |
# +-----------+-----------+---------+-----------+-----------+
# | 249       | 249       | 16.0    | 1         | 247       |
# +-----------+-----------+---------+-----------+-----------+
</code></pre>
<p>Also, I don’t want to speak for the core team, but <code>explode</code> does appear to be on the roadmap:</p>
<p><a href="https://github.com/elixir-explorer/explorer/issues/296" class="onebox" target="_blank" rel="noopener nofollow ugc">https://github.com/elixir-explorer/explorer/issues/296</a></p>
<p>So if/when that functionality is added, you can do a nearly one-to-one translation of the Pandas code.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="306819" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/explorer-dataframe-with-startdate-and-enddate-columns-to-timeline/59395/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-306819" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="306819"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-solved cat-solved" title="Marked as solution"></div>
  </section>
</div>
    <div class="postbit" id="306941" data-post-id="306941">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sehHeiden" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sehHeiden/120/31707_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sehHeiden
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks for you help. You completly deconstructed it computed the inner list and than made a new DataFrame.</p>
<p>I think, we don’t have to do everything, like others do, but it has to make sense within its inner logic.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="306941" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/explorer-dataframe-with-startdate-and-enddate-columns-to-timeline/59395/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-306941" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="306941"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>