# General Usage

**URL:** https://discourse.julialang.org/c/usage/6.md?page=325

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

**Page:** 326

---

## [Mutable vs immutable struct: modifying an array field](https://discourse.julialang.org/t/mutable-vs-immutable-struct-modifying-an-array-field/94976)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 4\
**Last updated:** [February 22, 2023, 8:15am UTC](https://discourse.julialang.org/t/mutable-vs-immutable-struct-modifying-an-array-field/94976 "2023-02-22T08:15:32Z")

</div>

I am confused about the mutable vs immutable struct documentation. For composite types, this means that the identity of the values of its fields will never change. When the fields are bits types, that means their bits …

---

## [How to average column values in a dataframe based on multiple other matching columns?](https://discourse.julialang.org/t/how-to-average-column-values-in-a-dataframe-based-on-multiple-other-matching-columns/94998)

<div class="topic-metadata">

**Author:** [@Name1](https://discourse.julialang.org/u/Name1)\
**Replies:** 2\
**Last updated:** [February 22, 2023, 6:32am UTC](https://discourse.julialang.org/t/how-to-average-column-values-in-a-dataframe-based-on-multiple-other-matching-columns/94998 "2023-02-22T06:32:18Z")

</div>

Hi all, I’ve created a DataFrame as seen below: using DataFrames # package dependency original\_df = DataFrame(; Year=Int\[\], Name=String\[\], Surname=String\[\], Rating=Int\[\], ValueOne=Float64\[\], ValueTwo=Float64\[\]) pus…

---

## [A way to define legends for Makie recipes?](https://discourse.julialang.org/t/a-way-to-define-legends-for-makie-recipes/88449)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 5\
**Last updated:** [October 19, 2022, 4:13pm UTC](https://discourse.julialang.org/t/a-way-to-define-legends-for-makie-recipes/88449 "2022-10-19T16:13:59Z")

</div>

After successfully converting all of my plotting functions to actual Makie recipes, I am now wondering if there is an official way to provide legends for custom plots. I know that at the moment, recipes cannot modify th…

---

## [Pluto notebooks: HTML version with responsive sliders](https://discourse.julialang.org/t/pluto-notebooks-html-version-with-responsive-sliders/94982)

<div class="topic-metadata">

**Author:** [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Replies:** 0\
**Last updated:** [February 21, 2023, 10:26pm UTC](https://discourse.julialang.org/t/pluto-notebooks-html-version-with-responsive-sliders/94982 "2023-02-21T22:26:53Z")

</div>

Hi, I have seen some cases where the static versions of Pluto notebooks are responsive to slider changes, even though they are static HTML files. An example is the course given by @jbrea here. I wonder how that functi…

---

## [Specifying type of interpolated image in a struct](https://discourse.julialang.org/t/specifying-type-of-interpolated-image-in-a-struct/94978)

<div class="topic-metadata">

**Author:** [@rakshith95](https://discourse.julialang.org/u/rakshith95)\
**Replies:** 2\
**Last updated:** [February 21, 2023, 9:08pm UTC](https://discourse.julialang.org/t/specifying-type-of-interpolated-image-in-a-struct/94978 "2023-02-21T21:08:08Z")

</div>

I have a struct struct some\_struct{} interpolated\_img end where I want to store an interpolation ‘image’. When I print the typeof() such an image, I get Interpolations.BSplineInterpolation{Gray{Float64}, 2, Matrix{…

---

## [TimeSeries Database](https://discourse.julialang.org/t/timeseries-database/94920)

<div class="topic-metadata">

**Author:** [@harsh\_kumar](https://discourse.julialang.org/u/harsh_kumar)\
**Replies:** 8\
**Last updated:** [February 21, 2023, 8:24pm UTC](https://discourse.julialang.org/t/timeseries-database/94920 "2023-02-21T20:24:08Z")

</div>

I have a process (websocket) that push data into a channel on realtime (couple of item every second). Each data points has a timestamp, group columns, and additional fields. I want to store this data on continuous basis …

---

## [Analysis of largescale python vs largescale julia?](https://discourse.julialang.org/t/analysis-of-largescale-python-vs-largescale-julia/94942)

<div class="topic-metadata">

**Author:** [@zeroexcuses](https://discourse.julialang.org/u/zeroexcuses)\
**Replies:** 7\
**Last updated:** [February 21, 2023, 8:13pm UTC](https://discourse.julialang.org/t/analysis-of-largescale-python-vs-largescale-julia/94942 "2023-02-21T20:13:59Z")

</div>

Does anyone have recommendation on article for largescale python codebase vs largescale julia codebase ? I’m fairly convinced Julia unlikely to replace OCaml / Scala for me, but I’m curious on reading about managing lar…

---

## [Pkg within compiled app \[PackageCompiler\]](https://discourse.julialang.org/t/pkg-within-compiled-app-packagecompiler/94963)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 2\
**Last updated:** [February 21, 2023, 8:07pm UTC](https://discourse.julialang.org/t/pkg-within-compiled-app-packagecompiler/94963 "2023-02-21T20:07:30Z")

</div>

Hi, I am experimenting with PackageCompiler.jl and was surprised that the app I build (using incremental=true) does not include Pkg itself. Does someone whether this is intended and if so, whether it is possible to por…

---

## [ZMQ CONFLATE Option](https://discourse.julialang.org/t/zmq-conflate-option/94800)

<div class="topic-metadata">

**Author:** [@hanshinlee77](https://discourse.julialang.org/u/hanshinlee77)\
**Replies:** 2\
**Last updated:** [February 21, 2023, 4:43pm UTC](https://discourse.julialang.org/t/zmq-conflate-option/94800 "2023-02-21T16:43:20Z")

</div>

Hi, I am using ZMQ.jl for a PUB-SUB socket operation. Occasionally, the operation gets into a situation where the subscriber becomes slow and as a result the messages from the publisher accumulates in the subscriber’s b…

---

## [Collecting lint](https://discourse.julialang.org/t/collecting-lint/94969)

<div class="topic-metadata">

**Author:** [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Replies:** 0\
**Last updated:** [February 21, 2023, 4:08pm UTC](https://discourse.julialang.org/t/collecting-lint/94969 "2023-02-21T16:08:05Z")

</div>

Are the linting facilities (packages?) described somewhere in one place? I know that I can use a linter in VSCode, but how about without? Any hints and experience will be appreciated.

---

## [Why I get 1-element Vector{Sym} instead of just number as answer from SymPy?](https://discourse.julialang.org/t/why-i-get-1-element-vector-sym-instead-of-just-number-as-answer-from-sympy/94946)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 4\
**Last updated:** [February 21, 2023, 3:25pm UTC](https://discourse.julialang.org/t/why-i-get-1-element-vector-sym-instead-of-just-number-as-answer-from-sympy/94946 "2023-02-21T15:25:18Z")

</div>

Hi all, it is just a curious question. I am calculating k from this \\int\_{0}^{180} kx^{2} (180 - x) dx = 1 solving for k I should obtain \\frac{1}{87,480,000} but why the answer contains 1-element Vector? instead of j…

---

## [How to add Another Line Plot to DataFrame and CSV Plot?](https://discourse.julialang.org/t/how-to-add-another-line-plot-to-dataframe-and-csv-plot/94910)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 2\
**Last updated:** [February 21, 2023, 9:10am UTC](https://discourse.julialang.org/t/how-to-add-another-line-plot-to-dataframe-and-csv-plot/94910 "2023-02-21T09:10:35Z")

</div>

Hi all, I am trying to add another plot of Book Value per Share. It is following this tutorial: https://www.juliabloggers.com/using-julia-for-data-science-part-03-plotting/ this is my code: using CSV, Dates, DataFra…

---

## [Package errored during testing on Github Actions (exit code 541541187)](https://discourse.julialang.org/t/package-errored-during-testing-on-github-actions-exit-code-541541187/94947)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 0\
**Last updated:** [February 21, 2023, 6:00am UTC](https://discourse.julialang.org/t/package-errored-during-testing-on-github-actions-exit-code-541541187/94947 "2023-02-21T06:00:52Z")

</div>

For some reason that I don’t understand, tests for a package that I’m working on keep failing on Windows with the following error message: ERROR: LoadError: Package ApproxFunOrthogonalPolynomials errored during testing …

---

## [How to check where memory is used in REPL?](https://discourse.julialang.org/t/how-to-check-where-memory-is-used-in-repl/94895)

<div class="topic-metadata">

**Author:** [@jsjie](https://discourse.julialang.org/u/jsjie)\
**Replies:** 4\
**Last updated:** [February 21, 2023, 1:14am UTC](https://discourse.julialang.org/t/how-to-check-where-memory-is-used-in-repl/94895 "2023-02-21T01:14:16Z")

</div>

My package suffers from large memory usage, and I wanna know why by testing in REPL. I track the total message in two ways: examing result of top use the following code in REPL: my\_command = pipeline(\`cat /proc/$(ge…

---

## [Why CPU % reaches 80s when running julia code with no parallization?](https://discourse.julialang.org/t/why-cpu-reaches-80s-when-running-julia-code-with-no-parallization/94936)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 7\
**Last updated:** [February 21, 2023, 12:18am UTC](https://discourse.julialang.org/t/why-cpu-reaches-80s-when-running-julia-code-with-no-parallization/94936 "2023-02-21T00:18:22Z")

</div>

I have a julia code that consumes 34s (when using @time). I don’t have any parallelization in it (i.e., no parallel package is called nor directives) and nthreads()=1. However, when I check the task manager, I find that …

---

## [@infiltrate not getting triggered](https://discourse.julialang.org/t/infiltrate-not-getting-triggered/94937)

<div class="topic-metadata">

**Author:** [@prittjam](https://discourse.julialang.org/u/prittjam)\
**Replies:** 6\
**Last updated:** [February 20, 2023, 10:45pm UTC](https://discourse.julialang.org/t/infiltrate-not-getting-triggered/94937 "2023-02-20T22:45:23Z")

</div>

It seems that sometimes @infiltrate is not stopping execution. I don’t understand when and why it is happening. Anyone else experiences similar?

---

## [Working with Julia Symbolics](https://discourse.julialang.org/t/working-with-julia-symbolics/94933)

<div class="topic-metadata">

**Author:** [@Cougar](https://discourse.julialang.org/u/Cougar)\
**Replies:** 2\
**Last updated:** [February 20, 2023, 10:35pm UTC](https://discourse.julialang.org/t/working-with-julia-symbolics/94933 "2023-02-20T22:35:41Z")

</div>

Using Symbolics, wanting Julia to determine that \\lfloor\\, 10 \\sqrt{3} \\,\\rfloor = 17, and print 17 instead of floor(10sqrt(3)) … julia\> x = 10 \* Symbolics.Term(sqrt,\[3\]) 10sqrt(3) julia\> y = floor(x) floor(10sqrt(3))…

---

## [Move Colorbar in Makie a little to the right?](https://discourse.julialang.org/t/move-colorbar-in-makie-a-little-to-the-right/94912)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 2\
**Last updated:** [February 20, 2023, 9:28pm UTC](https://discourse.julialang.org/t/move-colorbar-in-makie-a-little-to-the-right/94912 "2023-02-20T21:28:57Z")

</div>

Hi all. I am doing some figures in InteractiveViz.jl that is based in GLMakie. I am adding a Colorbar in place (not with the standard f\[1,2\] of axis) and I need to move it a bit the the right. Any help? Colorbar(viz.…

---

## [Reverse-Mode AD VJP choices all failed](https://discourse.julialang.org/t/reverse-mode-ad-vjp-choices-all-failed/94929)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 3\
**Last updated:** [February 20, 2023, 7:03pm UTC](https://discourse.julialang.org/t/reverse-mode-ad-vjp-choices-all-failed/94929 "2023-02-20T19:03:58Z")

</div>

Hi, I am running a neural network with Flux, Zygote, and Optimization libraries. The code is rather long and I have not created a MWE yet (which could take quite a while). The code ran about 800 iterations without troub…

---

## [One-element vector (w/o allocations)](https://discourse.julialang.org/t/one-element-vector-w-o-allocations/94922)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 2\
**Last updated:** [February 20, 2023, 6:36pm UTC](https://discourse.julialang.org/t/one-element-vector-w-o-allocations/94922 "2023-02-20T18:36:12Z")

</div>

Is there a package for a non-allocating representation of a single-element vector? I am basically thinking of the equivalent of struct OneElementVector{T} \<: AbstractVector{T} x::T end Base.size(v::OneElementVector…

---

## [Would it be interesting to optimize print(io, xs...) to be type stable?](https://discourse.julialang.org/t/would-it-be-interesting-to-optimize-print-io-xs-to-be-type-stable/94816)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 2\
**Last updated:** [February 20, 2023, 4:22pm UTC](https://discourse.julialang.org/t/would-it-be-interesting-to-optimize-print-io-xs-to-be-type-stable/94816 "2023-02-20T16:22:02Z")

</div>

I noticed that the varargs version of print/println is not type stable and it affects the performance. Some test code below. It’s interesting that map, foreach, and fold are implemented in a type stable way, so… println …

---

## [Slow Dict comprehension](https://discourse.julialang.org/t/slow-dict-comprehension/94797)

<div class="topic-metadata">

**Author:** [@bbejanov](https://discourse.julialang.org/u/bbejanov)\
**Replies:** 5\
**Last updated:** [February 20, 2023, 3:48pm UTC](https://discourse.julialang.org/t/slow-dict-comprehension/94797 "2023-02-20T15:48:13Z")

</div>

If I construct a Dict using a comprehension I get orders of magnitude slower speed, compared to starting with an empty Dict and running an equivalent loop to fill it in. I’m surprised, because I expected both ways to be …

---

## [How to Plot Line Graph from CSV Row Data](https://discourse.julialang.org/t/how-to-plot-line-graph-from-csv-row-data/94875)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 3\
**Last updated:** [February 20, 2023, 10:44am UTC](https://discourse.julialang.org/t/how-to-plot-line-graph-from-csv-row-data/94875 "2023-02-20T10:44:31Z")

</div>

Hi all, I have this CSV: I want to plot a line graph, with x-tick is the year “2018 2019 2020 2021” From Revenue till Total Equity. So there will be 5 different lines inside one plot. For the y-tick can it be ma…

---

## [Can Julia Create Synastry Table (Astrology Compatibility Calculator)?](https://discourse.julialang.org/t/can-julia-create-synastry-table-astrology-compatibility-calculator/94867)

<div class="topic-metadata">

**Author:** [@Freya\_the\_Goddess](https://discourse.julialang.org/u/Freya_the_Goddess)\
**Replies:** 11\
**Last updated:** [February 20, 2023, 10:43am UTC](https://discourse.julialang.org/t/can-julia-create-synastry-table-astrology-compatibility-calculator/94867 "2023-02-20T10:43:21Z")

</div>

Hi all, I am learning astro.com that can create Synastry, a Synastry is a comparison of natal chart between two people to measure the compatibility, ever wonder why attracted to someone really high? given that person fa…

---

## [Would it be possible to infer \`Val{::Bool)\` as \`Union{Val{true}, Val{false}}\`?](https://discourse.julialang.org/t/would-it-be-possible-to-infer-val-bool-as-union-val-true-val-false/94728)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 3\
**Last updated:** [February 20, 2023, 8:25am UTC](https://discourse.julialang.org/t/would-it-be-possible-to-infer-val-bool-as-union-val-true-val-false/94728 "2023-02-20T08:25:05Z")

</div>

Consider the function julia\> f(x::Bool) = Val(x) f (generic function with 1 method) julia\> @code\_typed f(true) CodeInfo( 1 ─ %1 = Core.apply\_type(Base.Val, x)::Type{Val{\_A}} where \_A │ %2 = %new(%1)::Val └── ret…

---

## [Warntype\_last() outputs red ::Ref{Float64}](https://discourse.julialang.org/t/warntype-last-outputs-red-ref-float64/94900)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 4\
**Last updated:** [February 20, 2023, 8:13am UTC](https://discourse.julialang.org/t/warntype-last-outputs-red-ref-float64/94900 "2023-02-20T08:13:48Z")

</div>

Unfortunately, I have not managed to create an MVE, but I think I can ask a good question: I use a Ref to make a Float64 mutable within a struct. Using a mutable struct arguably makes more sense, and resolves my issue,…

---

## [Return value of findmin/findmax](https://discourse.julialang.org/t/return-value-of-findmin-findmax/94567)

<div class="topic-metadata">

**Author:** [@uniment](https://discourse.julialang.org/u/uniment)\
**Replies:** 15\
**Last updated:** [February 20, 2023, 5:42am UTC](https://discourse.julialang.org/t/return-value-of-findmin-findmax/94567 "2023-02-20T05:42:58Z")

</div>

I would love if functions like findmin and findmax used a named tuple for their return value, because I can never remember which element of the return value is which (and code like findmax(arr)\[2\] has high mental load as…

---

## [Strange error when calling a c function using ccall](https://discourse.julialang.org/t/strange-error-when-calling-a-c-function-using-ccall/94840)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 11\
**Last updated:** [February 20, 2023, 3:50am UTC](https://discourse.julialang.org/t/strange-error-when-calling-a-c-function-using-ccall/94840 "2023-02-20T03:50:16Z")

</div>

I need to use code in c++, for which I made a c-style function and use ccall. I also have tried CxxWrap. In both cases, I sometimes got the following lengthy message when calling the c function. free(): invalid pointer …

---

## [How to re-use threads?](https://discourse.julialang.org/t/how-to-re-use-threads/94731)

<div class="topic-metadata">

**Author:** [@Amro](https://discourse.julialang.org/u/Amro)\
**Replies:** 19\
**Last updated:** [February 20, 2023, 3:23am UTC](https://discourse.julialang.org/t/how-to-re-use-threads/94731 "2023-02-20T03:23:04Z")

</div>

I have the below simple MWE for learning purposes on how to synchronize between Threads.@spawn processes accessing a SharedArray. I expect the results to be as below, however, it stuck before going to the following itera…

---

## [Union() - Remove duplicates for multi-dimensional array](https://discourse.julialang.org/t/union-remove-duplicates-for-multi-dimensional-array/94894)

<div class="topic-metadata">

**Author:** [@Students](https://discourse.julialang.org/u/Students)\
**Replies:** 0\
**Last updated:** [February 20, 2023, 3:01am UTC](https://discourse.julialang.org/t/union-remove-duplicates-for-multi-dimensional-array/94894 "2023-02-20T03:01:08Z")

</div>

Hello, Could you please help me to extend the union() for a multidimensional array? Remove duplicate if all the cols match. Eg : \[\[0.0, 0.0, 150.0, 300.0, 350.0\], \[1040.0, 1040.0, 1040.0, 1040.0, 1020.0\]\] —\> \[\[0.0, 150…

[Previous page](https://discourse.julialang.org/c/usage/6.md?page=324)

[Next page](https://discourse.julialang.org/c/usage/6.md?page=326)
