# General Usage

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

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

**Page:** 557

---

## [Why is collect(1:3) === \[1, 2, 3\] false?](https://discourse.julialang.org/t/why-is-collect-1-3-1-2-3-false/66915)

<div class="topic-metadata">

**Author:** [@LeePhillips](https://discourse.julialang.org/u/LeePhillips)\
**Replies:** 11\
**Last updated:** [August 24, 2021, 5:55pm UTC](https://discourse.julialang.org/t/why-is-collect-1-3-1-2-3-false/66915 "2021-08-24T17:55:48Z")

</div>

Both sides of the comparison have the same values and the same type. I must not understand === correctly.

---

## [Transducers and reduct-like reduction](https://discourse.julialang.org/t/transducers-and-reduct-like-reduction/66070)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 3\
**Last updated:** [August 24, 2021, 6:26pm UTC](https://discourse.julialang.org/t/transducers-and-reduct-like-reduction/66070 "2021-08-24T18:26:08Z")

</div>

Dear All, this question is mainly for @tkf . I would like to ask, if some there is a reducer in Transducers.jl that would implement reduce-like paralelism. Using your example, I am looking for this: (a + b) + (c + d) …

---

## [Confusing error, or how to clear stale compiler state](https://discourse.julialang.org/t/confusing-error-or-how-to-clear-stale-compiler-state/66348)

<div class="topic-metadata">

**Author:** [@Mark\_Nahabedian](https://discourse.julialang.org/u/Mark_Nahabedian)\
**Replies:** 5\
**Last updated:** [August 24, 2021, 6:00pm UTC](https://discourse.julialang.org/t/confusing-error-or-how-to-clear-stale-compiler-state/66348 "2021-08-24T18:00:47Z")

</div>

I think I’m having a problem with some stale compilation state. This is in julia version 1.6.0. When I run my unit tests I get this error: Testing Running tests... ERROR: LoadError: LoadError: syntax: invalid int…

---

## [How can I replace values in a column with a dictionary?](https://discourse.julialang.org/t/how-can-i-replace-values-in-a-column-with-a-dictionary/66914)

<div class="topic-metadata">

**Author:** [@Sebastian\_Mena](https://discourse.julialang.org/u/Sebastian_Mena)\
**Replies:** 3\
**Last updated:** [August 24, 2021, 4:53pm UTC](https://discourse.julialang.org/t/how-can-i-replace-values-in-a-column-with-a-dictionary/66914 "2021-08-24T16:53:51Z")

</div>

Hi, I would like to replace every elements from a column in a Julia Dataframe using a dictionary. I found the function “replace” but didn’t understand how it use.

---

## [Cannot install Revise due to CUDA unknown version?](https://discourse.julialang.org/t/cannot-install-revise-due-to-cuda-unknown-version/66923)

<div class="topic-metadata">

**Author:** [@DiracFermion1](https://discourse.julialang.org/u/DiracFermion1)\
**Replies:** 0\
**Last updated:** [August 24, 2021, 4:43pm UTC](https://discourse.julialang.org/t/cannot-install-revise-due-to-cuda-unknown-version/66923 "2021-08-24T16:43:18Z")

</div>

Hi, I am trying to install Revise package for module reloading, but when I run: import Pkg; Pkg.add("Revise"), it gives following error: Resolving package versions... Unsatisfiable requirements detected for package CUD…

---

## [Simplify type information when reinterpreting/reshaping](https://discourse.julialang.org/t/simplify-type-information-when-reinterpreting-reshaping/66909)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 4\
**Last updated:** [August 24, 2021, 3:58pm UTC](https://discourse.julialang.org/t/simplify-type-information-when-reinterpreting-reshaping/66909 "2021-08-24T15:58:09Z")

</div>

I frequently have to do things like this: julia\> x = rand(3,10) 3×10 Matrix{Float64}: 0.233999 0.217953 0.391807 0.396972 0.612708 0.344216 0.513826 0.724808 0.222591 0.668894 0.152236 0.0596347 0.297019 …

---

## [Plot a column of 1D arrays from DataFrame using Gadfly](https://discourse.julialang.org/t/plot-a-column-of-1d-arrays-from-dataframe-using-gadfly/66688)

<div class="topic-metadata">

**Author:** [@thompsonmj](https://discourse.julialang.org/u/thompsonmj)\
**Replies:** 8\
**Last updated:** [August 24, 2021, 1:17pm UTC](https://discourse.julialang.org/t/plot-a-column-of-1d-arrays-from-dataframe-using-gadfly/66688 "2021-08-24T13:17:54Z")

</div>

I have a DataFrame with columns df.x and df.y. Each row has a 1D array. Can I use Gadfly.jl to plot this data simply? Seems I need to extract each row one-at-a-time first, as in x = df.x\[1\] y = df.y\[1\] plot(x=x, y=y, G…

---

## [Multiple Parent Types: How to go about it?](https://discourse.julialang.org/t/multiple-parent-types-how-to-go-about-it/66493)

<div class="topic-metadata">

**Author:** [@viraltux](https://discourse.julialang.org/u/viraltux)\
**Replies:** 22\
**Last updated:** [August 24, 2021, 9:29am UTC](https://discourse.julialang.org/t/multiple-parent-types-how-to-go-about-it/66493 "2021-08-24T09:29:55Z")

</div>

There are many cases where we would like to assign multiple parents to a given type, e.g: abstract type Person end abstract type Soldier \<: Person end abstract type Civilian \<: Person end abstract type Man \<: Person e…

---

## [Deep dive detangling terms: multiple inheritance vs. traits](https://discourse.julialang.org/t/deep-dive-detangling-terms-multiple-inheritance-vs-traits/67110)

<div class="topic-metadata">

**Author:** [@bgroenks](https://discourse.julialang.org/u/bgroenks)\
**Replies:** 10\
**Last updated:** [August 24, 2021, 1:11pm UTC](https://discourse.julialang.org/t/deep-dive-detangling-terms-multiple-inheritance-vs-traits/67110 "2021-08-24T13:11:48Z")

</div>

I did not read issue 5, I am just expressing my view on this subject. I don’t agree with this use of the phrase “multiple inheritance”. In PL theory, traits and inheritance are separate concepts, though they can be use…

---

## [Pluto: how to change column names of a data frame?](https://discourse.julialang.org/t/pluto-how-to-change-column-names-of-a-data-frame/66903)

<div class="topic-metadata">

**Author:** [@VivMendes](https://discourse.julialang.org/u/VivMendes)\
**Replies:** 2\
**Last updated:** [August 24, 2021, 11:50am UTC](https://discourse.julialang.org/t/pluto-how-to-change-column-names-of-a-data-frame/66903 "2021-08-24T11:50:49Z")

</div>

Hi all, I have a simple data frame that is working Ok inside Pluto. I have to change the names of the column headers because they are too long. The usual procedure is to use the function rename! but this does not work …

---

## [Fast large binary heap for SNIC super-pixel](https://discourse.julialang.org/t/fast-large-binary-heap-for-snic-super-pixel/66878)

<div class="topic-metadata">

**Author:** [@Geoffrey](https://discourse.julialang.org/u/Geoffrey)\
**Replies:** 2\
**Last updated:** [August 24, 2021, 11:45am UTC](https://discourse.julialang.org/t/fast-large-binary-heap-for-snic-super-pixel/66878 "2021-08-24T11:45:11Z")

</div>

Hello there, I’m looking for help in order to optimize an implementation of the SNIC algorithm (Achanta et al 2017) for pre-segmenting image in super-pixels/voxels. The algorithm use a binary heap to get quick access to…

---

## [Can I define string as "%Fmt" in Printf?](https://discourse.julialang.org/t/can-i-define-string-as-fmt-in-printf/66766)

<div class="topic-metadata">

**Author:** [@CRquantum](https://discourse.julialang.org/u/CRquantum)\
**Replies:** 9\
**Last updated:** [August 24, 2021, 10:37am UTC](https://discourse.julialang.org/t/can-i-define-string-as-fmt-in-printf/66766 "2021-08-24T10:37:18Z")

</div>

Sorry for another stupid question. It is a little similar with How to repeat the format in @printf? - #12 by CRquantum However i want to be more creative by design my own fmts in Printf. The idea is simply, I looked a…

---

## [Using closures for performance gain when handling datasets and making repeated function calls](https://discourse.julialang.org/t/using-closures-for-performance-gain-when-handling-datasets-and-making-repeated-function-calls/66809)

<div class="topic-metadata">

**Author:** [@rubaiyat](https://discourse.julialang.org/u/rubaiyat)\
**Replies:** 3\
**Last updated:** [August 24, 2021, 9:47am UTC](https://discourse.julialang.org/t/using-closures-for-performance-gain-when-handling-datasets-and-making-repeated-function-calls/66809 "2021-08-24T09:47:54Z")

</div>

Hello everyone, I’m in a situation where I’m estimating parameters of a model using a dataset. This requires optimization, and my question is about how I can leverage closures to speed up the process. I’d be curious to…

---

## [What is the preferred way to save variables?](https://discourse.julialang.org/t/what-is-the-preferred-way-to-save-variables/21918)

<div class="topic-metadata">

**Author:** [@zaen](https://discourse.julialang.org/u/zaen)\
**Replies:** 39\
**Last updated:** [August 24, 2021, 8:22am UTC](https://discourse.julialang.org/t/what-is-the-preferred-way-to-save-variables/21918 "2021-08-24T08:22:30Z")

</div>

I’m trying to save variables from one run of a problem JuMP to use as initial values for variables in a separate JuMP problem. I see that there seem to be several (competing?) options for doing this: JLD JLD2 BSON HDF5 …

---

## [How to declare a string array for the purpose of concatenation](https://discourse.julialang.org/t/how-to-declare-a-string-array-for-the-purpose-of-concatenation/66868)

<div class="topic-metadata">

**Author:** [@soldin](https://discourse.julialang.org/u/soldin)\
**Replies:** 9\
**Last updated:** [August 24, 2021, 7:10am UTC](https://discourse.julialang.org/t/how-to-declare-a-string-array-for-the-purpose-of-concatenation/66868 "2021-08-24T07:10:44Z")

</div>

Hi all, I have the following code of converting a string array into a char array (MATLAB’s parlance) This works str1 = \["abc", "def", "ghi"\] function str\_join(str2) str=str2\[1\] for i=2:1:length(str2) str = …

---

## [Why Makie markers are not visually identical in size?](https://discourse.julialang.org/t/why-makie-markers-are-not-visually-identical-in-size/66894)

<div class="topic-metadata">

**Author:** [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Replies:** 1\
**Last updated:** [August 24, 2021, 5:28am UTC](https://discourse.julialang.org/t/why-makie-markers-are-not-visually-identical-in-size/66894 "2021-08-24T05:28:45Z")

</div>

See the Makie figure below. Why the square marker is visually much larger than the diamond? Overall, the sizes of all markers are not visually pleasing. Can we have a better default size for each default marker?

---

## [Replace int element from another element keeping the original](https://discourse.julialang.org/t/replace-int-element-from-another-element-keeping-the-original/66877)

<div class="topic-metadata">

**Author:** [@Sebastian\_Mena](https://discourse.julialang.org/u/Sebastian_Mena)\
**Replies:** 1\
**Last updated:** [August 23, 2021, 9:55pm UTC](https://discourse.julialang.org/t/replace-int-element-from-another-element-keeping-the-original/66877 "2021-08-23T21:55:29Z")

</div>

Hi, i want to save an array my\_array = \[1,2,3,4,5\] and replace a element from my\_array with a value, but i don’t want to change my principal array. For example, my\_array = \[1,2,3,4,5\] replace 2 for 8 new\_array = \[1,8,3…

---

## [Managing dependencies between un-registered packages](https://discourse.julialang.org/t/managing-dependencies-between-un-registered-packages/66850)

<div class="topic-metadata">

**Author:** [@sefffal](https://discourse.julialang.org/u/sefffal)\
**Replies:** 2\
**Last updated:** [August 23, 2021, 4:46pm UTC](https://discourse.julialang.org/t/managing-dependencies-between-un-registered-packages/66850 "2021-08-23T16:46:16Z")

</div>

Hi all, I’m looking for some advice on managing multiple unregistered packages. I have three astronomy-related packages, DirectImages.jl, DirectOrbits.jl, and DirectDetections.jl (notice a theme?). The first is for ge…

---

## [What's the proper way of dealing with Adjoint?](https://discourse.julialang.org/t/whats-the-proper-way-of-dealing-with-adjoint/13457)

<div class="topic-metadata">

**Author:** [@vpetukhov](https://discourse.julialang.org/u/vpetukhov)\
**Replies:** 6\
**Last updated:** [August 23, 2021, 4:00pm UTC](https://discourse.julialang.org/t/whats-the-proper-way-of-dealing-with-adjoint/13457 "2021-08-23T16:00:37Z")

</div>

During upgrade of some libraries to Julia 0.7 I’ve met many situations where package developers use DenseMatrix{T} as an abstract class for a matrix data. But after new release, all code, which use transpose stopped work…

---

## [PyCall PyCapsule\_Import could not import module "datetime"](https://discourse.julialang.org/t/pycall-pycapsule-import-could-not-import-module-datetime/66853)

<div class="topic-metadata">

**Author:** [@billykalfus](https://discourse.julialang.org/u/billykalfus)\
**Replies:** 0\
**Last updated:** [August 23, 2021, 3:46pm UTC](https://discourse.julialang.org/t/pycall-pycapsule-import-could-not-import-module-datetime/66853 "2021-08-23T15:46:52Z")

</div>

I have a Python virtual environment and I’d like to install PyCall to point to the environment’s Python, but I get an error when I try to execute “using PyCall” (error message below). I’m on Linux and I first activate th…

---

## [Julia + VSCode + ipynb for elementary school science](https://discourse.julialang.org/t/julia-vscode-ipynb-for-elementary-school-science/66621)

<div class="topic-metadata">

**Author:** [@dlakelan](https://discourse.julialang.org/u/dlakelan)\
**Replies:** 5\
**Last updated:** [August 23, 2021, 2:09pm UTC](https://discourse.julialang.org/t/julia-vscode-ipynb-for-elementary-school-science/66621 "2021-08-23T14:09:41Z")

</div>

My kids are starting in not-in-person school this week. We’re waiting to see how stable the COVID transmission environment is in local schools, and maybe availability of vaccines for their age group (10 and 11). Meantime…

---

## [How to use threads in a reduction with LoopVectorization?](https://discourse.julialang.org/t/how-to-use-threads-in-a-reduction-with-loopvectorization/66836)

<div class="topic-metadata">

**Author:** [@Chiil](https://discourse.julialang.org/u/Chiil)\
**Replies:** 3\
**Last updated:** [August 23, 2021, 12:55pm UTC](https://discourse.julialang.org/t/how-to-use-threads-in-a-reduction-with-loopvectorization/66836 "2021-08-23T12:55:39Z")

</div>

I have the following function. How do I make this parallel with LoopVectorization? In C++ I would add the reduction clause and the associated variable to my OpenMP #pragma, but in Julia I do not know what is the best per…

---

## [Why is minimum so much faster than argmin?](https://discourse.julialang.org/t/why-is-minimum-so-much-faster-than-argmin/66814)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 11\
**Last updated:** [August 23, 2021, 11:40am UTC](https://discourse.julialang.org/t/why-is-minimum-so-much-faster-than-argmin/66814 "2021-08-23T11:40:22Z")

</div>

Interesting behavior - minimum is about 4x faster than argmin. Perhaps it knows how to use more cores? The question came up from the HoJ Discord server. julia\> y = rand(100\_000); julia\> @btime argmin($y); 181.410 μs …

---

## [Add gradient to ribbon based on density](https://discourse.julialang.org/t/add-gradient-to-ribbon-based-on-density/62081)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 2\
**Last updated:** [August 23, 2021, 11:01am UTC](https://discourse.julialang.org/t/add-gradient-to-ribbon-based-on-density/62081 "2021-08-23T11:01:30Z")

</div>

Suppose I have a time series plot, such as: using Plots t = 0:.1:10 n = length(t) m = sin.(t) y = m + randn(n) \* .3 plot(t, m) scatter!(t, y) How can I add a gradient to the alpha value of the ribbon based on the dens…

---

## [Lazy global pyimports](https://discourse.julialang.org/t/lazy-global-pyimports/66796)

<div class="topic-metadata">

**Author:** [@marius311](https://discourse.julialang.org/u/marius311)\
**Replies:** 6\
**Last updated:** [August 23, 2021, 8:51am UTC](https://discourse.julialang.org/t/lazy-global-pyimports/66796 "2021-08-23T08:51:53Z")

</div>

In my packages, I’d like to import Python packages (currently with PyCall, but happy to switch if theres a PythonCall solution) as global variables and use these in my functions, but for performance reasons, I want to de…

---

## [How to dispatch this serializer function?](https://discourse.julialang.org/t/how-to-dispatch-this-serializer-function/65981)

<div class="topic-metadata">

**Author:** [@Bardo](https://discourse.julialang.org/u/Bardo)\
**Replies:** 37\
**Last updated:** [August 23, 2021, 5:24am UTC](https://discourse.julialang.org/t/how-to-dispatch-this-serializer-function/65981 "2021-08-23T05:24:58Z")

</div>

""" io = serialize(v) reinterprets a Julia object into a series of bytes. An exercise in multiple dispatch style. Based on https://de.mathworks.com/matlabcentral/fileexchange/29457-serialize-deserialize and "julianized…

---

## [Minimum Mode Problem: minimum number - maximum repetition](https://discourse.julialang.org/t/minimum-mode-problem-minimum-number-maximum-repetition/66749)

<div class="topic-metadata">

**Author:** [@karalis1](https://discourse.julialang.org/u/karalis1)\
**Replies:** 7\
**Last updated:** [August 22, 2021, 2:18pm UTC](https://discourse.julialang.org/t/minimum-mode-problem-minimum-number-maximum-repetition/66749 "2021-08-22T14:18:57Z")

</div>

Hey guys, is there a performant way to solve this problem in julia? Given a vector \[1…n\] return the minimum number that has the highest repetition examples: \[1, 3, 3, 2, 3, 4\] → should return 3 because it’s the most r…

---

## [Documenter: I'm not seeing the "link to source" buttons in my local docs build, how can I?](https://discourse.julialang.org/t/documenter-im-not-seeing-the-link-to-source-buttons-in-my-local-docs-build-how-can-i/66823)

<div class="topic-metadata">

**Author:** [@kimlaberinto](https://discourse.julialang.org/u/kimlaberinto)\
**Replies:** 0\
**Last updated:** [August 23, 2021, 1:39am UTC](https://discourse.julialang.org/t/documenter-im-not-seeing-the-link-to-source-buttons-in-my-local-docs-build-how-can-i/66823 "2021-08-23T01:39:23Z")

</div>

Hello! I’m building some docs locally, and I noticed that I do not have the “source” button appearing when I try to hover over docstrings in the docs. (See below for an image of such “source” buttons). Does anyone know…

---

## [Generated functions for performance auto-tuning](https://discourse.julialang.org/t/generated-functions-for-performance-auto-tuning/66821)

<div class="topic-metadata">

**Author:** [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Replies:** 7\
**Last updated:** [August 23, 2021, 2:31am UTC](https://discourse.julialang.org/t/generated-functions-for-performance-auto-tuning/66821 "2021-08-23T02:31:22Z")

</div>

To get the best performance across different inputs, we often have multiple implementations, and choose which one to use based on the input given. For example, for array traversals we may want to unroll loops for small a…

---

## [How to use push!() in a two-dimensional matrix](https://discourse.julialang.org/t/how-to-use-push-in-a-two-dimensional-matrix/66790)

<div class="topic-metadata">

**Author:** [@soldin](https://discourse.julialang.org/u/soldin)\
**Replies:** 30\
**Last updated:** [August 22, 2021, 9:11pm UTC](https://discourse.julialang.org/t/how-to-use-push-in-a-two-dimensional-matrix/66790 "2021-08-22T21:11:00Z")

</div>

Hi everyone, I need to put values into a matrix initialized with 2 rows and 0 columns. I have tried the following three ways but without success. Please inform me the correct way. First y=zeros(Float16,2,0) display(y)…

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

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