# General Usage

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

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

**Page:** 141

---

## [Balancing groups in DataFrame](https://discourse.julialang.org/t/balancing-groups-in-dataframe/118284)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 5\
**Last updated:** [August 17, 2024, 6:16pm UTC](https://discourse.julialang.org/t/balancing-groups-in-dataframe/118284 "2024-08-17T18:16:32Z")

</div>

Quick question: suppose I have a DataFrame of the form df = DataFrame(grouping1 = \[1, 1, 2, 2\], grouping2 = \[true, true, true, false\]) Even though, for the grouping1 category: 1, there are no observations with groupi…

---

## [I can't make sense of these unsatisfiable requirements](https://discourse.julialang.org/t/i-cant-make-sense-of-these-unsatisfiable-requirements/118277)

<div class="topic-metadata">

**Author:** [@moble](https://discourse.julialang.org/u/moble)\
**Replies:** 2\
**Last updated:** [August 17, 2024, 2:58pm UTC](https://discourse.julialang.org/t/i-cant-make-sense-of-these-unsatisfiable-requirements/118277 "2024-08-17T14:58:55Z")

</div>

CompatHelper submitted a PR to my package to allow the latest version of Symbolics, but the build is failing for reasons that I just don’t understand. With the PR my package (PostNewtonian) lists in its compat section D…

---

## [Compare data from two dataframes](https://discourse.julialang.org/t/compare-data-from-two-dataframes/118254)

<div class="topic-metadata">

**Author:** [@Sandy45](https://discourse.julialang.org/u/Sandy45)\
**Replies:** 3\
**Last updated:** [August 17, 2024, 1:57pm UTC](https://discourse.julialang.org/t/compare-data-from-two-dataframes/118254 "2024-08-17T13:57:45Z")

</div>

I have two dataframes as shown below and I need to create csv file or json output like shown below. I need to get dominant row for each product for each date from two dataframes then compare them to generate below outpu…

---

## [How to add package from a GitHub repo's subfolder](https://discourse.julialang.org/t/how-to-add-package-from-a-github-repos-subfolder/118223)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 7\
**Last updated:** [August 17, 2024, 11:23am UTC](https://discourse.julialang.org/t/how-to-add-package-from-a-github-repos-subfolder/118223 "2024-08-17T11:23:26Z")

</div>

A same question has been answered at Installing from a subdirectory of Github. However, I still cannot make it work. In my repo GitHub - ShuhuaGao/GADNF: Reconstruct Boolean network from data using GA on its DNF, there…

---

## [Best way to document (a reasonable amount of) keywords](https://discourse.julialang.org/t/best-way-to-document-a-reasonable-amount-of-keywords/112347)

<div class="topic-metadata">

**Author:** [@kellertuer](https://discourse.julialang.org/u/kellertuer)\
**Replies:** 17\
**Last updated:** [August 17, 2024, 11:15am UTC](https://discourse.julialang.org/t/best-way-to-document-a-reasonable-amount-of-keywords/112347 "2024-08-17T11:15:11Z")

</div>

I am a bit unhappy with how I currently document keyword arguments in functions that I consider a bit more high-level. Such a function should be usable easily also for people using a package for the first time. Similar…

---

## [What's Julia's memory model like; e.g. regarding aliasing?](https://discourse.julialang.org/t/whats-julias-memory-model-like-e-g-regarding-aliasing/12565)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 0\
**Last updated:** [July 21, 2018, 4:56pm UTC](https://discourse.julialang.org/t/whats-julias-memory-model-like-e-g-regarding-aliasing/12565 "2018-07-21T16:56:28Z")

</div>

For the longest time, C++ didn’t have a memory model (now it does, and e.g. CPUs x86 and ARM implement it). I know also that Java has a memory model, but never heard of other languages having defined. Can you assume Ju…

---

## [Typed varargs](https://discourse.julialang.org/t/typed-varargs/118291)

<div class="topic-metadata">

**Author:** [@Nichola](https://discourse.julialang.org/u/Nichola)\
**Replies:** 4\
**Last updated:** [August 16, 2024, 9:52pm UTC](https://discourse.julialang.org/t/typed-varargs/118291 "2024-08-16T21:52:17Z")

</div>

I would like to define a function with a variable number of typed arguments. In particular I would like to overload the + operator in this way function Base.:+(a::MyType, (c, args...)) where c is a Number and args is …

---

## [Reduce/Accumulate with Matrix Matrix Product](https://discourse.julialang.org/t/reduce-accumulate-with-matrix-matrix-product/118260)

<div class="topic-metadata">

**Author:** [@xyhl](https://discourse.julialang.org/u/xyhl)\
**Replies:** 7\
**Last updated:** [August 16, 2024, 2:15pm UTC](https://discourse.julialang.org/t/reduce-accumulate-with-matrix-matrix-product/118260 "2024-08-16T14:15:30Z")

</div>

I would like to use the standard lib reduce and accumulate to calculate the matrix matrix products instead of the element wise products. mat = Array{ComplexF64}(undef, 2, 2, 3) mat\[:, :, 1\] = \[1+0.5im 0.0+0.0im; 0.0…

---

## [How to fix ambiguities found through Aqua.jl?](https://discourse.julialang.org/t/how-to-fix-ambiguities-found-through-aqua-jl/118269)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 4\
**Last updated:** [August 16, 2024, 1:03pm UTC](https://discourse.julialang.org/t/how-to-fix-ambiguities-found-through-aqua-jl/118269 "2024-08-16T13:03:24Z")

</div>

Hello! I am using Aqua to find ambiguities in my package (GitHub - AhmedSalih3d/SPHExample: Simple SPH dam-break simulation in Julia) and the following ones have been found: julia\> @testset "aqua test ambiguities" begi…

---

## [Safe overwriting of files](https://discourse.julialang.org/t/safe-overwriting-of-files/117758)

<div class="topic-metadata">

**Author:** [@fabiangans](https://discourse.julialang.org/u/fabiangans)\
**Replies:** 12\
**Last updated:** [August 16, 2024, 12:39pm UTC](https://discourse.julialang.org/t/safe-overwriting-of-files/117758 "2024-08-16T12:39:37Z")

</div>

I have a workflow where I repeatedly need to overwrite files with new content. I think the easiest way to overwrite a file is to use write(filename,newcontent). My question is how safe this function is against data loss…

---

## [Julia package to pull password from gnome keyring?](https://discourse.julialang.org/t/julia-package-to-pull-password-from-gnome-keyring/75891)

<div class="topic-metadata">

**Author:** [@jamaas](https://discourse.julialang.org/u/jamaas)\
**Replies:** 2\
**Last updated:** [August 16, 2024, 12:09pm UTC](https://discourse.julialang.org/t/julia-package-to-pull-password-from-gnome-keyring/75891 "2024-08-16T12:09:37Z")

</div>

I’ve looked around but can not find a julia package that will let me pull a password which is stored in my linux gnome keyring. In R, the “keyringer” package has a “decrypt\_gk\_pw” function that can pull a stored passwor…

---

## [Why two composite types with all bitstypes members are different if they are defined mutable?](https://discourse.julialang.org/t/why-two-composite-types-with-all-bitstypes-members-are-different-if-they-are-defined-mutable/118267)

<div class="topic-metadata">

**Author:** [@sylvaticus](https://discourse.julialang.org/u/sylvaticus)\
**Replies:** 2\
**Last updated:** [August 16, 2024, 12:07pm UTC](https://discourse.julialang.org/t/why-two-composite-types-with-all-bitstypes-members-are-different-if-they-are-defined-mutable/118267 "2024-08-16T12:07:44Z")

</div>

As from the title: I am a bit confused on why two composite types with all bitstypes members are different if they are defined mutable ? mutable struct Foo x::Bool end struct Goo x::Bool end julia\> f1 = Foo(tru…

---

## [No method matching length(::DateTime)](https://discourse.julialang.org/t/no-method-matching-length-datetime/118262)

<div class="topic-metadata">

**Author:** [@johnbb](https://discourse.julialang.org/u/johnbb)\
**Replies:** 4\
**Last updated:** [August 16, 2024, 11:50am UTC](https://discourse.julialang.org/t/no-method-matching-length-datetime/118262 "2024-08-16T11:50:06Z")

</div>

I encountered this error message while using indexin in a for loop. Here is an example using Dates indexin(DateTime(2024,1), DateTime(2024,1):Day(1):DateTime(2024,2)) ERROR: MethodError: no method matching length(::Dat…

---

## [Unexpectedly slow performance of iszero for BitVector](https://discourse.julialang.org/t/unexpectedly-slow-performance-of-iszero-for-bitvector/118238)

<div class="topic-metadata">

**Author:** [@brianguenter](https://discourse.julialang.org/u/brianguenter)\
**Replies:** 8\
**Last updated:** [August 16, 2024, 11:16am UTC](https://discourse.julialang.org/t/unexpectedly-slow-performance-of-iszero-for-bitvector/118238 "2024-08-16T11:16:19Z")

</div>

The builtin function iszero for BitVector seems unreasonably slow: julia\> a = BitVector(fill(0,10000)); julia\> @benchmark iszero($a) BenchmarkTools.Trial: 10000 samples with 8 evaluations. Range (min … max): 3.750 μs…

---

## [PythonPlot: use imshow instead of pcolormesh for heatmaps](https://discourse.julialang.org/t/pythonplot-use-imshow-instead-of-pcolormesh-for-heatmaps/118217)

<div class="topic-metadata">

**Author:** [@maltee1](https://discourse.julialang.org/u/maltee1)\
**Replies:** 13\
**Last updated:** [August 16, 2024, 8:44am UTC](https://discourse.julialang.org/t/pythonplot-use-imshow-instead-of-pcolormesh-for-heatmaps/118217 "2024-08-16T08:44:08Z")

</div>

I have heatmaps to plot with julia. I sometimes use the plotlyjs backend to zoom portions of the plot, but for export I use pythonplot because all other backends I’ve tried either have problems (e.g. can’t do logarithmic…

---

## [Initialization of container of constants? NamedTuple, etc](https://discourse.julialang.org/t/initialization-of-container-of-constants-namedtuple-etc/117221)

<div class="topic-metadata">

**Author:** [@ryofurue](https://discourse.julialang.org/u/ryofurue)\
**Replies:** 17\
**Last updated:** [August 16, 2024, 8:23am UTC](https://discourse.julialang.org/t/initialization-of-container-of-constants-namedtuple-etc/117221 "2024-08-16T08:23:05Z")

</div>

Would there be some disadvantage in using a module as a container of constants? I sometimes have 5–10 related global constants, which I sometimes want to treat as a whole. I thought that the simplest solution was para…

---

## [Increasing size of guide bar fonts in 3d surface plots from Plots.ji](https://discourse.julialang.org/t/increasing-size-of-guide-bar-fonts-in-3d-surface-plots-from-plots-ji/118249)

<div class="topic-metadata">

**Author:** [@hisacro](https://discourse.julialang.org/u/hisacro)\
**Replies:** 1\
**Last updated:** [August 16, 2024, 6:37am UTC](https://discourse.julialang.org/t/increasing-size-of-guide-bar-fonts-in-3d-surface-plots-from-plots-ji/118249 "2024-08-16T06:37:31Z")

</div>

In this image I can increase the guide fonts alright but the fonts on the vertical guide bar (starting from 0.4) remains the same and also, is there any way to reduce the height of that guide bar too? I’m using plotl…

---

## [Precise definition of Wiener process](https://discourse.julialang.org/t/precise-definition-of-wiener-process/118213)

<div class="topic-metadata">

**Author:** [@acubed](https://discourse.julialang.org/u/acubed)\
**Replies:** 5\
**Last updated:** [August 15, 2024, 4:29pm UTC](https://discourse.julialang.org/t/precise-definition-of-wiener-process/118213 "2024-08-15T16:29:00Z")

</div>

Having used DifferentialEquations for two years, I have understood that I still do not understand the precise definiton of Wiener process. I try to solve the following system of SDEs, function determ\_dyn!(du, u, p, t) …

---

## ["extended" vector with heterogeneous "padding"](https://discourse.julialang.org/t/extended-vector-with-heterogeneous-padding/118140)

<div class="topic-metadata">

**Author:** [@ffevotte](https://discourse.julialang.org/u/ffevotte)\
**Replies:** 5\
**Last updated:** [August 15, 2024, 4:08pm UTC](https://discourse.julialang.org/t/extended-vector-with-heterogeneous-padding/118140 "2024-08-15T16:08:07Z")

</div>

Hello, I seem to frequently encounter situations where accounting for boundary/initial conditions requires “extending” vectors in a way similar to padding, but where padded values are not necessarily constant and might …

---

## [Naming variables and constructor functions](https://discourse.julialang.org/t/naming-variables-and-constructor-functions/118222)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 4\
**Last updated:** [August 15, 2024, 1:32pm UTC](https://discourse.julialang.org/t/naming-variables-and-constructor-functions/118222 "2024-08-15T13:32:06Z")

</div>

This is a style question that has been bugging me for a while so I thought I would ask what others do. Consider a composite type Foo, for which I expose the constructor. This is something that I like to do for non-trivi…

---

## [Voronoi cell index identification based on point(x,y) position](https://discourse.julialang.org/t/voronoi-cell-index-identification-based-on-point-x-y-position/118216)

<div class="topic-metadata">

**Author:** [@Manasa\_S](https://discourse.julialang.org/u/Manasa_S)\
**Replies:** 1\
**Last updated:** [August 15, 2024, 9:54am UTC](https://discourse.julialang.org/t/voronoi-cell-index-identification-based-on-point-x-y-position/118216 "2024-08-15T09:54:52Z")

</div>

Is there a way to get the closest voronoi cell index based on the point position (x,y)?

---

## [Method for \`Base.length\` on a \`const\` type alias crashes julia](https://discourse.julialang.org/t/method-for-base-length-on-a-const-type-alias-crashes-julia/118169)

<div class="topic-metadata">

**Author:** [@kunzaatko](https://discourse.julialang.org/u/kunzaatko)\
**Replies:** 7\
**Last updated:** [August 15, 2024, 8:36am UTC](https://discourse.julialang.org/t/method-for-base-length-on-a-const-type-alias-crashes-julia/118169 "2024-08-15T08:36:05Z")

</div>

Julia is crashing when I try to define a Base.length method on a const type alias. julia\> import Base: length julia\> const A{N} = NTuple{N, Int64} Tuple{Vararg{Int64, N}} where N julia\> length(a::A) = prod(a) After …

---

## [Organizing structures and action functions into files](https://discourse.julialang.org/t/organizing-structures-and-action-functions-into-files/118210)

<div class="topic-metadata">

**Author:** [@ykkan](https://discourse.julialang.org/u/ykkan)\
**Replies:** 1\
**Last updated:** [August 15, 2024, 2:29am UTC](https://discourse.julialang.org/t/organizing-structures-and-action-functions-into-files/118210 "2024-08-15T02:29:22Z")

</div>

Hello everyone, I have a question about organizing structures and action functions into files. In Julia’s programming paradigm, we usually first identify the nouns of a problem and implement the corresponding struct fo…

---

## [Julia Equivalent to PyTorch's \`torch.nn.functional.affine\_grid\`](https://discourse.julialang.org/t/julia-equivalent-to-pytorchs-torch-nn-functional-affine-grid/118205)

<div class="topic-metadata">

**Author:** [@Dale\_James\_Black](https://discourse.julialang.org/u/Dale_James_Black)\
**Replies:** 0\
**Last updated:** [August 14, 2024, 11:18pm UTC](https://discourse.julialang.org/t/julia-equivalent-to-pytorchs-torch-nn-functional-affine-grid/118205 "2024-08-14T23:18:37Z")

</div>

I asked on Slack without much help. Is there an equivalent to the affine\_grid function from Pytorch? This numpy version will work if I want to port it to Julia but would rather see if any Julia packages provide a more r…

---

## [Fastest way to read fixed-width tables embedded in a larger text file](https://discourse.julialang.org/t/fastest-way-to-read-fixed-width-tables-embedded-in-a-larger-text-file/118108)

<div class="topic-metadata">

**Author:** [@Tetrakai](https://discourse.julialang.org/u/Tetrakai)\
**Replies:** 9\
**Last updated:** [August 14, 2024, 11:11pm UTC](https://discourse.julialang.org/t/fastest-way-to-read-fixed-width-tables-embedded-in-a-larger-text-file/118108 "2024-08-14T23:11:36Z")

</div>

I’ve got a bunch of .txt files that contain a few hundred lines of “junk” at the beginning, then two tables embedded at the end. Those two tables always begin the same number of lines from the end of the file. Further, t…

---

## [Feature request: variant of -\> that uses current bindings](https://discourse.julialang.org/t/feature-request-variant-of-that-uses-current-bindings/118161)

<div class="topic-metadata">

**Author:** [@Stephen\_Vavasis](https://discourse.julialang.org/u/Stephen_Vavasis)\
**Replies:** 2\
**Last updated:** [August 14, 2024, 10:34pm UTC](https://discourse.julialang.org/t/feature-request-variant-of-that-uses-current-bindings/118161 "2024-08-14T22:34:43Z")

</div>

It is a documented feature of Julia (see Performance Tips · The Julia Language) that using a variable from the main body of a function in an inner function causes the inner and outer copy of the variable to be bound toge…

---

## [Same multi-threaded code, scaling observed only on some machines](https://discourse.julialang.org/t/same-multi-threaded-code-scaling-observed-only-on-some-machines/118200)

<div class="topic-metadata">

**Author:** [@EdTi](https://discourse.julialang.org/u/EdTi)\
**Replies:** 2\
**Last updated:** [August 14, 2024, 8:02pm UTC](https://discourse.julialang.org/t/same-multi-threaded-code-scaling-observed-only-on-some-machines/118200 "2024-08-14T20:02:48Z")

</div>

Hi everyone, I was quite surprised by the following benchmark.The goal is the following : initialize a big vector x, and try to add 1 to all of its coordinates as fast as possible, taking advantage of multi-threading. H…

---

## [Functions and additional exclamation mark '!'](https://discourse.julialang.org/t/functions-and-additional-exclamation-mark/118198)

<div class="topic-metadata">

**Author:** [@EatMyShorts](https://discourse.julialang.org/u/EatMyShorts)\
**Replies:** 8\
**Last updated:** [August 14, 2024, 8:18pm UTC](https://discourse.julialang.org/t/functions-and-additional-exclamation-mark/118198 "2024-08-14T20:18:40Z")

</div>

Hello … While I was reading through some tutorials, I noticed a function call with an additional “!”. For example here (and also for my solved problem): MTH229 with Julia - 3 Graphing functions with Julia “Graphs can …

---

## [TypedTables innerjoin](https://discourse.julialang.org/t/typedtables-innerjoin/118199)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 1\
**Last updated:** [August 14, 2024, 7:57pm UTC](https://discourse.julialang.org/t/typedtables-innerjoin/118199 "2024-08-14T19:57:59Z")

</div>

I am trying to do an innerjoin on a TypedTable. This is shown in the TypedTable tutorial and manual, and it is suggested that ?innerjoin will give the help for the function. On my Julia 1.10.4 I cannot find this functi…

---

## [Shouldn't \`@views sum(data\[mask\])\` be non-allocating?](https://discourse.julialang.org/t/shouldnt-views-sum-data-mask-be-non-allocating/118135)

<div class="topic-metadata">

**Author:** [@artemsolod](https://discourse.julialang.org/u/artemsolod)\
**Replies:** 19\
**Last updated:** [August 14, 2024, 5:27pm UTC](https://discourse.julialang.org/t/shouldnt-views-sum-data-mask-be-non-allocating/118135 "2024-08-14T17:27:09Z")

</div>

I was surprised to see the following function allocates - is this expected? using BenchmarkTools function f\_viewalloc(data, mask) @views sum(data\[mask\]) end let N = 1\_000\_000 data = fill(true, N) mask = fi…

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

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