# Latest

**URL:** https://discourse.julialang.org/latest.md?page=1474

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 1475

---

## [How to write a sum constraint in JuMP with condition](https://discourse.julialang.org/t/how-to-write-a-sum-constraint-in-jump-with-condition/56269)

<div class="topic-metadata">

**Author:** [@GraceMabele](https://discourse.julialang.org/u/GraceMabele)\
**Replies:** 4\
**Last updated:** [March 1, 2021, 8:30pm UTC](https://discourse.julialang.org/t/how-to-write-a-sum-constraint-in-jump-with-condition/56269 "2021-03-01T20:30:11Z")

</div>

Hi, I am having trouble writing the following constraint in JuMP I currently have it written as below but it is not returning the desired output. @constraints model begin constraint\_1\[n in n\], sum(w\[i,n,n…

---

## [Dealing with a bunch of errors](https://discourse.julialang.org/t/dealing-with-a-bunch-of-errors/56276)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 1\
**Last updated:** [March 1, 2021, 8:16pm UTC](https://discourse.julialang.org/t/dealing-with-a-bunch-of-errors/56276 "2021-03-01T20:16:43Z")

</div>

I just got the latest julia and VSCode for Linux and used \] dev to get a bunch of packages to look at. I encountered what seemed like an implausible number of errors, and in some cases errors whose source I am unsure of…

---

## [Multithreading an embarrassingly parallel algorithm increases garbage collection](https://discourse.julialang.org/t/multithreading-an-embarrassingly-parallel-algorithm-increases-garbage-collection/56261)

<div class="topic-metadata">

**Author:** [@andrekal](https://discourse.julialang.org/u/andrekal)\
**Replies:** 12\
**Last updated:** [March 1, 2021, 8:04pm UTC](https://discourse.julialang.org/t/multithreading-an-embarrassingly-parallel-algorithm-increases-garbage-collection/56261 "2021-03-01T20:04:14Z")

</div>

Hi, Hope this MWE is clear enough. I’m trying to implement a certain algorithm in which I fill out a matrix (about 5000x6000) with known dimensions column by column. The calculation of each column is completely indepen…

---

## [Add a column in dataframe based on another column](https://discourse.julialang.org/t/add-a-column-in-dataframe-based-on-another-column/56275)

<div class="topic-metadata">

**Author:** [@Shazman](https://discourse.julialang.org/u/Shazman)\
**Replies:** 4\
**Last updated:** [March 1, 2021, 7:35pm UTC](https://discourse.julialang.org/t/add-a-column-in-dataframe-based-on-another-column/56275 "2021-03-01T19:35:21Z")

</div>

Hi I have two dataframe and the " IID " in A and " X " in B are same but order is not. I want to add column " phenotype " of B into A according to column IID. how can I do it? dataframe A Herd.when.genotyped X…

---

## [StatsBase.summarystats not defined for Rational numbers](https://discourse.julialang.org/t/statsbase-summarystats-not-defined-for-rational-numbers/55165)

<div class="topic-metadata">

**Author:** [@bluesmoon](https://discourse.julialang.org/u/bluesmoon)\
**Replies:** 3\
**Last updated:** [March 1, 2021, 7:11pm UTC](https://discourse.julialang.org/t/statsbase-summarystats-not-defined-for-rational-numbers/55165 "2021-03-01T19:11:29Z")

</div>

Hi, I have code that uses StatsBase.summarystats on a Vector{T} where T \<: Real sometimes T can be Rational, and summarystats fails as it is not defined on Rational. Is there an alternative I can use? My current work…

---

## ["Simpler" findfirst/firstall methods?](https://discourse.julialang.org/t/simpler-findfirst-firstall-methods/56240)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 16\
**Last updated:** [March 1, 2021, 6:46pm UTC](https://discourse.julialang.org/t/simpler-findfirst-firstall-methods/56240 "2021-03-01T18:46:35Z")

</div>

I wonder if there is a reason (computational, to avoid name collision…) while there aren’t “simpler” findfirst/firstall methods in Base: a = \["aa","cc","cc","bb","cc","aa"\] findfirst(x -\> x == "cc",a) # ok, but user nee…

---

## [Which block \`@inbounds\` actually avoid testing bounds?](https://discourse.julialang.org/t/which-block-inbounds-actually-avoid-testing-bounds/56267)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 3\
**Last updated:** [March 1, 2021, 6:45pm UTC](https://discourse.julialang.org/t/which-block-inbounds-actually-avoid-testing-bounds/56267 "2021-03-01T18:45:31Z")

</div>

For example, this simple function: function f(vec1,vec2) for i in 2:length(vec1) vec1\[i\] = vec1\[i\] - vec2\[i-1\] end nothing end I get: julia\> @btime f($vec1,$vec2) 759.284 ns (0 allocations: 0 bytes) If …

---

## [Inverse transform sampling (discrete distributions sampling)?](https://discourse.julialang.org/t/inverse-transform-sampling-discrete-distributions-sampling/56255)

<div class="topic-metadata">

**Author:** [@riegel\_gestr](https://discourse.julialang.org/u/riegel_gestr)\
**Replies:** 4\
**Last updated:** [March 1, 2021, 6:29pm UTC](https://discourse.julialang.org/t/inverse-transform-sampling-discrete-distributions-sampling/56255 "2021-03-01T18:29:49Z")

</div>

I am currently working on inverse transform sampling: Inverse transform sampling - Wikipedia, also here http://dept.stat.lsa.umich.edu/~jasoneg/Stat406/lab5.pdf I have implemented the following version of the algo: us…

---

## [SOCP constraint](https://discourse.julialang.org/t/socp-constraint/56234)

<div class="topic-metadata">

**Author:** [@SonLe](https://discourse.julialang.org/u/SonLe)\
**Replies:** 3\
**Last updated:** [March 1, 2021, 6:25pm UTC](https://discourse.julialang.org/t/socp-constraint/56234 "2021-03-01T18:25:14Z")

</div>

Hi, I have a question about verifying the SOCP constraint in JuMP. So far, my SOCP constraint is \\epsilon t \\geq \\theta\\|\\mathbf{x}\\|\_{2}+\\frac{1}{N} \\sum\_{i \\in\[N\]} r^{i} and my code is @constraint(model, \[ϵ \* t \* (1…

---

## [MethodError: no method matching getindex(::VariableRef, ::Int64)](https://discourse.julialang.org/t/methoderror-no-method-matching-getindex-variableref-int64/56252)

<div class="topic-metadata">

**Author:** [@Kavitha](https://discourse.julialang.org/u/Kavitha)\
**Replies:** 4\
**Last updated:** [March 1, 2021, 5:55pm UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-getindex-variableref-int64/56252 "2021-03-01T17:55:33Z")

</div>

Hi, I’m using JuMP to solve my optimization problem. Following is a part of the formulation and its causing the methoderror. for t in 1:tp for j in 1:nt c10= @constraint(p, LT\[j\]\[t\] - (l\[j\] \* Z\[j\]\[t\]) == 0) set\_nam…

---

## [Introducing new users to Revise.jl](https://discourse.julialang.org/t/introducing-new-users-to-revise-jl/56006)

<div class="topic-metadata">

**Author:** [@rikh](https://discourse.julialang.org/u/rikh)\
**Replies:** 5\
**Last updated:** [March 1, 2021, 5:36pm UTC](https://discourse.julialang.org/t/introducing-new-users-to-revise-jl/56006 "2021-03-01T17:36:20Z")

</div>

I remember from myself that I put down Julia about two years ago because I didn’t know about Revise.jl. Only months later, I gave Julia a second shot. I’m not alone in this. I see this pop up time and again on this forum…

---

## [Subset a dataframe by column of another dataframe](https://discourse.julialang.org/t/subset-a-dataframe-by-column-of-another-dataframe/56263)

<div class="topic-metadata">

**Author:** [@Shazman](https://discourse.julialang.org/u/Shazman)\
**Replies:** 4\
**Last updated:** [March 1, 2021, 5:17pm UTC](https://discourse.julialang.org/t/subset-a-dataframe-by-column-of-another-dataframe/56263 "2021-03-01T17:17:26Z")

</div>

I have two dataframes (A) with 6 columns and (B) with 1 column. and B is subset of second column of A, now I want subset the dataframe (A) based on the values of B. how can I do it ? here is my dataframes. Blockqu…

---

## [How do I refer to the directory "one above" the current one?Context: I have a sc](https://discourse.julialang.org/t/how-do-i-refer-to-the-directory-one-above-the-current-one-context-i-have-a-sc/56264)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 1\
**Last updated:** [March 1, 2021, 4:54pm UTC](https://discourse.julialang.org/t/how-do-i-refer-to-the-directory-one-above-the-current-one-context-i-have-a-sc/56264 "2021-03-01T16:54:38Z")

</div>

How do I refer to the directory “one above” the current one? Context: I have a script in /src and have @\_\_DIR\_\_ in that script. But I want to refer to the parent folder, the one containint the Project.toml. joinpath(d, …

---

## [Hi folks. Does anybody know how to parse/convert a String to a Distribution? For e](https://discourse.julialang.org/t/hi-folks-does-anybody-know-how-to-parse-convert-a-string-to-a-distribution-for-e/56257)

<div class="topic-metadata">

**Author:** [@BridgeBot](https://discourse.julialang.org/u/BridgeBot)\
**Replies:** 2\
**Last updated:** [March 1, 2021, 4:33pm UTC](https://discourse.julialang.org/t/hi-folks-does-anybody-know-how-to-parse-convert-a-string-to-a-distribution-for-e/56257 "2021-03-01T16:33:05Z")

</div>

Hi folks. Does anybody know how to parse/convert a String to a Distribution? For example “Beta(2,5)” -\> Beta{Float64}(α=2.0, β=5.0). I am trying to store probability distribution values in JSON format and read them into…

---

## [Using dict\_list of DrWatson on a cluster](https://discourse.julialang.org/t/using-dict-list-of-drwatson-on-a-cluster/56258)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 0\
**Last updated:** [March 1, 2021, 3:40pm UTC](https://discourse.julialang.org/t/using-dict-list-of-drwatson-on-a-cluster/56258 "2021-03-01T15:40:36Z")

</div>

I am using DrWatson on a cluster. I would like to use the dict\_list() in order to get all permutations of the parameters set. However, every script I run has to run many times (over many workers) with the same set of p…

---

## [How does Julia store array sizes?](https://discourse.julialang.org/t/how-does-julia-store-array-sizes/56226)

<div class="topic-metadata">

**Author:** [@nchisholm](https://discourse.julialang.org/u/nchisholm)\
**Replies:** 3\
**Last updated:** [March 1, 2021, 3:36pm UTC](https://discourse.julialang.org/t/how-does-julia-store-array-sizes/56226 "2021-03-01T15:36:47Z")

</div>

Very simple question, but to my surprise I was unable to find an answer by Googling / searching this forum. Where/how does Julia internally store size/shape/length information for arrays? I know you just use the size fu…

---

## [UnPack does not work in DrWatson on a different machine](https://discourse.julialang.org/t/unpack-does-not-work-in-drwatson-on-a-different-machine/56239)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 2\
**Last updated:** [March 1, 2021, 3:32pm UTC](https://discourse.julialang.org/t/unpack-does-not-work-in-drwatson-on-a-different-machine/56239 "2021-03-01T15:32:00Z")

</div>

I am using DrWatson to run simulations. I wrote everything on my machine and now I am trying to run it on a cluster. I have copied the Project folder and activated and instantiated the Project on the new machine. Howe…

---

## [Does sciml\_train require ensemble to collect MSE of monte carlo solves when connected to a neural network or can I do it with a for loop?](https://discourse.julialang.org/t/does-sciml-train-require-ensemble-to-collect-mse-of-monte-carlo-solves-when-connected-to-a-neural-network-or-can-i-do-it-with-a-for-loop/56171)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 5\
**Last updated:** [March 1, 2021, 3:19pm UTC](https://discourse.julialang.org/t/does-sciml-train-require-ensemble-to-collect-mse-of-monte-carlo-solves-when-connected-to-a-neural-network-or-can-i-do-it-with-a-for-loop/56171 "2021-03-01T15:19:32Z")

</div>

General diffeqflux question. I have a diffeq simulation using DifferentialEquations.jl and solve that works fine by itself. I want to prepend the outputs of a neural network to the solution setup so when trained, it wo…

---

## [Best pkg for symbolic mathematics at Julia](https://discourse.julialang.org/t/best-pkg-for-symbolic-mathematics-at-julia/55312)

<div class="topic-metadata">

**Author:** [@fms-1988](https://discourse.julialang.org/u/fms-1988)\
**Replies:** 4\
**Last updated:** [March 1, 2021, 3:01pm UTC](https://discourse.julialang.org/t/best-pkg-for-symbolic-mathematics-at-julia/55312 "2021-03-01T15:01:16Z")

</div>

I am currently using Sympy. The problem is that it was developed in Python. An alternative is pkg SymEngine, which was developed in C ++. My doubt is: is there a better Pkg than Sympy and SymEngine?

---

## [Symbolic computation: ModelingToolkit vs. SymPy?](https://discourse.julialang.org/t/symbolic-computation-modelingtoolkit-vs-sympy/53046)

<div class="topic-metadata">

**Author:** [@BLI](https://discourse.julialang.org/u/BLI)\
**Replies:** 18\
**Last updated:** [March 1, 2021, 3:00pm UTC](https://discourse.julialang.org/t/symbolic-computation-modelingtoolkit-vs-sympy/53046 "2021-03-01T15:00:15Z")

</div>

With ModelingToolkit in development, I’d like to start using it soon – also for my basic CAS needs. I recently played around with SymPy, and wonder whether ModelingToolkit can handle my cases there… Simple example: show…

---

## [Is there a ready-made function to convert a Gumbo.jl parsed html table into a table like DataFrames.DataFrame?](https://discourse.julialang.org/t/is-there-a-ready-made-function-to-convert-a-gumbo-jl-parsed-html-table-into-a-table-like-dataframes-dataframe/55973)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 2\
**Last updated:** [March 1, 2021, 2:30pm UTC](https://discourse.julialang.org/t/is-there-a-ready-made-function-to-convert-a-gumbo-jl-parsed-html-table-into-a-table-like-dataframes-dataframe/55973 "2021-03-01T14:30:45Z")

</div>

I tried to read through Gumbo.jl pages but I don’t see a function to convert a table tag to a table. Does such functions exists or I need to roll my own?

---

## [Confused by pass-by-sharing](https://discourse.julialang.org/t/confused-by-pass-by-sharing/56233)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 4\
**Last updated:** [March 1, 2021, 2:16pm UTC](https://discourse.julialang.org/t/confused-by-pass-by-sharing/56233 "2021-03-01T14:16:06Z")

</div>

In the following simple stylised script, mutable struct P \<: AbstractP this that end p = P() ... sol1 = optimal(p) q = p p = add(p, something) # p changed sol2 = optimal(p) p = q sol3 = optimal(p) would lik…

---

## [Conditional SUM when the indices of one vector match the indices of another](https://discourse.julialang.org/t/conditional-sum-when-the-indices-of-one-vector-match-the-indices-of-another/56188)

<div class="topic-metadata">

**Author:** [@Dimi](https://discourse.julialang.org/u/Dimi)\
**Replies:** 11\
**Last updated:** [March 1, 2021, 2:13pm UTC](https://discourse.julialang.org/t/conditional-sum-when-the-indices-of-one-vector-match-the-indices-of-another/56188 "2021-03-01T14:13:43Z")

</div>

Hello guys. I am quite new at Julia and coding entirely, so I’d appreciate some help to the probably dumb question below. I am trying to solve an optimisation problem for a nodal system of 24 points. At the moment I am…

---

## [Using Makie with Revise](https://discourse.julialang.org/t/using-makie-with-revise/56195)

<div class="topic-metadata">

**Author:** [@danvenn](https://discourse.julialang.org/u/danvenn)\
**Replies:** 16\
**Last updated:** [March 1, 2021, 2:09pm UTC](https://discourse.julialang.org/t/using-makie-with-revise/56195 "2021-03-01T14:09:13Z")

</div>

Hi - is there a workflow that helps with incrementally building a graph with Makie? At the moment, I am having to restart the REPL when making large changes to my scene (changing a barplot to a line for example). The co…

---

## [Save and Load Random Forest trained with MLJ/ScikitLearn.jl](https://discourse.julialang.org/t/save-and-load-random-forest-trained-with-mlj-scikitlearn-jl/55798)

<div class="topic-metadata">

**Author:** [@rio](https://discourse.julialang.org/u/rio)\
**Replies:** 4\
**Last updated:** [March 1, 2021, 2:08pm UTC](https://discourse.julialang.org/t/save-and-load-random-forest-trained-with-mlj-scikitlearn-jl/55798 "2021-03-01T14:08:25Z")

</div>

I would like to train a Random Forest model (RandomForestRegressor pkg=ScikitLearn) and save the trained model to disk. Then, I would like to load the model and apply it to new data. After training with success, I tried…

---

## [Postdoc in mathematical optimization](https://discourse.julialang.org/t/postdoc-in-mathematical-optimization/56248)

<div class="topic-metadata">

**Author:** [@mbesancon](https://discourse.julialang.org/u/mbesancon)\
**Replies:** 0\
**Last updated:** [March 1, 2021, 1:00pm UTC](https://discourse.julialang.org/t/postdoc-in-mathematical-optimization/56248 "2021-03-01T13:00:18Z")

</div>

The Mathematical Optimization Methods group from the Zuse Institute Berlin is hiring a new postdoctoral researcher: https://www.zib.de/node/4850 Among other activities, the group develops new methods for mixed-integer …

---

## [How to plot distinct plots in grid layout](https://discourse.julialang.org/t/how-to-plot-distinct-plots-in-grid-layout/56242)

<div class="topic-metadata">

**Author:** [@xyz1](https://discourse.julialang.org/u/xyz1)\
**Replies:** 3\
**Last updated:** [March 1, 2021, 12:59pm UTC](https://discourse.julialang.org/t/how-to-plot-distinct-plots-in-grid-layout/56242 "2021-03-01T12:59:04Z")

</div>

Hi, I’m trying to visualize some data with Plots.jl and even with the amazing Plots documentation i am unable to plot a grid (2,2) of plots. Specifically I would like to create something like using Plots plot(rand(100,…

---

## [Tabulated data are treated as rows of strings by CSV.File](https://discourse.julialang.org/t/tabulated-data-are-treated-as-rows-of-strings-by-csv-file/56247)

<div class="topic-metadata">

**Author:** [@arif](https://discourse.julialang.org/u/arif)\
**Replies:** 2\
**Last updated:** [March 1, 2021, 12:59pm UTC](https://discourse.julialang.org/t/tabulated-data-are-treated-as-rows-of-strings-by-csv-file/56247 "2021-03-01T12:59:00Z")

</div>

I am trying to get this table of data representing the SLy equation of state for a neutron star. CSV.File(HTTP.get("http://www.ioffe.ru/astro/NSG/NSEOS/sly4.dat").body) loads the data as strings of a single column inste…

---

## [ROS, ROS2 or PX4 packages in Julia](https://discourse.julialang.org/t/ros-ros2-or-px4-packages-in-julia/56245)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 0\
**Last updated:** [March 1, 2021, 11:57am UTC](https://discourse.julialang.org/t/ros-ros2-or-px4-packages-in-julia/56245 "2021-03-01T11:57:51Z")

</div>

I’ve seen several packages of ROS, ROS2, and PX4 in Julia but they seem to be not maintained anymore. Is there any package or plan for this? Especially about multicopter simulation and experiments.

---

## [In place sorting for views](https://discourse.julialang.org/t/in-place-sorting-for-views/56194)

<div class="topic-metadata">

**Author:** [@Skoffer](https://discourse.julialang.org/u/Skoffer)\
**Replies:** 12\
**Last updated:** [March 1, 2021, 11:55am UTC](https://discourse.julialang.org/t/in-place-sorting-for-views/56194 "2021-03-01T11:55:21Z")

</div>

Maybe I am benchmarking it wrong, but it seems that sorting part of the vector (with the help of @views) is slower than sorting original vector. using BenchmarkTools v = rand(1000); v2 = rand(2000); v2\[500:1499\] .= v;…

[Previous page](https://discourse.julialang.org/latest.md?page=1473)

[Next page](https://discourse.julialang.org/latest.md?page=1475)
