Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
252 views
in Technique[技术] by (71.8m points)

Concatenating tables with axis=1 in Orange python

I'm fairly new to Orange.

I'm trying to separate rows of angle (elv) into intervals. Let's say, if I want to separate my 90-degree angle into 8 intervals, or 90/8 = 11.25 degrees per interval.

Here's the table I'm working with

Here's the table I'm working with

Here's what I did originally, separating them by their elv value

Here's what I did originally, separating them by their elv value

Here's the result that I want, x rows 16 columns separated by their elv value.

Here's the result that I want, x rows 16 columns separated by their elv value.

But I want them done dynamically. I list them out and turn each list into a table with x rows and 2 columns.

This is what I originally did

from Orange.data.table import Table
from Orange.data import Domain, Domain, ContinuousVariable, DiscreteVariable
import numpy
import pandas as pd
from pandas import DataFrame
df = pd.DataFrame()

num = 10 #number of intervals that we want to seperate our elv into.
interval = 90.00/num  #separating them into degree/interval
low = 0
high = interval

table = []
first = []
second = []
for i in range(num):
    between = []
    if i != 0:  #not the first run
        low = high
        high = high + interval
    for row in in_data:    #Run through the whole table to see if the elv falls in between interval
        if row[0] >= low and row[0] < high:
            between.append(row)
    
    elv = "elv" + str(i)
    err = "err" + str(i)
    domain = Domain([ContinuousVariable.make(err)],[ContinuousVariable.make(elv)])
    data = Table.from_numpy(domain, numpy.array(between))

    print("table number ", i)
    print(data[:3])

Here's the output

But as you can see, these are separated tables being assigned every loop. And I have to find a way to concatenate axis = 1 for these tables.

Even the source code for Orange3 forbids this for some reason.

Even the source code for Orange3 forbids this for some reason.

question from:https://stackoverflow.com/questions/65839758/concatenating-tables-with-axis-1-in-orange-python

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...