Questions tagged [literate-programming]

A literate program embeds source code in an essay documenting the program.

Literate programming was introduced by Donald Knuth as an alternative to the structured programming. Literate programming encourages programmers to structure their programs by the flow of their thoughts, i.e., in a way that makes it easy to present and document.

158 questions
0
votes
2 answers

How to create new rows in a dataframe based on column values

I have a table of skus that need to be placed in locations. Based on the volume that a sku has determines how many locations a sku needs. There are a limited number of locations so I need to prioritize based on how much volume will be in a location.…
Jill Cox
  • 1
  • 1
0
votes
0 answers

Resources about a video decoder implementation in C

I'm looking for any resources similar to the book "Understanding MP3" by Martin Ruckert, about how to implement a video decoder in C. In that book the author uses the literate programming to implement a MP3 decoder and explains it line by line. I…
0
votes
1 answer

Literate programming, org mode, function declaration

I want to write a Literate Program with org-mode. Let's say I have the following function: fn do_stuff() { // 200 lines of code go here. } I would write something like that in org-mode: #+BEGIN_SRC rust :tangle /some/path fn…
Refael Sheinker
  • 713
  • 7
  • 20
0
votes
1 answer

How can I iterate in dataframe and get output for each group? Now I get only one line and one group is not recognized

I need to iterate through each dataset in the dataframe based on multiple indexes ('Treatment', 'individual', 'regime'). I want to apply curve fit using x and y for each Treatment, individual and regime. Currently I am able to use only one…
0
votes
0 answers

I am trying to iterate through keys and update values, but ALL of my data is getting stored for EVERY key

Previously loaded are data files called hud_data and ahrs2_data. Code is as follows: # Create keys for UAV dictionary with vehicles UAV_dict = {} for i in range(1, 6): UAV_dict["veh_{0}".format(i)] = [] # Create empty vehicle…
0
votes
2 answers

Identify equal values in rows

I am trying to replicate this excel formula: enter image description here Excel =IF(AND(var1[i+1]=var1[i],var2[i+1]=var2[i],var3[i+1]=var3[i]),0,1) Basically I need to identify if row[i+1] is equal to row[i] using three (3) variables:…
Carlos
  • 5
  • 2
0
votes
1 answer

python iterate / loop over two columns and drop entire row after value is first found in either column a or column b

I have a dataframe with 15 columns being used to calculate a score. Two columns (a & b) are my independent variables of which a & b both have duplicate values. Column C represents the score being calculated- of which i have sorted the dataframe by…
0
votes
1 answer

remove unwanted pyweb indentation

@d path @{/path/to/the/directory/@} @o code @{ filename = '@the_file' @} Running python3 -m pyweb test.w -wHTML results in the following code file: filename = ' /path/to/the/directory/the_file' The 12 space characters inside the…
bgukw
  • 51
  • 4
0
votes
1 answer

Emacs 27 looses code blocks while tangling file

Emacs 25 and earlier versions tangle my emacs config https://github.com/zahardzhan/well-tuned-emacs/blob/master/README.org perfectly well, but Emacs 27 looses some code blocks for unknown reason. What is wrong with the latest org-mode? Does it…
0
votes
1 answer

iterating pandas rows using .apply()

I wanted to iterate through the pandas data frame but for some reason it does not work with .apply() method. train = pd.read_csv('../kaggletrain') pclass = train['Pclass'] # pclass has list of data with either 1, 2 or 3.. # so wanted to return…
bmaster69
  • 121
  • 9
0
votes
1 answer

How to specify plot size together with plot code in Sweave or Knitr

I am trying to produce a document using Sweave or Knitr which contains plots. Here is a minimal example for Sweave: \documentclass{article} \title{Plot example} \begin{document} \maketitle <>= library("graphics") myplot = function(n) { …
Metamorphic
  • 732
  • 6
  • 16
0
votes
1 answer

Why the loop is not iterating each row?

I have a dataframe offer_received_datalike this: customer_id offer_id time offer_received offer_viewed 0 78afa995795e4d85b5d9ceeca43f5fef 9b98b8c7a33c4b65b9aebfe6a799e6d9 0.0 1…
wawawa
  • 2,835
  • 6
  • 44
  • 105
0
votes
2 answers

How can I pass *.py to pycco via tox?

The following command works: $ pycco *.py # generates literate-style documentation # for all .py files in the current folder And the following snippet in my tox.ini file works as expected: [testenv:pycco] deps = pycco commands = pycco…
lofidevops
  • 15,528
  • 14
  • 79
  • 119
0
votes
1 answer

How do I remove quotes/cartouches from document output on Isabelle?

Consider this snippet: lemma no_lift: assumes ‹∀L . ⟦γ L⟧ ≠ set L› ― ‹Miner \<^term>‹γ› is non-trivial.› defines ‹γ' P N ≡ γ P› shows ‹∀P. ∃N. set N ∩ ⟦γ' P N⟧ ≠ {}› When I generate latex or HTML output locally, the…
Søren Debois
  • 5,598
  • 26
  • 48
0
votes
2 answers

Print unique key from list map iterate groovy

I just want to grep name key. I do not care how many values I will have later but just want to print value whose keys are just starting with the name. I have tried with regex but it did not work. def data = [ name0 : 'Foo Bar', name1 :…
Mayank C Koli
  • 21
  • 1
  • 3