multiplying two array in python3.7Tensorflow neural network TypeError: Fetch argument has invalid...

What is the length of pair of wires after twisting them around each other?

Visa National - No Exit Stamp From France on Return to the UK

What happens if I delete an icloud backup?

Tikzpicture - finish drawing a curved line for a cake slice

During the Space Shuttle Columbia Disaster of 2003, Why Did The Flight Director Say, "Lock the doors."?

How are you supposed to know the strumming pattern for a song from the "chord sheet music"?

ICO or PNG Format?

Te-form and かつ and も?

Write an interpreter for *

How to avoid the "need" to learn more before conducting research?

create a tuple from pairs

CTCI Chapter 1 : Palindrome Permutation

First amendment and employment: Can a police department terminate an officer for speech?

What are the uses and limitations of Persuasion, Insight, and Deception against other PCs?

What are the conventions for transcribing Semitic languages into Greek?

Blocking people from taking pictures of me with smartphone

Understanding the point of a kölsche Witz

How to take the beginning and end parts of a list with simpler syntax?

Acceptable to cut steak before searing?

Ex-contractor published company source code and secrets online

A simple stop watch which I want to extend

DeclareMathOperator and widearcarrow with kpfonts

(11 of 11: Meta) What is Pyramid Cult's All-Time Favorite?

As a 16 year old, how can I keep my money safe from my mother?



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

                    Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

                    Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

                    Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...