# General Usage

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

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

**Page:** 720

---

## [Avoid allocations](https://discourse.julialang.org/t/avoid-allocations/44187)

<div class="topic-metadata">

**Author:** [@nhavt](https://discourse.julialang.org/u/nhavt)\
**Replies:** 3\
**Last updated:** [August 3, 2020, 1:44pm UTC](https://discourse.julialang.org/t/avoid-allocations/44187 "2020-08-03T13:44:40Z")

</div>

Hi there, suppose that I have a Float64 vector x. I wish to identify non-zero elements of this vector. Below are my proposal for that. f1!(y,x) = y .= (x .!=0 )\[:\]; function f2!(y,x) @inbounds @simd for i ∈ eachinde…

---

## [How to copy a Julia DataFrame in a threaded loop?](https://discourse.julialang.org/t/how-to-copy-a-julia-dataframe-in-a-threaded-loop/44136)

<div class="topic-metadata">

**Author:** [@Bebio](https://discourse.julialang.org/u/Bebio)\
**Replies:** 8\
**Last updated:** [August 3, 2020, 11:36am UTC](https://discourse.julialang.org/t/how-to-copy-a-julia-dataframe-in-a-threaded-loop/44136 "2020-08-03T11:36:16Z")

</div>

First of all, I am a very beginner I’ve got the following problem : A DataFrame named cr1 with 553 columns Then, I make two loops as follow : cr2=copy(cr1) #-----------------# #Loop on scenarios# #----------…

---

## [How to coerce types from data loaded via ExcelFiles.jl](https://discourse.julialang.org/t/how-to-coerce-types-from-data-loaded-via-excelfiles-jl/44161)

<div class="topic-metadata">

**Author:** [@fnbillimoria](https://discourse.julialang.org/u/fnbillimoria)\
**Replies:** 1\
**Last updated:** [August 3, 2020, 11:05am UTC](https://discourse.julialang.org/t/how-to-coerce-types-from-data-loaded-via-excelfiles-jl/44161 "2020-08-03T11:05:32Z")

</div>

Hi, I am loading a sheet from an excel file using ExcelFiles.jl. I wish to convert the types for some of the columns that are loaded as a dataframe. Some of the columns load as a float, and I wish to coerce them to an …

---

## [@elapsed for function with return values](https://discourse.julialang.org/t/elapsed-for-function-with-return-values/44180)

<div class="topic-metadata">

**Author:** [@yxieGT](https://discourse.julialang.org/u/yxieGT)\
**Replies:** 1\
**Last updated:** [August 3, 2020, 10:40am UTC](https://discourse.julialang.org/t/elapsed-for-function-with-return-values/44180 "2020-08-03T10:40:14Z")

</div>

Is there a macro in Julia to return the elapsed time of a function with return values?

---

## [Jupyter integration](https://discourse.julialang.org/t/jupyter-integration/44170)

<div class="topic-metadata">

**Author:** [@Nithin\_M](https://discourse.julialang.org/u/Nithin_M)\
**Replies:** 2\
**Last updated:** [August 3, 2020, 7:01am UTC](https://discourse.julialang.org/t/jupyter-integration/44170 "2020-08-03T07:01:06Z")

</div>

I am having error in connecting Julia with jupyter notebook…

---

## [System image as an artifact - download pre-build system images](https://discourse.julialang.org/t/system-image-as-an-artifact-download-pre-build-system-images/44106)

<div class="topic-metadata">

**Author:** [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Replies:** 7\
**Last updated:** [August 3, 2020, 6:26am UTC](https://discourse.julialang.org/t/system-image-as-an-artifact-download-pre-build-system-images/44106 "2020-08-03T06:26:33Z")

</div>

Hi folks, you might have noticed my previous announcement on Comonicon.jl, I planned to support distributable system images for CLIs so users can directly download the system images instead of building it themselves loc…

---

## [How to handle/ignore missing values when fitting differential equations?](https://discourse.julialang.org/t/how-to-handle-ignore-missing-values-when-fitting-differential-equations/43866)

<div class="topic-metadata">

**Author:** [@Irene](https://discourse.julialang.org/u/Irene)\
**Replies:** 3\
**Last updated:** [August 3, 2020, 4:58am UTC](https://discourse.julialang.org/t/how-to-handle-ignore-missing-values-when-fitting-differential-equations/43866 "2020-08-03T04:58:21Z")

</div>

Hi, I have a time-series of hourly weather data records that you can check here. You can see that for every hour in these two days (July 16-17 2018), we have a measurement of temperature, and other variables. I am inter…

---

## [CSV Segmentation fault in project environment](https://discourse.julialang.org/t/csv-segmentation-fault-in-project-environment/44124)

<div class="topic-metadata">

**Author:** [@Donut\_Meepo](https://discourse.julialang.org/u/Donut_Meepo)\
**Replies:** 3\
**Last updated:** [August 3, 2020, 1:57am UTC](https://discourse.julialang.org/t/csv-segmentation-fault-in-project-environment/44124 "2020-08-03T01:57:25Z")

</div>

Hello guys, I added CSV.jl to my project environment (\]add CSV). When I used the CSV package, I got segmentation fault and exit of the REPL. But when I use the @v1.4 environment everything works normal. I try to remove …

---

## [JuliaMono font on Windows 10](https://discourse.julialang.org/t/juliamono-font-on-windows-10/44057)

<div class="topic-metadata">

**Author:** [@MartinOtter](https://discourse.julialang.org/u/MartinOtter)\
**Replies:** 19\
**Last updated:** [August 2, 2020, 9:17pm UTC](https://discourse.julialang.org/t/juliamono-font-on-windows-10/44057 "2020-08-02T21:17:17Z")

</div>

Tried JuliaMono font on Windows 10 with vscode/julia (1.0.0). In all cases, I set font to JuliaMono: Julia Manual: Copied to Word: Copied to file in vscode: Copied to REPL in cmd window: Copied to REPL in vscod…

---

## [Plotting one column of a csv file](https://discourse.julialang.org/t/plotting-one-column-of-a-csv-file/44150)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 1\
**Last updated:** [August 2, 2020, 8:21pm UTC](https://discourse.julialang.org/t/plotting-one-column-of-a-csv-file/44150 "2020-08-02T20:21:06Z")

</div>

I know this will show me as dumb as a warthog. Not as an ox as our @oxinabox is very smart. I am experimenting with Pluto.jl - which is great! I have a CSV file with a header row. I Can select one column using the stri…

---

## [Installing TikzGraphs for BayesNets](https://discourse.julialang.org/t/installing-tikzgraphs-for-bayesnets/44146)

<div class="topic-metadata">

**Author:** [@Christopher\_Fisher](https://discourse.julialang.org/u/Christopher_Fisher)\
**Replies:** 0\
**Last updated:** [August 2, 2020, 6:35pm UTC](https://discourse.julialang.org/t/installing-tikzgraphs-for-bayesnets/44146 "2020-08-02T18:35:45Z")

</div>

Hi all- I am trying to install TikzGraphs, which is a dependency for BayesNets. Unfortunately, I am having trouble installing pgf. It gives the following message: (base) dfish@dfish-MS-7850:~$ sudo apt-get install pgf…

---

## [Can this code be made faster](https://discourse.julialang.org/t/can-this-code-be-made-faster/44122)

<div class="topic-metadata">

**Author:** [@Sanji\_Vinsmoke](https://discourse.julialang.org/u/Sanji_Vinsmoke)\
**Replies:** 9\
**Last updated:** [August 2, 2020, 4:58pm UTC](https://discourse.julialang.org/t/can-this-code-be-made-faster/44122 "2020-08-02T16:58:45Z")

</div>

I attempted the Advent od Code 2015 day 9 solution in julia and here is my code for the first part (for this input 9.txt file refer to the link to the problem): using Combinatorics, BenchmarkTools distances = readlines…

---

## [\`issubset(::BitSet,::BitSet)\` is slow and allocates unnecessarily](https://discourse.julialang.org/t/issubset-bitset-bitset-is-slow-and-allocates-unnecessarily/43828)

<div class="topic-metadata">

**Author:** [@guyvdb](https://discourse.julialang.org/u/guyvdb)\
**Replies:** 1\
**Last updated:** [August 2, 2020, 1:28pm UTC](https://discourse.julialang.org/t/issubset-bitset-bitset-is-slow-and-allocates-unnecessarily/43828 "2020-08-02T13:28:10Z")

</div>

The implementation of issubset between two BitSet: https://github.com/JuliaLang/julia/blob/3909294e78d223c740b7e7a4d00eb2d4771055a7/base/bitset.jl#L419 first intersects the sets. This unnecessarily allocates memory to c…

---

## [Quick probably basic question on Floats](https://discourse.julialang.org/t/quick-probably-basic-question-on-floats/44117)

<div class="topic-metadata">

**Author:** [@clinton](https://discourse.julialang.org/u/clinton)\
**Replies:** 5\
**Last updated:** [August 2, 2020, 6:21am UTC](https://discourse.julialang.org/t/quick-probably-basic-question-on-floats/44117 "2020-08-02T06:21:05Z")

</div>

I was wondering if someone could explain what is going in with the below code to me: function f3264() v32 = rand(Float32, 3) @info v32 v64 = Float64.(v32) @info v64 Δv = v64 .- v32 @info Δv @assert sum(Δv)…

---

## [Alternatives to pipelining Table operations like "filter" and "columns"? How to speed this up?](https://discourse.julialang.org/t/alternatives-to-pipelining-table-operations-like-filter-and-columns-how-to-speed-this-up/44100)

<div class="topic-metadata">

**Author:** [@kai](https://discourse.julialang.org/u/kai)\
**Replies:** 3\
**Last updated:** [August 2, 2020, 6:04am UTC](https://discourse.julialang.org/t/alternatives-to-pipelining-table-operations-like-filter-and-columns-how-to-speed-this-up/44100 "2020-08-02T06:04:33Z")

</div>

Hi all, I found that the following chunk is the major bottleneck in my code. For each “id” (subject), it uses pipelines to filter out the data for that “id”, creates the columns object, and then build the MyObs type. I…

---

## [How to extract the most populated bin from a histogram](https://discourse.julialang.org/t/how-to-extract-the-most-populated-bin-from-a-histogram/44081)

<div class="topic-metadata">

**Author:** [@Tofi](https://discourse.julialang.org/u/Tofi)\
**Replies:** 3\
**Last updated:** [August 2, 2020, 4:42am UTC](https://discourse.julialang.org/t/how-to-extract-the-most-populated-bin-from-a-histogram/44081 "2020-08-02T04:42:42Z")

</div>

Hello, I am using the fit function from the StatsBase package in order to calculate the histogram for an array of numbers. For example: l = rand(100) hist = fit(Histogram, l) Is there a way to extract the most populat…

---

## [\`TypeVar\` or \`eltype\`, which is faster?](https://discourse.julialang.org/t/typevar-or-eltype-which-is-faster/44113)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 1\
**Last updated:** [August 1, 2020, 11:50pm UTC](https://discourse.julialang.org/t/typevar-or-eltype-which-is-faster/44113 "2020-08-01T23:50:52Z")

</div>

Consider the following code using Unitful function f(arr::AbstractArray{T}) where {T} N = length(arr) return NTuple{N,T}(arr) end or function g(arr::AbstractArray) N, T = length(arr), eltype(arr) retu…

---

## [Trying to speed-up Laplace Equation Solver](https://discourse.julialang.org/t/trying-to-speed-up-laplace-equation-solver/43862)

<div class="topic-metadata">

**Author:** [@SambitMishra98](https://discourse.julialang.org/u/SambitMishra98)\
**Replies:** 36\
**Last updated:** [August 1, 2020, 10:14pm UTC](https://discourse.julialang.org/t/trying-to-speed-up-laplace-equation-solver/43862 "2020-08-01T22:14:26Z")

</div>

I am trying to speedup my code for Laplace Equation Solver. Based on code profiling, most of the time goes in the function given below. I have tried to optimise the functions as much as possible but the performance still…

---

## [NeuralPDE.jl vs NeuralNetDiffEq.jl](https://discourse.julialang.org/t/neuralpde-jl-vs-neuralnetdiffeq-jl/43934)

<div class="topic-metadata">

**Author:** [@Peter\_Uhl](https://discourse.julialang.org/u/Peter_Uhl)\
**Replies:** 4\
**Last updated:** [August 1, 2020, 9:14pm UTC](https://discourse.julialang.org/t/neuralpde-jl-vs-neuralnetdiffeq-jl/43934 "2020-08-01T21:14:35Z")

</div>

Hi all, I’m trying to use the NeuralPDE package, but when I run ‘import Pkg; Pkg.add(“NeuralPDE”)’ I get the error: ERROR: The following package names could not be resolved: NeuralPDE (not found in project, manifest …

---

## [Import xlsx file](https://discourse.julialang.org/t/import-xlsx-file/44096)

<div class="topic-metadata">

**Author:** [@dty](https://discourse.julialang.org/u/dty)\
**Replies:** 1\
**Last updated:** [August 1, 2020, 5:55pm UTC](https://discourse.julialang.org/t/import-xlsx-file/44096 "2020-08-01T17:55:01Z")

</div>

After importing xlsx file, how to read the data according to the original matrix form? Although it was imported, it was not presented in the matrix form of 24 \* 3 in the original excel.

---

## [Parsing high precision timestamps?](https://discourse.julialang.org/t/parsing-high-precision-timestamps/44061)

<div class="topic-metadata">

**Author:** [@crbinz](https://discourse.julialang.org/u/crbinz)\
**Replies:** 2\
**Last updated:** [August 1, 2020, 5:09pm UTC](https://discourse.julialang.org/t/parsing-high-precision-timestamps/44061 "2020-08-01T17:09:08Z")

</div>

I have a series of timestamps like 2020-01-01T12:34:56.789123Z. Trying to parse it with DateTime("2020-01-01T12:34:56.789123Z", dateformat"Y-m-dTH:M:S.ssssssZ") results in ERROR: LoadError: InexactError: convert(Dates.De…

---

## [ERROR: could not find project file in package at https://github.com/](https://discourse.julialang.org/t/error-could-not-find-project-file-in-package-at-https-github-com/44059)

<div class="topic-metadata">

**Author:** [@Ken\_Lin](https://discourse.julialang.org/u/Ken_Lin)\
**Replies:** 3\
**Last updated:** [August 1, 2020, 3:41pm UTC](https://discourse.julialang.org/t/error-could-not-find-project-file-in-package-at-https-github-com/44059 "2020-08-01T15:41:41Z")

</div>

Hello! I tried to install some packages on Julia 1.4.2 and I got errors of the following format: ERROR: could not find project file in package at https://github.com/... I was able to install these packages on Julia 1.3…

---

## [Replace char vs string](https://discourse.julialang.org/t/replace-char-vs-string/44083)

<div class="topic-metadata">

**Author:** [@anon37204545](https://discourse.julialang.org/u/anon37204545)\
**Replies:** 3\
**Last updated:** [August 1, 2020, 12:54pm UTC](https://discourse.julialang.org/t/replace-char-vs-string/44083 "2020-08-01T12:54:05Z")

</div>

julia\> @btime replace(" a "^1000, ' ' =\> "a") 120.199 μs (7 allocations: 6.94 KiB) "..." julia\> @btime replace(" a "^1000, " " =\> "a") 193.500 μs (7 allocations: 6.94 KiB) "..." julia\> @btime replace(" a "^1000, ' …

---

## [Animation Rendering Package](https://discourse.julialang.org/t/animation-rendering-package/44064)

<div class="topic-metadata">

**Author:** [@Renan\_Rabelo](https://discourse.julialang.org/u/Renan_Rabelo)\
**Replies:** 1\
**Last updated:** [August 1, 2020, 8:58am UTC](https://discourse.julialang.org/t/animation-rendering-package/44064 "2020-08-01T08:58:41Z")

</div>

Hi everyone! I’m new to Julia language and I need one specific type of package. I use programming to visualize mathematical stuff (fractals, complex behaviors etc) and for a while I used Processing language (Java based…

---

## [Allocation with in-place sum of a transposed matrix](https://discourse.julialang.org/t/allocation-with-in-place-sum-of-a-transposed-matrix/44066)

<div class="topic-metadata">

**Author:** [@aaraujo71](https://discourse.julialang.org/u/aaraujo71)\
**Replies:** 4\
**Last updated:** [August 1, 2020, 10:05am UTC](https://discourse.julialang.org/t/allocation-with-in-place-sum-of-a-transposed-matrix/44066 "2020-08-01T10:05:08Z")

</div>

I need to do in-place summations of a transposed matrix and I get memory allocation in the process. For example, running function test of the following code function test\_sum\_transpose(b, a) sum!(b, a') end functio…

---

## [Why they are not equivalent?](https://discourse.julialang.org/t/why-they-are-not-equivalent/44078)

<div class="topic-metadata">

**Author:** [@Hawk](https://discourse.julialang.org/u/Hawk)\
**Replies:** 5\
**Last updated:** [August 1, 2020, 9:55am UTC](https://discourse.julialang.org/t/why-they-are-not-equivalent/44078 "2020-08-01T09:55:35Z")

</div>

A try like below: Expr(:$,:(1+2)) == :($(1+2)) gives false. Why they are not equivalent? I suppose the righthand side has been evaluated to 3. Is this the real reason? Thanks!

---

## [Why Julia can execute code when macros are expanded?](https://discourse.julialang.org/t/why-julia-can-execute-code-when-macros-are-expanded/43987)

<div class="topic-metadata">

**Author:** [@Hawk](https://discourse.julialang.org/u/Hawk)\
**Replies:** 6\
**Last updated:** [August 1, 2020, 9:04am UTC](https://discourse.julialang.org/t/why-julia-can-execute-code-when-macros-are-expanded/43987 "2020-08-01T09:04:41Z")

</div>

Hi, when I read the section of metaprogramming in Tom Kwong’s Book “Hands-on Design Patterns and Best Practices with Julia”, I came across such an example: macro identity(ex) dump(ex) return ex end And then when…

---

## [Speed improvement possible?](https://discourse.julialang.org/t/speed-improvement-possible/44065)

<div class="topic-metadata">

**Author:** [@Ruan\_Stander](https://discourse.julialang.org/u/Ruan_Stander)\
**Replies:** 1\
**Last updated:** [August 1, 2020, 6:46am UTC](https://discourse.julialang.org/t/speed-improvement-possible/44065 "2020-08-01T06:46:14Z")

</div>

Would appreciate tips to improve speed of code below. Transforms a dataset into an input matrix and corresponding output whilst skipping missing output values function AddMatrixToInput!(row,day,instrument,Imatrix,pcMatr…

---

## [Array of Arrays times Array is type unstable](https://discourse.julialang.org/t/array-of-arrays-times-array-is-type-unstable/43924)

<div class="topic-metadata">

**Author:** [@cosmia](https://discourse.julialang.org/u/cosmia)\
**Replies:** 6\
**Last updated:** [July 31, 2020, 8:25pm UTC](https://discourse.julialang.org/t/array-of-arrays-times-array-is-type-unstable/43924 "2020-07-31T20:25:14Z")

</div>

Hi all, I have a code where I need to perform a element by element multiplication of an Array of Arrays a of size X with an Array b of size X. Note that the inner arrays of a are all the same size. In other words, for ev…

---

## [UndefVarError: parameter\_upper\_bound not defined](https://discourse.julialang.org/t/undefvarerror-parameter-upper-bound-not-defined/43975)

<div class="topic-metadata">

**Author:** [@goedman](https://discourse.julialang.org/u/goedman)\
**Replies:** 5\
**Last updated:** [July 31, 2020, 4:01pm UTC](https://discourse.julialang.org/t/undefvarerror-parameter-upper-bound-not-defined/43975 "2020-07-31T16:01:40Z")

</div>

Hi, Since about a week or so I often get below message (several of them) when testing in Julia-1.6-DEV. It works fine when using projects but not in the (@v1.6) environment. Is this maybe a change in Pkg? I’m fine work…

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

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