5 replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
source | link

I have a dataset which has a column called "PS_I". I cannot change this because I imported the column from an existing csv.

I would like to add another column. Such as:

data = data[All, Append[#,"newPSI" -> #PS_I * 3]&]

But that doesn't work due to underscore being a predefined character.

How do I get around this?

EDIT: Here's an example.

This is one column with such an index:

data = Dataset[ {<|"PS_I" -> 1|>,
   <|"PS_I" -> 2|>,
   <|"PS_I" -> 3|>,
   <|"PS_I" -> 4|>,
   <|"PS_I" -> 5|>,
   <|"PS_I" -> 6|>,
   <|"PS_I" -> 7|>}]

And I want to create a new column with some operation on the values of the PS_I column. Kind of what this answer suggested: http://mathematica.stackexchange.com/questions/51472/how-can-i-add-a-column-into-a-existing-datasetHow can I add a column into a existing Dataset?

The underscore does not allow for these type of operations, and I would like to know how to deal with this problem.

EDIT2:

Here's how to reproduce the problem, now with input from JasonB:

1) Create a csv with these contents: http://pastebin.com/eYUaW2bV

2) Run

data = SemanticImport["<pathtofolder>/example.csv"];

3) Try to append with

data = data[All, Append[#,"newPSI" -> #"PS_I" * 3]&]

I have a dataset which has a column called "PS_I". I cannot change this because I imported the column from an existing csv.

I would like to add another column. Such as:

data = data[All, Append[#,"newPSI" -> #PS_I * 3]&]

But that doesn't work due to underscore being a predefined character.

How do I get around this?

EDIT: Here's an example.

This is one column with such an index:

data = Dataset[ {<|"PS_I" -> 1|>,
   <|"PS_I" -> 2|>,
   <|"PS_I" -> 3|>,
   <|"PS_I" -> 4|>,
   <|"PS_I" -> 5|>,
   <|"PS_I" -> 6|>,
   <|"PS_I" -> 7|>}]

And I want to create a new column with some operation on the values of the PS_I column. Kind of what this answer suggested: http://mathematica.stackexchange.com/questions/51472/how-can-i-add-a-column-into-a-existing-dataset

The underscore does not allow for these type of operations, and I would like to know how to deal with this problem.

EDIT2:

Here's how to reproduce the problem, now with input from JasonB:

1) Create a csv with these contents: http://pastebin.com/eYUaW2bV

2) Run

data = SemanticImport["<pathtofolder>/example.csv"];

3) Try to append with

data = data[All, Append[#,"newPSI" -> #"PS_I" * 3]&]

I have a dataset which has a column called "PS_I". I cannot change this because I imported the column from an existing csv.

I would like to add another column. Such as:

data = data[All, Append[#,"newPSI" -> #PS_I * 3]&]

But that doesn't work due to underscore being a predefined character.

How do I get around this?

EDIT: Here's an example.

This is one column with such an index:

data = Dataset[ {<|"PS_I" -> 1|>,
   <|"PS_I" -> 2|>,
   <|"PS_I" -> 3|>,
   <|"PS_I" -> 4|>,
   <|"PS_I" -> 5|>,
   <|"PS_I" -> 6|>,
   <|"PS_I" -> 7|>}]

And I want to create a new column with some operation on the values of the PS_I column. Kind of what this answer suggested: How can I add a column into a existing Dataset?

The underscore does not allow for these type of operations, and I would like to know how to deal with this problem.

EDIT2:

Here's how to reproduce the problem, now with input from JasonB:

1) Create a csv with these contents: http://pastebin.com/eYUaW2bV

2) Run

data = SemanticImport["<pathtofolder>/example.csv"];

3) Try to append with

data = data[All, Append[#,"newPSI" -> #"PS_I" * 3]&]
    Post Closed as "off-topic" by WReach, MarcoB, Feyre, happy fish, Sascha
4 added 2 characters in body
source | link

I have a dataset which has a column called "PS_I". I cannot change this because I imported the column from an existing csv.

I would like to add another column. Such as:

data = data[All, Append[#,"newPSI" -> #PS_I * 3]&]

But that doesn't work due to underscore being a predefined character.

How do I get around this?

EDIT: Here's an example.

This is one column with such an index:

data = Dataset[ {<|"PS_I" -> 1|>,
   <|"PS_I" -> 2|>,
   <|"PS_I" -> 3|>,
   <|"PS_I" -> 4|>,
   <|"PS_I" -> 5|>,
   <|"PS_I" -> 6|>,
   <|"PS_I" -> 7|>}]

And I want to create a new column with some operation on the values of the PS_I column. Kind of what this answer suggested: http://mathematica.stackexchange.com/questions/51472/how-can-i-add-a-column-into-a-existing-dataset

The underscore does not allow for these type of operations, and I would like to know how to deal with this problem.

EDIT2:

Here's how to reproduce the problem, now with input from JasonB:

1) Create a csv with these contents: http://pastebin.com/eYUaW2bV

2) Run

data = SemanticImport["<pathtofolder>/example.csv"];

3) Try to append with

data = data[All, Append[#,"newPSI" -> #PS_I#"PS_I" * 3]&]

I have a dataset which has a column called "PS_I". I cannot change this because I imported the column from an existing csv.

I would like to add another column. Such as:

data = data[All, Append[#,"newPSI" -> #PS_I * 3]&]

But that doesn't work due to underscore being a predefined character.

How do I get around this?

EDIT: Here's an example.

This is one column with such an index:

data = Dataset[ {<|"PS_I" -> 1|>,
   <|"PS_I" -> 2|>,
   <|"PS_I" -> 3|>,
   <|"PS_I" -> 4|>,
   <|"PS_I" -> 5|>,
   <|"PS_I" -> 6|>,
   <|"PS_I" -> 7|>}]

And I want to create a new column with some operation on the values of the PS_I column. Kind of what this answer suggested: http://mathematica.stackexchange.com/questions/51472/how-can-i-add-a-column-into-a-existing-dataset

The underscore does not allow for these type of operations, and I would like to know how to deal with this problem.

EDIT2:

Here's how to reproduce the problem, now with input from JasonB:

1) Create a csv with these contents: http://pastebin.com/eYUaW2bV

2) Run

data = SemanticImport["<pathtofolder>/example.csv"];

3) Try to append with

data = data[All, Append[#,"newPSI" -> #PS_I * 3]&]

I have a dataset which has a column called "PS_I". I cannot change this because I imported the column from an existing csv.

I would like to add another column. Such as:

data = data[All, Append[#,"newPSI" -> #PS_I * 3]&]

But that doesn't work due to underscore being a predefined character.

How do I get around this?

EDIT: Here's an example.

This is one column with such an index:

data = Dataset[ {<|"PS_I" -> 1|>,
   <|"PS_I" -> 2|>,
   <|"PS_I" -> 3|>,
   <|"PS_I" -> 4|>,
   <|"PS_I" -> 5|>,
   <|"PS_I" -> 6|>,
   <|"PS_I" -> 7|>}]

And I want to create a new column with some operation on the values of the PS_I column. Kind of what this answer suggested: http://mathematica.stackexchange.com/questions/51472/how-can-i-add-a-column-into-a-existing-dataset

The underscore does not allow for these type of operations, and I would like to know how to deal with this problem.

EDIT2:

Here's how to reproduce the problem, now with input from JasonB:

1) Create a csv with these contents: http://pastebin.com/eYUaW2bV

2) Run

data = SemanticImport["<pathtofolder>/example.csv"];

3) Try to append with

data = data[All, Append[#,"newPSI" -> #"PS_I" * 3]&]
3 added 4 characters in body
source | link

I have a dataset which has a column called "PS_I". I cannot change this because I imported the column from an existing csv.

I would like to add another column. Such as:

data = data[All, Append[#,"newPSI" -> #PS_I * 3]&]

But that doesn't work due to underscore being a predefined character.

How do I get around this?

EDIT: Here's an example.

This is one column with such an index:

data = Dataset[ {<|"PS_I" -> 1|>,
   <|"PS_I" -> 2|>,
   <|"PS_I" -> 3|>,
   <|"PS_I" -> 4|>,
   <|"PS_I" -> 5|>,
   <|"PS_I" -> 6|>,
   <|"PS_I" -> 7|>}]

And I want to create a new column with some operation on the values of the PS_I column. Kind of what this answer suggested: http://mathematica.stackexchange.com/questions/51472/how-can-i-add-a-column-into-a-existing-dataset

The underscore does not allow for these type of operations, and I would like to know how to deal with this problem.

EDIT2:

Here's how to reproduce the problem, now with input from JasonB:

1) Create a csv with these contents: http://pastebin.com/eYUaW2bV

2) Run

data = SemanticImport["<pathtofolder>/example.csv"];

3) Try to append with

data = data[All, Append[#,"newPSI" -> #PS_I * 3]&]

I have a dataset which has a column called "PS_I". I cannot change this because I imported the column from an existing csv.

I would like to add another column. Such as:

data = data[All, Append[#,"newPSI" -> #PS_I * 3]&]

But that doesn't work due to underscore being a predefined character.

How do I get around this?

EDIT: Here's an example.

This is one column with such an index:

data = Dataset[ {<|"PS_I" -> 1|>,
   <|"PS_I" -> 2|>,
   <|"PS_I" -> 3|>,
   <|"PS_I" -> 4|>,
   <|"PS_I" -> 5|>,
   <|"PS_I" -> 6|>,
   <|"PS_I" -> 7|>}]

And I want to create a new column with some operation on the values of the PS_I column. Kind of what this answer suggested: http://mathematica.stackexchange.com/questions/51472/how-can-i-add-a-column-into-a-existing-dataset

The underscore does not allow for these type of operations, and I would like to know how to deal with this problem.

I have a dataset which has a column called "PS_I". I cannot change this because I imported the column from an existing csv.

I would like to add another column. Such as:

data = data[All, Append[#,"newPSI" -> #PS_I * 3]&]

But that doesn't work due to underscore being a predefined character.

How do I get around this?

EDIT: Here's an example.

This is one column with such an index:

data = Dataset[ {<|"PS_I" -> 1|>,
   <|"PS_I" -> 2|>,
   <|"PS_I" -> 3|>,
   <|"PS_I" -> 4|>,
   <|"PS_I" -> 5|>,
   <|"PS_I" -> 6|>,
   <|"PS_I" -> 7|>}]

And I want to create a new column with some operation on the values of the PS_I column. Kind of what this answer suggested: http://mathematica.stackexchange.com/questions/51472/how-can-i-add-a-column-into-a-existing-dataset

The underscore does not allow for these type of operations, and I would like to know how to deal with this problem.

EDIT2:

Here's how to reproduce the problem, now with input from JasonB:

1) Create a csv with these contents: http://pastebin.com/eYUaW2bV

2) Run

data = SemanticImport["<pathtofolder>/example.csv"];

3) Try to append with

data = data[All, Append[#,"newPSI" -> #PS_I * 3]&]
2 added 611 characters in body
source | link
1
source | link