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 mark beverage cans in a cooler for a blind person?
Three legged NOT gate? What is this symbol?
Generate Brainfuck for the numbers 1–255
constant evaluation when using differential equations.
What are the conventions for transcribing Semitic languages into Greek?
A tool to replace all words with antonyms
Who are these characters/superheroes in the posters from Chris's room in Family Guy?
Y2K... in 2019?
Visa National - No Exit Stamp From France on Return to the UK
What happen to those who died but not from the snap?
How to avoid the "need" to learn more before conducting research?
Why did Gandalf use a sword against the Balrog?
How does 'AND' distribute over 'OR' (Set Theory)?
As a 16 year old, how can I keep my money safe from my mother?
Why does Intel's Haswell chip allow FP multiplication to be twice as fast as addition?
Why is transplanting a specific intact brain impossible if it is generally possible?
Blocking people from taking pictures of me with smartphone
How can I shift my job responsibilities back to programming?
Can the ground attached to neutral fool a receptacle tester?
Can a fight scene, component-wise, be too complex and complicated?
Is there a standardised way to check fake news?
I accidentally overwrote a Linux binary file
Am I overreacting to my team leader's unethical requests?
What is the maximum number of PC-controlled undead?
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 10 hours ago
Peter
1,3291 gold badge3 silver badges19 bronze badges
1,3291 gold badge3 silver badges19 bronze badges
New contributor
asked 11 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 8 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