Quantcast
Channel: First steps - JuliaLang
Browsing all 2795 articles
Browse latest View live

Destructuring assignment with arrays, like in NumPy

Hi! So, for an example, I have a 110x2 delimited text file on disk. The first column is my variable Y, and the second column is my variable X. My goal: get Y and X both in their own array, either...

View Article


Printing names and values of a number of variables

I am looking for a julia function that can print both the names and the values of a sequence of variables, as per the following example: #Define a number of variables (could be any number) s1 = 123 s2...

View Article


Image may be NSFW.
Clik here to view.

Gmsh package Windows incompatibility

I’m considering using Julia to make a few small tools for my colleagues and I, but I’ve run into an issue. The Gmsh package isn’t compatible with windows, however there is a work around given in this...

View Article

Image may be NSFW.
Clik here to view.

Potential bug with package dependencies?

I am trying to install the latest version of Lazy.jl and Mux.jl together. But it’s failing to do so complaining about compatibility. So I dugged further I can install all the dependencies of latest...

View Article

R's dplyr and data.table 2x faster than Julia's DataFrames.jl + libraries

I got this data from https://www.kaggle.com/c/home-credit-default-risk and I just downloaded the data and loaded them and run the below. TLDR: R seems 2x as fast! using DataFrames, Statistics,...

View Article


How to attach the result of Julia REPL? (using vim & tmux)

Hi, I’m a beginner of Julia. I always don’t find out how to attach the result of Julia REPL. How can I do it? Note: I’m using vim & tmux. EDIT: it’s a matter of my terminal setup, see this. 8...

View Article

Zygote mutating arrays is not supported

I have a problem with differentiation in Zygote. Let me start with an example of what I need to achieve: If we have a vector like a = [0,2,4,1], and b = 2, I would like to create a vector which is a...

View Article

Looking for merge algorithm

Hi, I’m new to Julia coming from a C++ background. I have two sorted arrays and want to merge them, keeping the sort order in the merged result. I’m looking for an algorithm like the STL std::merge,...

View Article


Why are there no curried versions of map & filter?

I’ve written the following code today: branches = filter(strip.(readlines(`git branch --merged`))) do branch branch != "master" && !startswith(branch, '*') end It’s OK, but I’d love to be able...

View Article


Csv dateformat

Hello, I want to import data with a structure like that code,date 0,20190101 1,20190102 If I do t = CSV.read("file.txt"; dateformat="yyyymmdd") 2×2 DataFrame │ Row │ code │ date │ │ │ Int64 │ Int64 │...

View Article

Selecting multiple elements of an array by a list of indices

I have a list of indices, say inds = [[1,2], [2,3],[4,4]] that I want to use as indices into an array. For example, if A = reshape(1:16,4,4) then I would want to return the values [5, 10, 16]. I can,...

View Article

ForwardDiff and custom structure in DifferentialEquations

Hi, I am using DifferentialEquations with callbacks to solve a differential equation with parameters that change at some point in time. The solution works fine, it is taken directly from the...

View Article

Help with deSolveDiffEq

Why with deSolveDiffEq I am not receiving all the solutions of the system, as can be seen in the examples? I only get these results 19:42:41->>retcode: Default Interpolation: 1st order linear t:...

View Article


Load large Datamatrix with column and rownames

I need to read multiple large DataMatrices from a tsv into julia. They have column AND rownames. Do I have to realy read it in first and then slice the first column? What would be the best approach 4...

View Article

How to enter \n with backtick syntax?

Apparently, \n doesn’t work in backticks: julia> `echo "hello\nworld"` `echo 'hello\nworld'` julia> collect(`echo "hello\nworld"`) 2-element Array{String,1}: "echo" "hello\\nworld" Is there a...

View Article


How to floor a normed/fixed-point number in an idempotent way

Hello all, I am learning Julia through the MIT computational thinking course, and am curious if it’s possible to floor within a normed or fixed point type. Normally, I expect a number, once floored,...

View Article

How to register my own packages?

Hi, I’m trying to register my own package to General. As General said, I tried to register my package through JuliaHub. However, the General said " I was not able to load the package (i.e. import...

View Article


How to interactively refer to other modules' type?

I’m confused with interactively referring types across modules. Here’s my example: src/MyModuleA.jl module A using Reexport include("MyModuleB.jl") include("MyModuleC.jl") @reexport using .B @reexport...

View Article

Image may be NSFW.
Clik here to view.

GraphRecipes (or equivalent) for this series of plots

I have a directed graph in LightGraphs and I want to produce a series of plots each with the same circular layout but highlighting different subsets of edges, with highlighting on the nodes:...

View Article

When I declare an empty array, what does the output given by the typeof...

When I declare an empty array and call typeof(), I get the following output: numbers = [] println(typeof(numbers)) # Output: Array{Any,1} What does the 1 mean in this case? Does it mean it’s a one...

View Article
Browsing all 2795 articles
Browse latest View live