# General Usage

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

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

**Page:** 732

---

## [Sklearn (scikit learn) alternative?](https://discourse.julialang.org/t/sklearn-scikit-learn-alternative/42512)

<div class="topic-metadata">

**Author:** [@hafez\_ahmad](https://discourse.julialang.org/u/hafez_ahmad)\
**Replies:** 2\
**Last updated:** [July 4, 2020, 8:20am UTC](https://discourse.julialang.org/t/sklearn-scikit-learn-alternative/42512 "2020-07-04T08:20:05Z")

</div>

is there any alternative of the scikit learn in pure Julia? I think, sci-kit learn is help in python and I found the most popular and useful algorithms. can I get the same Julia package? any help appreciated

---

## [No gradient is calculated during Flux training with ODE](https://discourse.julialang.org/t/no-gradient-is-calculated-during-flux-training-with-ode/42455)

<div class="topic-metadata">

**Author:** [@yanz4](https://discourse.julialang.org/u/yanz4)\
**Replies:** 1\
**Last updated:** [July 4, 2020, 7:37am UTC](https://discourse.julialang.org/t/no-gradient-is-calculated-during-flux-training-with-ode/42455 "2020-07-04T07:37:18Z")

</div>

I tried to update the parameters in ODE by Flux training. In Struct V203, only 2 parameters are selected to be tracked for backpropagation: Flux.trainable(device::V2O3) = (device.Rth, device.Cth) During training, these …

---

## [Request to be deleted](https://discourse.julialang.org/t/request-to-be-deleted/42504)

<div class="topic-metadata">

**Author:** [@yanz4](https://discourse.julialang.org/u/yanz4)\
**Replies:** 4\
**Last updated:** [July 4, 2020, 3:36am UTC](https://discourse.julialang.org/t/request-to-be-deleted/42504 "2020-07-04T03:36:04Z")

</div>

I’m building an oscillator (called V2O3) defined by ODE (V2O3\_system as named in code below). The purpose is to use Flux training to optimize parameters in ODE, i.e. the R and C value of the oscillator, given loss funct…

---

## [Broadcast into higher dimensional array vs nested array](https://discourse.julialang.org/t/broadcast-into-higher-dimensional-array-vs-nested-array/42454)

<div class="topic-metadata">

**Author:** [@kschurter](https://discourse.julialang.org/u/kschurter)\
**Replies:** 4\
**Last updated:** [July 3, 2020, 10:26pm UTC](https://discourse.julialang.org/t/broadcast-into-higher-dimensional-array-vs-nested-array/42454 "2020-07-03T22:26:48Z")

</div>

I want to broadcast a vector-valued function and store the results in a higher dimensional array as opposed to a vector of arrays. I like the performance of this code: import .Base: Broadcast import .Broadcast: Broadcas…

---

## [Trying to read netCDF4 file with NetCDF.jl](https://discourse.julialang.org/t/trying-to-read-netcdf4-file-with-netcdf-jl/42497)

<div class="topic-metadata">

**Author:** [@renato](https://discourse.julialang.org/u/renato)\
**Replies:** 2\
**Last updated:** [July 3, 2020, 9:40pm UTC](https://discourse.julialang.org/t/trying-to-read-netcdf4-file-with-netcdf-jl/42497 "2020-07-03T21:40:30Z")

</div>

Hello! Trying to read a NetCDF4 file, using NetCDF.jl, and although I can read it in Python with netCDF4 package (so I conclude the file is ok), in Julia I can’t even get general information with ncinfo(filename), as my…

---

## [Error involving MvNormal(::Array{Float64,2}) repeating?](https://discourse.julialang.org/t/error-involving-mvnormal-array-float64-2-repeating/42393)

<div class="topic-metadata">

**Author:** [@samd1993](https://discourse.julialang.org/u/samd1993)\
**Replies:** 4\
**Last updated:** [July 3, 2020, 7:35pm UTC](https://discourse.julialang.org/t/error-involving-mvnormal-array-float64-2-repeating/42393 "2020-07-03T19:35:05Z")

</div>

Hi all, I am trying to run something in Julia and keep getting the same error. Here is the code and output: (base) \[sdegregori@surfingmantis mimix\]$ mkdir simulation-results julia (base) \[sdegregori@surfingmantis mimix…

---

## [Creating iterators for tuples of arbitrary dimension](https://discourse.julialang.org/t/creating-iterators-for-tuples-of-arbitrary-dimension/42154)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 7\
**Last updated:** [July 3, 2020, 1:45pm UTC](https://discourse.julialang.org/t/creating-iterators-for-tuples-of-arbitrary-dimension/42154 "2020-07-03T13:45:07Z")

</div>

Suppose I wish to take as input some integer d and iterate over all tuples (i\_1, ... i\_d), with each entry lying in 1 to 10. For example, I may take as input a vector v of length d and compute the sum v\_1 i\_1 + ... + v\_d…

---

## [Using module variables in a module function. Is there a performance disadvantage?](https://discourse.julialang.org/t/using-module-variables-in-a-module-function-is-there-a-performance-disadvantage/42465)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 4\
**Last updated:** [July 3, 2020, 12:56pm UTC](https://discourse.julialang.org/t/using-module-variables-in-a-module-function-is-there-a-performance-disadvantage/42465 "2020-07-03T12:56:30Z")

</div>

module A b = "test" function crazy\_use\_of\_b\_1() #... using A.b end function crazy\_use\_of\_b\_2(;\_b = A.b) #... using \_b end end Is there a performance difference from 1 to 2. Or problems with type stabilit…

---

## [Broadcast call of callables in array](https://discourse.julialang.org/t/broadcast-call-of-callables-in-array/42468)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 2\
**Last updated:** [July 3, 2020, 11:08am UTC](https://discourse.julialang.org/t/broadcast-call-of-callables-in-array/42468 "2020-07-03T11:08:04Z")

</div>

I have an Array of callable structs that return vectors. I would like to call each of these structs with the same argument such that I get a matrix with column i being the vector returned by the callable i. struct Foo e…

---

## [MethodError: no method matching unsafe\_convert(::Type{Ptr{Int32}}, ::Base.RefValue{Int64})](https://discourse.julialang.org/t/methoderror-no-method-matching-unsafe-convert-type-ptr-int32-base-refvalue-int64/42424)

<div class="topic-metadata">

**Author:** [@HelgavonLichtenstein](https://discourse.julialang.org/u/HelgavonLichtenstein)\
**Replies:** 9\
**Last updated:** [July 3, 2020, 8:40am UTC](https://discourse.julialang.org/t/methoderror-no-method-matching-unsafe-convert-type-ptr-int32-base-refvalue-int64/42424 "2020-07-03T08:40:03Z")

</div>

Hello, I have an error occur while running an ODE. It didn’t error 3-4 days ago, and I think DifferentialEquations.jl and Sundails.jl had an update in the meantime, so I will need to adjust my code. I think the error is…

---

## [Adjoint not defined for 3D output of ODESolution?](https://discourse.julialang.org/t/adjoint-not-defined-for-3d-output-of-odesolution/42449)

<div class="topic-metadata">

**Author:** [@yanz4](https://discourse.julialang.org/u/yanz4)\
**Replies:** 1\
**Last updated:** [July 2, 2020, 8:31pm UTC](https://discourse.julialang.org/t/adjoint-not-defined-for-3d-output-of-odesolution/42449 "2020-07-02T20:31:08Z")

</div>

I am trying to use Flux.batch for my DL model in Julia. The model is nothing but an ODE system. I want to updated the parameter on ODE by training. Without batch, the output of ODE is 2D array, which works well with tra…

---

## [My startup.jl for Revise + Juno](https://discourse.julialang.org/t/my-startup-jl-for-revise-juno/22170)

<div class="topic-metadata">

**Author:** [@ssfrr](https://discourse.julialang.org/u/ssfrr)\
**Replies:** 2\
**Last updated:** [July 2, 2020, 8:15pm UTC](https://discourse.julialang.org/t/my-startup-jl-for-revise-juno/22170 "2020-07-02T20:15:07Z")

</div>

So with the new Debugger integration into Juno there’s a lot more incentive to have Revise loaded within a Juno session, but I ran into some issues where loading Revise in my startup.jl was problematic because Atom wasn’…

---

## [Why isn't Float32 == Float64 (Converting from Float32 to Float64)](https://discourse.julialang.org/t/why-isnt-float32-float64-converting-from-float32-to-float64/42423)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 5\
**Last updated:** [July 2, 2020, 4:01pm UTC](https://discourse.julialang.org/t/why-isnt-float32-float64-converting-from-float32-to-float64/42423 "2020-07-02T16:01:44Z")

</div>

julia\> 312.09 312.09 julia\> 312.09 |\> Float64 312.09 julia\> 312.09 |\> Float64 |\> Float32 312.09f0 julia\> 312.09 |\> Float64 |\> Float32 |\> Float64 312.0899963378906 julia\> 312.09f0 == 312.09 false Clearly this number …

---

## [Efficient (non-allocating, in-place) getindex! for BitArray?](https://discourse.julialang.org/t/efficient-non-allocating-in-place-getindex-for-bitarray/42268)

<div class="topic-metadata">

**Author:** [@JeffFessler](https://discourse.julialang.org/u/JeffFessler)\
**Replies:** 19\
**Last updated:** [July 2, 2020, 1:30pm UTC](https://discourse.julialang.org/t/efficient-non-allocating-in-place-getindex-for-bitarray/42268 "2020-07-02T13:30:26Z")

</div>

I have an indexing operation of the form y .= x\[mask\] where mask is a BitArray. To my surprise, this is an allocating operation even though it could be done in place in compiled code. So I wrote a loop that is non-allo…

---

## [Calling the constructor outside a module works, but inside a module throws ArgumentError: ref of NULL PyObject](https://discourse.julialang.org/t/calling-the-constructor-outside-a-module-works-but-inside-a-module-throws-argumenterror-ref-of-null-pyobject/42362)

<div class="topic-metadata">

**Author:** [@Volker](https://discourse.julialang.org/u/Volker)\
**Replies:** 3\
**Last updated:** [July 2, 2020, 12:06pm UTC](https://discourse.julialang.org/t/calling-the-constructor-outside-a-module-works-but-inside-a-module-throws-argumenterror-ref-of-null-pyobject/42362 "2020-07-02T12:06:52Z")

</div>

Hi, I call the constructor of an custom python package, which I import with pyimport. Somehow it works when I do it in a script, but if I put the code into a module, it will throw an error “ArgumentError: ref of NULL Py…

---

## [Defining plots in function results in world problem](https://discourse.julialang.org/t/defining-plots-in-function-results-in-world-problem/42401)

<div class="topic-metadata">

**Author:** [@morkip](https://discourse.julialang.org/u/morkip)\
**Replies:** 2\
**Last updated:** [July 2, 2020, 9:38am UTC](https://discourse.julialang.org/t/defining-plots-in-function-results-in-world-problem/42401 "2020-07-02T09:38:10Z")

</div>

I just stumbled across the following behaviour: This code works using Plots x = range(0, 2 \* pi, length=200) Plots.pyplot() p1 = plot(x, cos.(x)) display(p1) savefig(p1, "test.pdf") println("success") while this code …

---

## [How to properly measure time of a loop - having issues with global scope I think](https://discourse.julialang.org/t/how-to-properly-measure-time-of-a-loop-having-issues-with-global-scope-i-think/42396)

<div class="topic-metadata">

**Author:** [@Julia1](https://discourse.julialang.org/u/Julia1)\
**Replies:** 2\
**Last updated:** [July 2, 2020, 9:28am UTC](https://discourse.julialang.org/t/how-to-properly-measure-time-of-a-loop-having-issues-with-global-scope-i-think/42396 "2020-07-02T09:28:41Z")

</div>

Hi, I’m working in IJulia with @time begin to measure how long my code takes. I have some code that iterates row by row over one input dataframe, merges it with other dataframes that had been assigned to variables earl…

---

## [Segfault with cfunction, possibly world age related](https://discourse.julialang.org/t/segfault-with-cfunction-possibly-world-age-related/42417)

<div class="topic-metadata">

**Author:** [@Christian\_Rorvik](https://discourse.julialang.org/u/Christian_Rorvik)\
**Replies:** 4\
**Last updated:** [July 2, 2020, 9:10am UTC](https://discourse.julialang.org/t/segfault-with-cfunction-possibly-world-age-related/42417 "2020-07-02T09:10:06Z")

</div>

Full issue description here, along with workarounds and alternative code. Following segfaults for me, tested on Windows, Linux, Julia 1.4.1 and 1.4.2: module Foo null\_handler(x) = nothing mutable struct A1{T} value…

---

## [Undefined Variable](https://discourse.julialang.org/t/undefined-variable/42416)

<div class="topic-metadata">

**Author:** [@hyacykcharel](https://discourse.julialang.org/u/hyacykcharel)\
**Replies:** 1\
**Last updated:** [July 2, 2020, 8:25am UTC](https://discourse.julialang.org/t/undefined-variable/42416 "2020-07-02T08:25:06Z")

</div>

function Plot\_Poisson\_Equation(n) A = zeros(n-1,n-1) for i in 1:n-2 A\[i,i+1\] = -1 A\[i,i\] = 2 A\[i+1,i\] = -1 end end Hello Im still gettin Erro A, and u not define…

---

## [Memory allocation when creating struct with dynamic array](https://discourse.julialang.org/t/memory-allocation-when-creating-struct-with-dynamic-array/42346)

<div class="topic-metadata">

**Author:** [@awin](https://discourse.julialang.org/u/awin)\
**Replies:** 6\
**Last updated:** [July 2, 2020, 6:54am UTC](https://discourse.julialang.org/t/memory-allocation-when-creating-struct-with-dynamic-array/42346 "2020-07-02T06:54:38Z")

</div>

I am writing a package for simulating realistic quantum systems. A key component in these simulations is defining pulses. Defining several constant size structs NormPulse, SquarePulse, etc. behaves as expected. However, …

---

## [Julia optimizations causing crash on ubuntu while sorting multidim arrays](https://discourse.julialang.org/t/julia-optimizations-causing-crash-on-ubuntu-while-sorting-multidim-arrays/42388)

<div class="topic-metadata">

**Author:** [@kkylin](https://discourse.julialang.org/u/kkylin)\
**Replies:** 3\
**Last updated:** [July 1, 2020, 6:57pm UTC](https://discourse.julialang.org/t/julia-optimizations-causing-crash-on-ubuntu-while-sorting-multidim-arrays/42388 "2020-07-01T18:57:26Z")

</div>

Hi all, I’ve been using Julia on Macs for years and just got a Linux box. After installing Julia (via apt) recently, I am getting crashes sorting multidim arrays with -O2 and -O3, but not with -O0 and -O1. (Details be…

---

## [How do you evaluate a parameter/variable if you are not in Main eval or Core.Eval do not work?](https://discourse.julialang.org/t/how-do-you-evaluate-a-parameter-variable-if-you-are-not-in-main-eval-or-core-eval-do-not-work/42343)

<div class="topic-metadata">

**Author:** [@cbasile21](https://discourse.julialang.org/u/cbasile21)\
**Replies:** 4\
**Last updated:** [July 1, 2020, 3:44pm UTC](https://discourse.julialang.org/t/how-do-you-evaluate-a-parameter-variable-if-you-are-not-in-main-eval-or-core-eval-do-not-work/42343 "2020-07-01T15:44:19Z")

</div>

Hello, I would really appreciate your help with the following problem. I will want to learn how evaluate a variable outside of Main, and I could not find a way to do that yet. Expected: Eval will work for #println(Core…

---

## [Parallel workflow](https://discourse.julialang.org/t/parallel-workflow/42259)

<div class="topic-metadata">

**Author:** [@grahamas](https://discourse.julialang.org/u/grahamas)\
**Replies:** 2\
**Last updated:** [July 1, 2020, 3:05pm UTC](https://discourse.julialang.org/t/parallel-workflow/42259 "2020-07-01T15:05:38Z")

</div>

I’m running a bunch of DiffEq solvers in parallel, summarizing the results, and then saving them. Can anyone recommend the best workflow to do this given the current state of Julia’s parallel code, either v1.4 or v1.5? …

---

## [Using PackageCompiler.jl with Gtk.jl](https://discourse.julialang.org/t/using-packagecompiler-jl-with-gtk-jl/42017)

<div class="topic-metadata">

**Author:** [@Charlie\_Ping](https://discourse.julialang.org/u/Charlie_Ping)\
**Replies:** 7\
**Last updated:** [July 1, 2020, 3:05pm UTC](https://discourse.julialang.org/t/using-packagecompiler-jl-with-gtk-jl/42017 "2020-07-01T15:05:50Z")

</div>

Hi, I’m trying to build a gui using julia. I am running this on ubuntu 20.04 I have a module called TEST TEST/src/TEST.jl code: module TEST using Gtk export real\_main, julia\_main const win = Ref{GtkWindow}() const …

---

## [How would I update a DataFrame with new data and delete old data so I can maintain the N most recent rows per person](https://discourse.julialang.org/t/how-would-i-update-a-dataframe-with-new-data-and-delete-old-data-so-i-can-maintain-the-n-most-recent-rows-per-person/42368)

<div class="topic-metadata">

**Author:** [@Julia1](https://discourse.julialang.org/u/Julia1)\
**Replies:** 2\
**Last updated:** [July 1, 2020, 2:26pm UTC](https://discourse.julialang.org/t/how-would-i-update-a-dataframe-with-new-data-and-delete-old-data-so-i-can-maintain-the-n-most-recent-rows-per-person/42368 "2020-07-01T14:26:25Z")

</div>

Hi how’s it going? Here is an example of the dataframe, and a new data row to be added. df = DataFrame(:name=\>\["john","john","john","john","john","mike","mike","mike","mike","mike"\] ,:day=\>\["2020-05-14","2020-05-13","20…

---

## [Writing in a file?](https://discourse.julialang.org/t/writing-in-a-file/42306)

<div class="topic-metadata">

**Author:** [@JTintern](https://discourse.julialang.org/u/JTintern)\
**Replies:** 6\
**Last updated:** [July 1, 2020, 11:59am UTC](https://discourse.julialang.org/t/writing-in-a-file/42306 "2020-07-01T11:59:08Z")

</div>

Hi, Here’s an overview of my file : Window gained focus --\> CreateSurveyDialog = 'Create 3D survey' --\> frame = 'DataManager' Focus gained --\> TextField = 'MAP\_' --\> CreateSurveyDialog = 'Create 3D survey' MB1 --\> …

---

## [Scheduling Execution of julia Scripts](https://discourse.julialang.org/t/scheduling-execution-of-julia-scripts/42345)

<div class="topic-metadata">

**Author:** [@hafez\_ahmad](https://discourse.julialang.org/u/hafez_ahmad)\
**Replies:** 1\
**Last updated:** [July 1, 2020, 9:25am UTC](https://discourse.julialang.org/t/scheduling-execution-of-julia-scripts/42345 "2020-07-01T09:25:05Z")

</div>

I have a Julia (1.4, windows machine ) data analysis and plotting scripts of the customers which I update every day. now how I can Scheduling for the execution automatically after like a day or every 6 hours? I did it i…

---

## [A community convention for target function return values](https://discourse.julialang.org/t/a-community-convention-for-target-function-return-values/42248)

<div class="topic-metadata">

**Author:** [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Replies:** 12\
**Last updated:** [July 1, 2020, 9:02am UTC](https://discourse.julialang.org/t/a-community-convention-for-target-function-return-values/42248 "2020-07-01T09:02:58Z")

</div>

In many packages, we deal with target functions, either in linear or log-space, that will then be the object of optimization, statistical density sampling (esp. in Bayesian statistics, etc.), machine-learning, etc. Curr…

---

## [On OS X Catalina, running 'solve' in DifferentialEquations causes crash](https://discourse.julialang.org/t/on-os-x-catalina-running-solve-in-differentialequations-causes-crash/42109)

<div class="topic-metadata">

**Author:** [@perseid28](https://discourse.julialang.org/u/perseid28)\
**Replies:** 23\
**Last updated:** [July 1, 2020, 7:58am UTC](https://discourse.julialang.org/t/on-os-x-catalina-running-solve-in-differentialequations-causes-crash/42109 "2020-07-01T07:58:46Z")

</div>

On my MacBook Pro, I have encountered a number of kernel crashes while running the ‘solve’ command from the DifferentialEquations.jl package. One such situation occurs when I run the exact code from Example 3 here: Ordin…

---

## [Dict issue?](https://discourse.julialang.org/t/dict-issue/42338)

<div class="topic-metadata">

**Author:** [@vinhphunguyen](https://discourse.julialang.org/u/vinhphunguyen)\
**Replies:** 10\
**Last updated:** [July 1, 2020, 7:31am UTC](https://discourse.julialang.org/t/dict-issue/42338 "2020-07-01T07:31:24Z")

</div>

I made a dictionary to store some inputs to a function, see below data = Dict() data\["total\_time"\] = 0.3 data\["time"\] = 0. data\["dt"\] = 1e-3 function f(…

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

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