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;








1












$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'









share|improve this question









New contributor



Charvi Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






$endgroup$




















    1












    $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'









    share|improve this question









    New contributor



    Charvi Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






    $endgroup$
















      1












      1








      1





      $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'









      share|improve this question









      New contributor



      Charvi Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      $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






      share|improve this question









      New contributor



      Charvi Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.










      share|improve this question









      New contributor



      Charvi Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      share|improve this question




      share|improve this question








      edited 10 hours ago









      Peter

      1,3291 gold badge3 silver badges19 bronze badges




      1,3291 gold badge3 silver badges19 bronze badges






      New contributor



      Charvi Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.








      asked 11 hours ago









      Charvi YadavCharvi Yadav

      61 bronze badge




      61 bronze badge




      New contributor



      Charvi Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




      New contributor




      Charvi Yadav is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.

























          1 Answer
          1






          active

          oldest

          votes


















          2












          $begingroup$

          You are simply defining your array so that it is made of python sets. 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]]





          share|improve this answer









          $endgroup$

















            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.









            draft saved

            draft discarded


















            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









            2












            $begingroup$

            You are simply defining your array so that it is made of python sets. 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]]





            share|improve this answer









            $endgroup$



















              2












              $begingroup$

              You are simply defining your array so that it is made of python sets. 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]]





              share|improve this answer









              $endgroup$

















                2












                2








                2





                $begingroup$

                You are simply defining your array so that it is made of python sets. 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]]





                share|improve this answer









                $endgroup$



                You are simply defining your array so that it is made of python sets. 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]]






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 8 hours ago









                n1k31t4n1k31t4

                8,0112 gold badges6 silver badges27 bronze badges




                8,0112 gold badges6 silver badges27 bronze badges























                    Charvi Yadav is a new contributor. Be nice, and check out our Code of Conduct.









                    draft saved

                    draft discarded


















                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    ParseJSON using SSJSUsing AMPscript with SSJS ActivitiesHow to resubscribe a user in Marketing cloud using SSJS?Pulling Subscriber Status from Lists using SSJSRetrieving Emails using SSJSProblem in updating DE using SSJSUsing SSJS to send single email in Marketing CloudError adding EmailSendDefinition using SSJS

                    Кампала Садржај Географија Географија Историја Становништво Привреда Партнерски градови Референце Спољашње везе Мени за навигацију0°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.340°11′ СГШ; 32°20′ ИГД / 0.18° СГШ; 32.34° ИГД / 0.18; 32.34МедијиПодациЗванични веб-сајту

                    19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу