multiplying two array in python3.7Tensorflow neural network TypeError: Fetch argument has invalid typeAppending to numpy array for creating datasetCustom conditional Keras metricTypeError: '<' not supported between instances of 'int' and 'str'The truth value of an array with more than one element is ambiguousHow feed a numpy array in batches in KerasPython: multiplication of sparse matrices slower in csr_matrix than numpy
How to avoid the "need" to learn more before conducting research?
ICO or PNG Format?
A simple stop watch which I want to extend
English - Acceptable use of parentheses in an author's name
Te-form and かつ and も?
Is Texas Instrument wrong with their pin number on TO-92 package?
Are differences between uniformly distributed numbers uniformly distributed?
Sign changes after taking the square root inequality. Why?
Three legged NOT gate? What is this symbol?
A tool to replace all words with antonyms
Can the Action some concentration spells grant be used in Attacks of Opportunity with the War Caster feat?
Can you castle with a "ghost" rook?
CTCI Chapter 1 : Palindrome Permutation
What is the length of pair of wires after twisting them around each other?
Should you play baroque pieces a semitone lower?
Multirow in tabularx?
multiplying two array in python3.7
What gave Harry Potter the idea of writing in Tom Riddle's diary?
How many different ways are there to checkmate in the early game?
Double redundancy for the Saturn V LVDC computer memory, how were disagreements resolved?
On the Rømer experiments and the speed if light
What does Apple mean by "This may decrease battery life"?
How to mark beverage cans in a cooler for a blind person?
Why did Gandalf use a sword against the Balrog?
multiplying two array in python3.7
Tensorflow neural network TypeError: Fetch argument has invalid typeAppending to numpy array for creating datasetCustom conditional Keras metricTypeError: '<' not supported between instances of 'int' and 'str'The truth value of an array with more than one element is ambiguousHow feed a numpy array in batches in KerasPython: multiplication of sparse matrices slower in csr_matrix than numpy
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
$begingroup$
I am trying to multiply two array in python 3.7 using numpy by using the following syntax:
array1 = np.array([1,2,3,4,5,6,7,8])
print (array1)
array2=array1*array1
print(array2)
but this error arises
TypeError: unsupported operand type(s) for *: 'set' and 'set'
python numpy
New contributor
$endgroup$
add a comment |
$begingroup$
I am trying to multiply two array in python 3.7 using numpy by using the following syntax:
array1 = np.array([1,2,3,4,5,6,7,8])
print (array1)
array2=array1*array1
print(array2)
but this error arises
TypeError: unsupported operand type(s) for *: 'set' and 'set'
python numpy
New contributor
$endgroup$
add a comment |
$begingroup$
I am trying to multiply two array in python 3.7 using numpy by using the following syntax:
array1 = np.array([1,2,3,4,5,6,7,8])
print (array1)
array2=array1*array1
print(array2)
but this error arises
TypeError: unsupported operand type(s) for *: 'set' and 'set'
python numpy
New contributor
$endgroup$
I am trying to multiply two array in python 3.7 using numpy by using the following syntax:
array1 = np.array([1,2,3,4,5,6,7,8])
print (array1)
array2=array1*array1
print(array2)
but this error arises
TypeError: unsupported operand type(s) for *: 'set' and 'set'
python numpy
python numpy
New contributor
New contributor
edited 9 hours ago
Peter
1,3291 gold badge3 silver badges19 bronze badges
1,3291 gold badge3 silver badges19 bronze badges
New contributor
asked 10 hours ago
Charvi YadavCharvi Yadav
61 bronze badge
61 bronze badge
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
You are simply defining your array so that it is made of python set
s. That is a different data structure which is not able to be multiplied, unlike an array.
Just change your code to this:
array1 = np.array([[1,2,3,4],[5,6,7,8]])
The only difference is using square brackets instead of curly ones. These are python list
objects (or standard arrays).
array2=array1*array1
print(array2)
[[ 1 4 9 16]
[25 36 49 64]]
$endgroup$
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "557"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Charvi Yadav is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f57393%2fmultiplying-two-array-in-python3-7%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
You are simply defining your array so that it is made of python set
s. That is a different data structure which is not able to be multiplied, unlike an array.
Just change your code to this:
array1 = np.array([[1,2,3,4],[5,6,7,8]])
The only difference is using square brackets instead of curly ones. These are python list
objects (or standard arrays).
array2=array1*array1
print(array2)
[[ 1 4 9 16]
[25 36 49 64]]
$endgroup$
add a comment |
$begingroup$
You are simply defining your array so that it is made of python set
s. That is a different data structure which is not able to be multiplied, unlike an array.
Just change your code to this:
array1 = np.array([[1,2,3,4],[5,6,7,8]])
The only difference is using square brackets instead of curly ones. These are python list
objects (or standard arrays).
array2=array1*array1
print(array2)
[[ 1 4 9 16]
[25 36 49 64]]
$endgroup$
add a comment |
$begingroup$
You are simply defining your array so that it is made of python set
s. That is a different data structure which is not able to be multiplied, unlike an array.
Just change your code to this:
array1 = np.array([[1,2,3,4],[5,6,7,8]])
The only difference is using square brackets instead of curly ones. These are python list
objects (or standard arrays).
array2=array1*array1
print(array2)
[[ 1 4 9 16]
[25 36 49 64]]
$endgroup$
You are simply defining your array so that it is made of python set
s. That is a different data structure which is not able to be multiplied, unlike an array.
Just change your code to this:
array1 = np.array([[1,2,3,4],[5,6,7,8]])
The only difference is using square brackets instead of curly ones. These are python list
objects (or standard arrays).
array2=array1*array1
print(array2)
[[ 1 4 9 16]
[25 36 49 64]]
answered 7 hours ago
n1k31t4n1k31t4
8,0112 gold badges6 silver badges27 bronze badges
8,0112 gold badges6 silver badges27 bronze badges
add a comment |
add a comment |
Charvi Yadav is a new contributor. Be nice, and check out our Code of Conduct.
Charvi Yadav is a new contributor. Be nice, and check out our Code of Conduct.
Charvi Yadav is a new contributor. Be nice, and check out our Code of Conduct.
Charvi Yadav is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Data Science Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdatascience.stackexchange.com%2fquestions%2f57393%2fmultiplying-two-array-in-python3-7%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown