[go: up one dir, main page]

Items tagged with dataframe

Feed App Center

Is there a way to re-index an existing dataframe? See attachment for example.

how_do_i_re-index_a_dataframe.mw

Dear Power Users, Dataframes are a powerful tool within Maple. However, when I have 'undefined' in cells "Aggregate" or "DataSummary" does not provide answers. However, when I use "Statistics:-Mean" with the additional option "ignore=true" I can get an answer for one column (see attached worksheet). Adding "ignore" to aggregate apparently does not work. What is the method for ignoring the undefined data? In Excel when a cell is blank it will be ignored. Thank you for any help given.MP_Aggregate.mw

Hello. I am trying to use the Remove() command to remove a column of a dataframe. I applied the command like its shown in the help section and I get an error. I don't see how I am applying this command incorrectly. Where am I going wrong? Below is a screenshot of the error output and the .mw file used to generate the output.

Remove_a_column_from_a_dataframe.mw

Dear power users, I was wondering whether it is possible to import a xlsx file in such a way that the first row of the file is imported as column headers of the dataframe in Maple? Thank you in advance for any help given.

I was working with a Dataframe when I wanted to change the datatype of multiple columns at the same time as this is quite a large dataframe. I found in the helpfile that I can change datatype by the following command: 

SubsDatatype(Data, plts, float) which then change the datatype of "plts" into float. I had hoped that using multiple columns in the command would work in this way: SubsDatatype(Data, [plts, act], float)  but apparently not. Is there a way to do this or do I have to do it column by column?

Additionally I have another question about dataframes. I would like to replace "0" in the dataframe by a "blank" as you can do in excel. How do you do this in a dataframe?

Thanks in advance for any help given!

I have a Dataframe of data, although I assume this question applies to any type of rTable-like structure.

What is a simple/elegant way to export the image of the data to a JPG file?  I would be happy to see it in the format when I ask it to print the Dataframe, or when I use DocumentTools:-Tabulate.

Hello, 

do you have an idea how could be filtered several values from dataframe? 
I have a dataframe called "TestData". I need to select rows from data frame which are equal to the list called "SelectionList". 

Thank you for a comment. 
 

Data:=<"LC1", "LC2", "LC3", "LC4", "LC5", "LC6", "LC7", "LC8", "LC9", "LC10", "LC11", "LC12", "LC13", "LC14", "LC15", "LC16", "LC17", "LC18", "LC19", "LC20">;
LoadValue2:=<10,15,100,82,18,89,25,84,46,18,79,12,0,28,147,15,86,444,18,65>;

TestData:=DataFrame(<Data|LoadValue2>,columns=[Case,Load]);

SelectionList:={"LC3", "LC4", "LC5", "LC6", "LC7", "LC8", "LC9"};

I would expect I could do

A := DataSeries([2, 3, 4], datatype = float)
B := DataSeries([1, 3, 19], datatype = float)
min~(A, B)

but the last command gives me 

Error, (in DataSeries:-min) invalid boolean expression: 2.

How do I find the element-wise min (i.e. DataSeries([1,3,4], datatype=float)) of two DataSeries?

I would like to create a database of component information. I have previously done this using a table which is indexed by the part number. Each element is a DataFrame, which includes several items with values and at least 2 DataFrames. The 2 DataFrames are extracted from a Spreadsheet with 2 tabs, that is stored in a Maple Workbook. Each DataFrame has an name for the row and 2 columns; Description and Value. The Description is text and the value is a single value or 3-element list with unit. Such at [9, 10, 11]*~Unit('ohm')

Anyway, I'm wondering if this is the most efficient way. I'm also wondering if there is a way to create such a database so it can be used with other software tools, primarily Mathcad and Excel.

Thanks

In a dataframe you can easily replace 'undefined' by another value using FillMissing. However, if you want to remove the row in which a cell contained 'undefined' this seems not to be possible. 'DropMissing' will remove the complete column in which one of the cells contains 'undefined'. Is there another command that removes the row of the dataframe as a column contains an 'undefined'? Sorry for the simplistic question but I am still in my learning curve. 

Dear Forum,

I get data from a mass-spectrometer and want to do some analysis on it . 

What I get looks like this : ( only a few lines, the files are very large )

t[s]; scanId; m/z; I[A]; pTot[mbar]
2.00;0;0; 0.000000e+000; 0.000000e+000
4.00;0;0; 0.000000e+000; 0.000000e+000
441.00;0;0; 0.000000e+000;1,29E+00
443.00;0;0; 0.000000e+000;1,29E+00
453.00;0;0; 0.000000e+000;1,26E+00
455.00;0;0; 0.000000e+000;1,24E+00
463.00;1; 0.390625;8,14E-05;1,23E+00
464.00;1; 0.40625;1,23E-04;1,43E+00
464.00;1; 0.421875;1,73E-04;1,43E+00
464.00;1; 0.4375;2,27E-04;1,43E+00
464.00;1; 0.453125;2,77E-04;1,43E+00

When I add some blanks, it looks like this :  

t[s];        scanId;   m/z;              I[A];               pTot[mbar]

464.00;  1;           0.421875;     1,73E-04;     1,43E+00

The columns are separated by semicolon

t[s]  and m/z are separated with a dot,  I[A]  and p come as exponentials with a comma.

When I try to import this  with

 BKK := Import("H:\\Maple\\Spielwiese\\BGSample.csv")

I get a DataFrame with two columns -correct-  because there are two commas. 

Is there a way to import such data without preprocessing into maple ?

I include the data file, had to change the suffix to .txt - the original is .csv

Thank you and kind regards, 

Klaus

BKK := Import("H:\\Maple\\Spielwiese\\BGSample.csv")

module DataFrame () description "two-dimensional rich data container"; local columns, rows, data, binder; option object(BaseDataObject); end module

(1)

BKK[10, 1] = 27.NULL

NULL

Download howdoiimportthis.mw

Dears,

Of course, I'm not talking about questioning the structure of the data itself.  This is the basic form of data manipulation in packages such as R, Julia, Python. I am asking what is the DataFrame in Maple for?
Importing a file (attachment) containing about 50,000 rows in 13 columns takes nearly 1 minute. Attempting to do any operation using DataFrame is practically impossible due to computer slowdown. (DELL XPS 17 9710, Maple 2022.2).

Whereas ImportMatrix() and matrix operations (select, remove, map, etc.) take a part of one second.

I wanted to give an example of some simple operation on the DataFrame object, but unfortunately, I lost my patience.

I have attached the file that I wanted to load for testing, which is part of the original (250K rows x 13 columns):

https://www.kaggle.com/datasets/subhamjain/loan-prediction-based-on-customer-behavior?resource=download

50kX13_LOAN.xlsx

It's also possible that I'm doing something wrong..., then I'd like some guidance from you guys. I like the DataFrame concept in Maple. It's just about usability.

wzelik

Hello,

    I am regularly using tabled data for things like material properties, or other tabled look-up data from induustry or custom datasets.

    I have not used workbooks within Maple and yet see that exel files or other data sets can be "connected(?)" in the workbook tree.  Is this helpful?

    What is the best practice view of connecting to DB data and looking up variables that repeat project to project or worksheet to worksheet - without pulling into memory the full datasets for each ref call?

All thoughts appreciated.   

P.S., Tables vs. dataframes are a slight confusing matter also.  The access to the cell info seems different based on dataframe/table/matrix type.  I have no problems with matrix element access.

Thanks,
Bill

Perhaps a silly question but is it possible to stack two dataframe columns? When I use the Vector command the columns are stacked but nested.

Thank you for your help

I know you can filter a dataframe by putting constraints on the numeric columns. However, I would like to sort and filter based upon a given string in a column, is this possible? I cannot immediately find this in the help files. Thank you for your assistance.QuestionDataFrame.mw

1 2 3 Page 1 of 3