# General Usage

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

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

**Page:** 915

---

## [array assignment using an array as indexes](https://discourse.julialang.org/t/array-assignment-using-an-array-as-indexes/17683)

<div class="topic-metadata">

**Author:** [@zlewko](https://discourse.julialang.org/u/zlewko)\
**Replies:** 2\
**Last updated:** [November 29, 2018, 2:20am UTC](https://discourse.julialang.org/t/array-assignment-using-an-array-as-indexes/17683 "2018-11-29T02:20:44Z")

</div>

I’m new to Julia and am trying to assign to a constant to locations in a multidimensional array using indexes specified in another array. I can do this with a for loop easily, but am trying to understand how to do it as…

---

## [How to pass Array{Array{Float64,1},1} to ccall double\*\*](https://discourse.julialang.org/t/how-to-pass-array-array-float64-1-1-to-ccall-double/18120)

<div class="topic-metadata">

**Author:** [@groot](https://discourse.julialang.org/u/groot)\
**Replies:** 0\
**Last updated:** [November 29, 2018, 12:06am UTC](https://discourse.julialang.org/t/how-to-pass-array-array-float64-1-1-to-ccall-double/18120 "2018-11-29T00:06:22Z")

</div>

For double\*, I find it is easy to use Ref{Cdouble}. But for double\*\*, when I use Ref{{Ref{Cdouble}}} and pass Array{Array{Float64,1},1} . It gives an error MethodError: Cannot convert an object of type Array{Array{Float…

---

## [Jupyter, IJulia and "No Active Project"](https://discourse.julialang.org/t/jupyter-ijulia-and-no-active-project/18102)

<div class="topic-metadata">

**Author:** [@peter.wolf](https://discourse.julialang.org/u/peter.wolf)\
**Replies:** 2\
**Last updated:** [November 28, 2018, 10:05pm UTC](https://discourse.julialang.org/t/jupyter-ijulia-and-no-active-project/18102 "2018-11-28T22:05:31Z")

</div>

I am following the directions for setting up IJulia However, when I add IJulia I get the message pkg&gt; add IJulia ERROR: no active project I tried “activate .” which then allows me to add IJulia However, when I …

---

## [CSVFiles: read file with non-standard extension](https://discourse.julialang.org/t/csvfiles-read-file-with-non-standard-extension/18096)

<div class="topic-metadata">

**Author:** [@jtackm](https://discourse.julialang.org/u/jtackm)\
**Replies:** 6\
**Last updated:** [November 28, 2018, 8:55pm UTC](https://discourse.julialang.org/t/csvfiles-read-file-with-non-standard-extension/18096 "2018-11-28T20:55:51Z")

</div>

I’m trying to use CSVFiles.jl to read a .tsv file that has a non-standard file extension (which cannot easily be changed). The readme suggests df = DataFrame(load(Stream(format"CSV", io))) But trying to apply this pat…

---

## [Fix "Warning: Some packages (...) are not downloaded"?](https://discourse.julialang.org/t/fix-warning-some-packages-are-not-downloaded/18103)

<div class="topic-metadata">

**Author:** [@swissr](https://discourse.julialang.org/u/swissr)\
**Replies:** 4\
**Last updated:** [November 28, 2018, 8:47pm UTC](https://discourse.julialang.org/t/fix-warning-some-packages-are-not-downloaded/18103 "2018-11-28T20:47:31Z")

</div>

In Julia 1.1.0-DEV.720 after adding Rebugger, (v1.1) pkg\> status -m (see below) indicates that two packages (‘OrderedCollections v1.0.2’ and ‘Pkg-f9180e48b27a843aeee864db814dce57cb296b9b’) have not been downloaded. I tri…

---

## [MWE - setindex bug?](https://discourse.julialang.org/t/mwe-setindex-bug/18017)

<div class="topic-metadata">

**Author:** [@y4lu](https://discourse.julialang.org/u/y4lu)\
**Replies:** 12\
**Last updated:** [November 27, 2018, 2:03am UTC](https://discourse.julialang.org/t/mwe-setindex-bug/18017 "2018-11-27T02:03:27Z")

</div>

The following line doesn’t error but doesn’t have any affect on b2 b2\[vec(b2)\]\[ p2\[xhalt\*2:end\] \] .= false; Working in the same scope: b3 = @view b2\[vec(b2)\]; b3\[ p2\[rmax+1:end\] \] .= false; b2 is a bitvector, p2 a ve…

---

## [Problem Reading Python Pandas object into Julia](https://discourse.julialang.org/t/problem-reading-python-pandas-object-into-julia/16852)

<div class="topic-metadata">

**Author:** [@Ajaychat3](https://discourse.julialang.org/u/Ajaychat3)\
**Replies:** 9\
**Last updated:** [November 28, 2018, 7:23am UTC](https://discourse.julialang.org/t/problem-reading-python-pandas-object-into-julia/16852 "2018-11-28T07:23:52Z")

</div>

I don’t kow if there is a simple way of doing this but any help is appeciated. The problem occurs when I convert Pandas dataframe to Dataframe.Dataframe. The output is messed up. The altenative I know is to convert HDFs…

---

## [About acceptable types of dimension parameter for Base.reshape](https://discourse.julialang.org/t/about-acceptable-types-of-dimension-parameter-for-base-reshape/18091)

<div class="topic-metadata">

**Author:** [@machakann](https://discourse.julialang.org/u/machakann)\
**Replies:** 2\
**Last updated:** [November 28, 2018, 10:07am UTC](https://discourse.julialang.org/t/about-acceptable-types-of-dimension-parameter-for-base-reshape/18091 "2018-11-28T10:07:09Z")

</div>

I think the current behavior of Base.reshape function is a little strange. a = zeros(100); reshape(a, 10, 10) # OK reshape(a, UInt(10), UInt(10)) # MethodError reshape(a, (UInt(10), UInt(10))) # OK reshape(a, Int1…

---

## [Data loss with repeated CSV.jl import and export operations](https://discourse.julialang.org/t/data-loss-with-repeated-csv-jl-import-and-export-operations/18018)

<div class="topic-metadata">

**Author:** [@essenciary](https://discourse.julialang.org/u/essenciary)\
**Replies:** 10\
**Last updated:** [November 28, 2018, 7:23am UTC](https://discourse.julialang.org/t/data-loss-with-repeated-csv-jl-import-and-export-operations/18018 "2018-11-28T07:23:48Z")

</div>

I have this problem with writing and reading tabular data with CSV.jl – and I can’t make any sense of its behaviour. I have a dataset loaded in memory: 69795×13 DataFrames.DataFrame Then I write it to file: julia\> CSV…

---

## [Unmarshal TOML parser dictionaries](https://discourse.julialang.org/t/unmarshal-toml-parser-dictionaries/18074)

<div class="topic-metadata">

**Author:** [@mkretlow](https://discourse.julialang.org/u/mkretlow)\
**Replies:** 3\
**Last updated:** [November 28, 2018, 6:40am UTC](https://discourse.julialang.org/t/unmarshal-toml-parser-dictionaries/18074 "2018-11-28T06:40:29Z")

</div>

Is there a easy way (or a package I am not aware of) to unmarshal dictionaries provided from the TOML parser https://github.com/wildart/TOML.jl into Julia types (struct) ?

---

## [Achieving C++ Speeds for a CFD Algorithm: Julia spends too much time on pre-allocation?](https://discourse.julialang.org/t/achieving-c-speeds-for-a-cfd-algorithm-julia-spends-too-much-time-on-pre-allocation/17410)

<div class="topic-metadata">

**Author:** [@EmadMasroor](https://discourse.julialang.org/u/EmadMasroor)\
**Replies:** 22\
**Last updated:** [November 28, 2018, 6:14am UTC](https://discourse.julialang.org/t/achieving-c-speeds-for-a-cfd-algorithm-julia-spends-too-much-time-on-pre-allocation/17410 "2018-11-28T06:14:18Z")

</div>

I have a CFD Algorithm that I implemented first in MATLAB (slow), then in C++ (blazing fast), and now I am trying to recreate it in Julia. I have already achieved much faster performance than MATLAB but there seem to be …

---

## [Basic functions with array](https://discourse.julialang.org/t/basic-functions-with-array/18089)

<div class="topic-metadata">

**Author:** [@Diger](https://discourse.julialang.org/u/Diger)\
**Replies:** 3\
**Last updated:** [November 28, 2018, 3:02am UTC](https://discourse.julialang.org/t/basic-functions-with-array/18089 "2018-11-28T03:02:44Z")

</div>

Last time I was using this was 0.5 or so, but when I want to calculate x=1:1000 y=cos(x) it complains about ERROR: MethodError: no method matching cos(::StepRangeLen{Float64,Base.TwicePrecision{Float64},Base.TwicePre…

---

## [Surprising behaviour for arguments of different types](https://discourse.julialang.org/t/surprising-behaviour-for-arguments-of-different-types/18088)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 5\
**Last updated:** [November 28, 2018, 2:34am UTC](https://discourse.julialang.org/t/surprising-behaviour-for-arguments-of-different-types/18088 "2018-11-28T02:34:55Z")

</div>

Suppose I want a function which takes varargs of any type, even different among arguments. Of course, there are two obvious ways to implement this: f(x...) = typeof(x) f(x::Vararg{Any}) = typeof(x) Now I need to get th…

---

## [Assembling documentation in a loop](https://discourse.julialang.org/t/assembling-documentation-in-a-loop/18083)

<div class="topic-metadata">

**Author:** [@tomerarnon](https://discourse.julialang.org/u/tomerarnon)\
**Replies:** 0\
**Last updated:** [November 28, 2018, 12:14am UTC](https://discourse.julialang.org/t/assembling-documentation-in-a-loop/18083 "2018-11-28T00:14:52Z")

</div>

I would like to assemble a string that consists of the docstrings of several functions. Here is essentially what I am trying: """the function foo | it's fine""" foo() = nothing """another function bar | it's great""" b…

---

## [Extraneous end causes silent failure](https://discourse.julialang.org/t/extraneous-end-causes-silent-failure/18075)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 8\
**Last updated:** [November 27, 2018, 10:04pm UTC](https://discourse.julialang.org/t/extraneous-end-causes-silent-failure/18075 "2018-11-27T22:04:12Z")

</div>

I had a very odd problem in that my program stopped running, and by stopped running I mean that the very first println in the function did not execute. However poking around in the code revealed that it was only one fun…

---

## [How to add (anonymous) functions?](https://discourse.julialang.org/t/how-to-add-anonymous-functions/17907)

<div class="topic-metadata">

**Author:** [@Karajan](https://discourse.julialang.org/u/Karajan)\
**Replies:** 18\
**Last updated:** [November 27, 2018, 4:21pm UTC](https://discourse.julialang.org/t/how-to-add-anonymous-functions/17907 "2018-11-27T16:21:35Z")

</div>

Hi everybody, I want to add (reduce?) anonymous functions and I can’t figure out how to do it. Context: I want to speed up my computation like this: function g(c, x) return hard\_computation(c)(x) end → functio…

---

## [How to translate this phyton code to julia with efficienty(short code,easy to read write)? What about a append!() symbol in julia to "concatenate" vector?](https://discourse.julialang.org/t/how-to-translate-this-phyton-code-to-julia-with-efficienty-short-code-easy-to-read-write-what-about-a-append-symbol-in-julia-to-concatenate-vector/18036)

<div class="topic-metadata">

**Author:** [@rapasite](https://discourse.julialang.org/u/rapasite)\
**Replies:** 10\
**Last updated:** [November 27, 2018, 1:56pm UTC](https://discourse.julialang.org/t/how-to-translate-this-phyton-code-to-julia-with-efficienty-short-code-easy-to-read-write-what-about-a-append-symbol-in-julia-to-concatenate-vector/18036 "2018-11-27T13:56:01Z")

</div>

Hi I was thinking this kind of code is short and easy to write is there any ways to do this in Julia? thanks #Python code of Trinomial triangle row = \[1\] for i in range(8): print(row) row = \[sum(t) for t in zip(…

---

## [Status of AxisArrays?](https://discourse.julialang.org/t/status-of-axisarrays/18049)

<div class="topic-metadata">

**Author:** [@oschulz](https://discourse.julialang.org/u/oschulz)\
**Replies:** 2\
**Last updated:** [November 27, 2018, 11:18am UTC](https://discourse.julialang.org/t/status-of-axisarrays/18049 "2018-11-27T11:18:39Z")

</div>

I wonder, what’s the current status of AxisArrays? I’m considering to use it in a long-term project, and maybe contribute a few improvement to AxisArrays along the way - I noticed that there has been little activity in t…

---

## [AttributeError when calling python method using PyCall](https://discourse.julialang.org/t/attributeerror-when-calling-python-method-using-pycall/18052)

<div class="topic-metadata">

**Author:** [@zekeriya.sari](https://discourse.julialang.org/u/zekeriya.sari)\
**Replies:** 0\
**Last updated:** [November 27, 2018, 10:17am UTC](https://discourse.julialang.org/t/attributeerror-when-calling-python-method-using-pycall/18052 "2018-11-27T10:17:26Z")

</div>

I could run the following basic example script from TensorFlow documentation without a hassle in python. import tensorflow as tf from tensorflow import keras # Load the dataset. fashion\_mnist = keras.datasets.fashion\_m…

---

## [Create worker with specific ID](https://discourse.julialang.org/t/create-worker-with-specific-id/18050)

<div class="topic-metadata">

**Author:** [@xanfus](https://discourse.julialang.org/u/xanfus)\
**Replies:** 0\
**Last updated:** [November 27, 2018, 9:50am UTC](https://discourse.julialang.org/t/create-worker-with-specific-id/18050 "2018-11-27T09:50:31Z")

</div>

It’s easy to terminate worker by interruption with interrupt() while it compiles code. Sometimes worker terminates by manual interruption at runtime, but it’s rare. New workers are created with incremented IDs beyond cur…

---

## [Having a vector (1-dimension array) but it has 2 dimensions](https://discourse.julialang.org/t/having-a-vector-1-dimension-array-but-it-has-2-dimensions/17914)

<div class="topic-metadata">

**Author:** [@Balance37](https://discourse.julialang.org/u/Balance37)\
**Replies:** 6\
**Last updated:** [November 27, 2018, 2:53am UTC](https://discourse.julialang.org/t/having-a-vector-1-dimension-array-but-it-has-2-dimensions/17914 "2018-11-27T02:53:13Z")

</div>

Hi, I have this “HbeforeDiag” vector, it is supposed to be a 1-dimensional array, and it does say the size of it is (144, 1). However, the type of it is two dimensions: Array{Float64,2}. And the number of dimensions is …

---

## [Dropdims for AxisArray throws "method too new"](https://discourse.julialang.org/t/dropdims-for-axisarray-throws-method-too-new/18042)

<div class="topic-metadata">

**Author:** [@aplavin](https://discourse.julialang.org/u/aplavin)\
**Replies:** 7\
**Last updated:** [November 27, 2018, 1:58am UTC](https://discourse.julialang.org/t/dropdims-for-axisarray-throws-method-too-new/18042 "2018-11-27T01:58:30Z")

</div>

As the title says, callind dropdims surprisingly raises a methoderror, while e.g. sum works OK: using AxisArrays a = AxisArray(rand(1, 20), :a, :b) sum(a, dims=Axis{:a}) # works dropdims(a, dims=Axis{:a}) # raises '…

---

## [Sparse array problem: is this a known bug?](https://discourse.julialang.org/t/sparse-array-problem-is-this-a-known-bug/18032)

<div class="topic-metadata">

**Author:** [@PeterB](https://discourse.julialang.org/u/PeterB)\
**Replies:** 6\
**Last updated:** [November 27, 2018, 1:49am UTC](https://discourse.julialang.org/t/sparse-array-problem-is-this-a-known-bug/18032 "2018-11-27T01:49:27Z")

</div>

I accidentally downloaded version 1.1.0-DEV.699 , and I think I discovered a bug with sparse arrays. So (a) is this a bug, (b) is it known by the developers, and (c) if so, where do I report it. (and (d), and I am the co…

---

## [HDF5 Error Issues](https://discourse.julialang.org/t/hdf5-error-issues/17964)

<div class="topic-metadata">

**Author:** [@Renee\_Spear](https://discourse.julialang.org/u/Renee_Spear)\
**Replies:** 2\
**Last updated:** [November 27, 2018, 1:23am UTC](https://discourse.julialang.org/t/hdf5-error-issues/17964 "2018-11-27T01:23:52Z")

</div>

Hi, I just updated Julia to version 0.7.0. I use the HDF5 package for the code that I am working on. It added and updated the package just fine, but as soon as I go to run my code after stating ‘using HDF5’, the followin…

---

## [What is the quickest way to move a subsection of a matrix?](https://discourse.julialang.org/t/what-is-the-quickest-way-to-move-a-subsection-of-a-matrix/18000)

<div class="topic-metadata">

**Author:** [@Raf](https://discourse.julialang.org/u/Raf)\
**Replies:** 24\
**Last updated:** [November 26, 2018, 10:26pm UTC](https://discourse.julialang.org/t/what-is-the-quickest-way-to-move-a-subsection-of-a-matrix/18000 "2018-11-26T22:26:49Z")

</div>

For example copy the second two columns to the first: \[1 2 3; 1 2 3; 1 2 3\] becomes \[2 3 3; 2 3 3; 2 3 3\]

---

## [DataType with type parameter](https://discourse.julialang.org/t/datatype-with-type-parameter/17932)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 4\
**Last updated:** [November 26, 2018, 9:28pm UTC](https://discourse.julialang.org/t/datatype-with-type-parameter/17932 "2018-11-26T21:28:23Z")

</div>

DataType is subtype of Type{T} but where Type{T} has a typeparameter, DataType does not have it. How is this possible? More practically, how can I dispatch on DataType, while extracting the Typeparameter?

---

## [DataFrames type assignment inconsistency](https://discourse.julialang.org/t/dataframes-type-assignment-inconsistency/18030)

<div class="topic-metadata">

**Author:** [@purplishrock](https://discourse.julialang.org/u/purplishrock)\
**Replies:** 5\
**Last updated:** [November 26, 2018, 9:02pm UTC](https://discourse.julialang.org/t/dataframes-type-assignment-inconsistency/18030 "2018-11-26T21:02:02Z")

</div>

I ran into this strange behavior and I’m not sure if it’s a problem with DataFrames or my interpretation with how it works. When i generate my dataframe with an integer array and a float array, i get two float columns. …

---

## [GraphPlot using logos as nodes](https://discourse.julialang.org/t/graphplot-using-logos-as-nodes/17518)

<div class="topic-metadata">

**Author:** [@Tero\_Frondelius](https://discourse.julialang.org/u/Tero_Frondelius)\
**Replies:** 2\
**Last updated:** [November 26, 2018, 7:08pm UTC](https://discourse.julialang.org/t/graphplot-using-logos-as-nodes/17518 "2018-11-26T19:08:29Z")

</div>

xref: Feature Request: possibly to add bitmap node · Issue #74 · JuliaGraphs/GraphPlot.jl · GitHub Dear all, I would like to generate such a graph: Has anyone else done something similar? Is there ready package for…

---

## [GLM is slow on large datasets. Using OnlineStats for regressions? MixedModels?](https://discourse.julialang.org/t/glm-is-slow-on-large-datasets-using-onlinestats-for-regressions-mixedmodels/17695)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 25\
**Last updated:** [November 26, 2018, 5:54pm UTC](https://discourse.julialang.org/t/glm-is-slow-on-large-datasets-using-onlinestats-for-regressions-mixedmodels/17695 "2018-11-26T17:54:17Z")

</div>

Hello. I’m planning to move from R to Julia and doing some tests about how to properly deal with large datasets and do simple tasks like regressions or survival analysis. I’ve done a benchmark with R (microbenchmark) f…

---

## [Building and Calling a Shared Library](https://discourse.julialang.org/t/building-and-calling-a-shared-library/11411)

<div class="topic-metadata">

**Author:** [@MLackner](https://discourse.julialang.org/u/MLackner)\
**Replies:** 2\
**Last updated:** [November 26, 2018, 5:32pm UTC](https://discourse.julialang.org/t/building-and-calling-a-shared-library/11411 "2018-11-26T17:32:28Z")

</div>

Hey! Is it possible to build and call a shared library file with Julia? What I tried is the following: I’ve got a file called mylib.jl with the following content: module MyLib Base.@ccallable function julia\_main(ARG…

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

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