# How to create hiearchical multi-index dataframe from multiple dataframes?

I have multiple dataframes with identical shape, say: d1 = {‘time’: [1,2,3,4], ‘A’: [55.5,55.5,55.5,55.5], ‘B’:[55.5,55.5,55.5,55.5]} d2 = {‘time’: [1,2,3,4], ‘A’: [7,6,5,4], ‘B’:[9,8,7,6]} d3 = {‘time’: [1,2,3,4], ‘A’: [1,2,3,4], ‘B’:[2,3,4,5]} df1 = pd.DataFrame(data = d1) df2 = pd.DataFrame(data = d2) df3 = pd.DataFrame(data = d3) They will always have the same column names and the entries… Read More How to create hiearchical multi-index dataframe from multiple dataframes?

# How to turn a matrix of nested vectors into a vector of nested vectors

I am producing a matrix of pairs (= nested vectors) like so: x←⍳10 y←⍳10 x∘.,y But for further processing I need to have the pairs in one vector of pairs. If I apply ravel: ,/x∘.,y then the pairs are not anymore nested. How to transform the matrix into a vector and retain the nested pairs?… Read More How to turn a matrix of nested vectors into a vector of nested vectors

# Even Fibonacci numbers Sum

Even Fibonacci numbers sum whose values do not exceed four million. I am using multiline function in APL, but not getting the output: result←Euler2 a;b;c;sum;i;limit b←0 c←1 sum←0 i←0 limit←4000000 :For i :In limit a←b b←c c←a+b :If (0=2|c) sum←(sum+c) :EndIf :EndFor result←sum >Solution : Warning: opinions below. I would avoid using manual loops and… Read More Even Fibonacci numbers Sum