Questions tagged [julia-dataframe]
51 questions
1
vote
1 answer
How to get row number and make it another column in DataFrames in Julia?
I need to inner-join 2 dataframes: routes and sources. Joining should be on routes.source=sources.row number. And I don't see how to do it (in Python/Pandas you'd just do right_index=True). I've checked the DataFrames.jl doc, and can't see how to…

culebrón
- 34,265
- 20
- 72
- 110
1
vote
1 answer
Iterate over dataframe names in Julia
I am trying to generate n dataframes using a loop, where each dataframe has one column with i rows populated with random numbers where i=1:n. So far, none of the following iterating methods work for iterating over dataframe names in order to…

Moshi
- 193
- 6
1
vote
1 answer
Change datatype of column in a Dataframe in Julia
I have a dataframe df = DataFrame(CSV.File("file.csv", delim=";;")).
The dataframe has three columns (column1 = Date, column2 = String31, column3 = String15).
column1 | column2 | column3
date | String31 | String15
2022-06-29 | …

hbrovell
- 547
- 6
- 17
1
vote
2 answers
Renaming multiple columns in Julia DataFrames
I have the following Julia Daataframe;
data_test = DataFrame(Time = 1:2, X1 = [0,1], X2 = [10,5])
And I have a list of names as follows;
technology = ["oil", "gas"]
How do I rename columns X1 and X2 using the list (excluding Time column). I can do…

M.B
- 19
- 7
1
vote
1 answer
Applying replace over a list of certain columns of a dataframe
I have a list with names of 30 columns in a dataframe.
I have to apply replace to these 30 columns only.
I tried:
list = names(df[!,r"Com"]) - ok!
Then I am trying:
replace!(df[!,list],"RR" =>"AA") - Fail
How can I do such transformation(with…

merchmallow
- 774
- 3
- 15
1
vote
1 answer
How to groupby 200 features at once using Julia
I am looking for a way to perform these operations in julia:
From a daframe I have 200 columns that I want to groupby one-by-one doing this:
column1_grouped = combine(df,column_1),[:fixed_parameter] .=> mean)
column2_grouped =…

pouchewar
- 399
- 1
- 10
1
vote
1 answer
Julia Groupby with mean calculation
I have this dataframe:
d=DataFrame(class=["A","A","A","B","C","D","D","D"],
num=[10,20,30,40,20,20,13,12],
last=[3,5,7,9,11,13,100,12])
and I want to do a groupby. In Python I would…

merchmallow
- 774
- 3
- 15
1
vote
2 answers
Transform all DataFrame Columns of a specific Type in Julia
I have a DataFrame with Int64 columns:
using DataFrames
df = DataFrame(a=1:3,b=4:6,c=["a","b","c"])
3×2 DataFrame
Row │ a b c
│ Int64 Int64 String
─────┼──────────────────────
1 │ 1 4 a
2 │ 2 5 b
3…

Georgery
- 7,643
- 1
- 19
- 52
1
vote
1 answer
Operation with Julia DataFrame
I have a dataframe:
signal value
weak 100
strong 20
neutral 300
How can I make this calculation:
(weak(100) - strong(20)) / weak+strong+neutral
The result should be: 0.19

merchmallow
- 774
- 3
- 15
1
vote
1 answer
Julia - looping through a dataframe and performing conditional operation
Havent been able to find anything similar, and new to Julia.
Trying to see if this can be done in a single process, or should be split up, or something else I am not thinking of.
Basically as the df below shows - trying to see how i can add a…

SubT
- 11
- 3
1
vote
1 answer
Unable to add a variable in Julia DataFrame
I am trying to read all files from a folder and trying to create filename variable based on name of the file
I am using the below code to do it. But I am unable to add the variable which lets me know the filename -
using DataFrame
using…

Harneet.Lamba
- 195
- 9
1
vote
1 answer
Dataframe gets cut before an empty row in an excelfile
I have an excel file which has 79 rows and 12 columns.
The problem I have is that when I run the following code, I only get 8 rows and 1 column.
Row 9, is an empty row, and I think this is the problem. But I don't know how to get by this problem. I…

hbrovell
- 547
- 6
- 17
1
vote
1 answer
Methoderror: no method matching isless when using sort() on Dataframe in Julia
I have an excelfile, which I read into a Dataframe.
using DataFrames, XLSX
df = DataFrame(XLSX.readtable("Stocks/WIHL-Wihlborgs.xlsx", "PriceMonth")...)
│ Row │ Date │ Openprice │ Highprice │ Lowprice │ Closeprice │ Volume │
│ │ Any …

hbrovell
- 547
- 6
- 17
1
vote
1 answer
How to perform Vertical Concatenation with mismatched column names?
I have two df's like below,
df1
│ Row │ x1 │ x2 │ x3 │
│ │ Int64 │ Int64 │ Int64 │
├─────┼───────┼───────┼───────┤
│ 1 │ 8 │ 1 │ 4 │
│ 2 │ 4 │ 3 │ 1 │
│ 3 │ 7 │ 8 │ 1 │
df2
│ Row │ x1 │ x2 …

Mohamed Thasin ah
- 10,754
- 11
- 52
- 111
0
votes
1 answer
Plotting error data frame to series Julia
I am having trouble plotting in Julia. After uploading an excel file into a data frame and plotting, I the error: 'Cannot Convert Dataframe to series data for plotting'.
For reference the simplest code to trigger error:
using Plots, XLSX,…

jtancp
- 23
- 2