How to edit cells in a Pandas DataFrame without header?How do I check whether a file exists without exceptions?How to sort a dataframe by multiple column(s)Add one row to pandas DataFrameSelecting multiple columns in a pandas dataframeAdding new column to existing DataFrame in Python pandasDelete column from pandas DataFrameHow do I get the row count of a pandas DataFrame?How to iterate over rows in a DataFrame in Pandas?Select rows from a DataFrame based on values in a column in pandasGet list from pandas DataFrame column headers

Having decision making power over someone's assets

Received a dinner invitation through my employer's email, is it ok to attend?

Given a 32 bit number, what is an efficient way to scale each byte by a certain factor?

Are there any sports for which the world's best player is female?

Is a request to book a business flight ticket for a graduate student an unreasonable one?

GDPR rights when subject dies; does family inherit subject rights?

How to tell someone I'd like to become friends without letting them think I'm romantically interested in them?

Why does the Antonov AN-225 not have any winglets?

LED glows slightly during soldering

Postgres trigram match acting strange for specific characters

Why do we need common sense in AI?

Reverse dots and boxes

What is a "Lear Processor" and how did it work?

How can a dictatorship government be beneficial to a dictator in a post-scarcity society?

Do you need Read access to an object to view its records in a report?

What's the point of having a RAID 1 configuration over incremental backups to a secondary drive?

How do we handle pauses in a dialogue?

How often does the spell Sleet Storm require concentration checks?

Elf (adjective) vs. Elvish vs. Elven

Would it be appropriate to sand a floor between coats of poly with a handheld orbital sander?

Can I play a mimic PC?

What happens when adult Billy Batson says "Shazam"?

A horrible Stockfish chess engine evaluation

Is there any reason why MCU changed the Snap to Blip



How to edit cells in a Pandas DataFrame without header?


How do I check whether a file exists without exceptions?How to sort a dataframe by multiple column(s)Add one row to pandas DataFrameSelecting multiple columns in a pandas dataframeAdding new column to existing DataFrame in Python pandasDelete column from pandas DataFrameHow do I get the row count of a pandas DataFrame?How to iterate over rows in a DataFrame in Pandas?Select rows from a DataFrame based on values in a column in pandasGet list from pandas DataFrame column headers






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I have a Pandas DataFrame without header and I need to edit all cells.



Cells are composed by a product name and a certain number, for example:



'Pasta=3'


Example:



 0 1 2 3 
0 'Pasta=3' 'Soup=2' 'Potatoes=4' None
1 'Cheese=1' 'Milk=2' None None
2 'Eggs=6' 'Cleaners=1' 'Beef=2' 'Fish=1'
3 'Apples=3' 'Banana=2' 'Pear=4' None


Now I have to remove the equality symbol and the number. So, if I have



'Pasta=3' 


I have to remove '=3' to obtain



'Pasta'


How can I do it, if the dataframe hasn't header?



Thank you.










share|improve this question






























    0















    I have a Pandas DataFrame without header and I need to edit all cells.



    Cells are composed by a product name and a certain number, for example:



    'Pasta=3'


    Example:



     0 1 2 3 
    0 'Pasta=3' 'Soup=2' 'Potatoes=4' None
    1 'Cheese=1' 'Milk=2' None None
    2 'Eggs=6' 'Cleaners=1' 'Beef=2' 'Fish=1'
    3 'Apples=3' 'Banana=2' 'Pear=4' None


    Now I have to remove the equality symbol and the number. So, if I have



    'Pasta=3' 


    I have to remove '=3' to obtain



    'Pasta'


    How can I do it, if the dataframe hasn't header?



    Thank you.










    share|improve this question


























      0












      0








      0








      I have a Pandas DataFrame without header and I need to edit all cells.



      Cells are composed by a product name and a certain number, for example:



      'Pasta=3'


      Example:



       0 1 2 3 
      0 'Pasta=3' 'Soup=2' 'Potatoes=4' None
      1 'Cheese=1' 'Milk=2' None None
      2 'Eggs=6' 'Cleaners=1' 'Beef=2' 'Fish=1'
      3 'Apples=3' 'Banana=2' 'Pear=4' None


      Now I have to remove the equality symbol and the number. So, if I have



      'Pasta=3' 


      I have to remove '=3' to obtain



      'Pasta'


      How can I do it, if the dataframe hasn't header?



      Thank you.










      share|improve this question
















      I have a Pandas DataFrame without header and I need to edit all cells.



      Cells are composed by a product name and a certain number, for example:



      'Pasta=3'


      Example:



       0 1 2 3 
      0 'Pasta=3' 'Soup=2' 'Potatoes=4' None
      1 'Cheese=1' 'Milk=2' None None
      2 'Eggs=6' 'Cleaners=1' 'Beef=2' 'Fish=1'
      3 'Apples=3' 'Banana=2' 'Pear=4' None


      Now I have to remove the equality symbol and the number. So, if I have



      'Pasta=3' 


      I have to remove '=3' to obtain



      'Pasta'


      How can I do it, if the dataframe hasn't header?



      Thank you.







      python python-3.x pandas dataframe






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 26 at 1:08







      hrakkar

















      asked Mar 26 at 0:52









      hrakkarhrakkar

      32 bronze badges




      32 bronze badges






















          1 Answer
          1






          active

          oldest

          votes


















          2














          First of all, they have a "header" (i.e. column name). In your case, it is either 0 or "0" (integer 0, or string 0). So you can still access the columns by df[0] or df["0"] depending on whether that's a integer or string.



          Second, to remove everything after the =, just use df.replace on every column by stating regex=True



          df.replace(r'=.*','', regex=True)


          You can also use apply (slower, prefer the first method)



          df.apply(lambda s: s.str.replace(r'=.*',''))





          share|improve this answer























          • It worked very well! Thank you so much :)

            – hrakkar
            Mar 26 at 10:33










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          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: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          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
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55348385%2fhow-to-edit-cells-in-a-pandas-dataframe-without-header%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














          First of all, they have a "header" (i.e. column name). In your case, it is either 0 or "0" (integer 0, or string 0). So you can still access the columns by df[0] or df["0"] depending on whether that's a integer or string.



          Second, to remove everything after the =, just use df.replace on every column by stating regex=True



          df.replace(r'=.*','', regex=True)


          You can also use apply (slower, prefer the first method)



          df.apply(lambda s: s.str.replace(r'=.*',''))





          share|improve this answer























          • It worked very well! Thank you so much :)

            – hrakkar
            Mar 26 at 10:33















          2














          First of all, they have a "header" (i.e. column name). In your case, it is either 0 or "0" (integer 0, or string 0). So you can still access the columns by df[0] or df["0"] depending on whether that's a integer or string.



          Second, to remove everything after the =, just use df.replace on every column by stating regex=True



          df.replace(r'=.*','', regex=True)


          You can also use apply (slower, prefer the first method)



          df.apply(lambda s: s.str.replace(r'=.*',''))





          share|improve this answer























          • It worked very well! Thank you so much :)

            – hrakkar
            Mar 26 at 10:33













          2












          2








          2







          First of all, they have a "header" (i.e. column name). In your case, it is either 0 or "0" (integer 0, or string 0). So you can still access the columns by df[0] or df["0"] depending on whether that's a integer or string.



          Second, to remove everything after the =, just use df.replace on every column by stating regex=True



          df.replace(r'=.*','', regex=True)


          You can also use apply (slower, prefer the first method)



          df.apply(lambda s: s.str.replace(r'=.*',''))





          share|improve this answer













          First of all, they have a "header" (i.e. column name). In your case, it is either 0 or "0" (integer 0, or string 0). So you can still access the columns by df[0] or df["0"] depending on whether that's a integer or string.



          Second, to remove everything after the =, just use df.replace on every column by stating regex=True



          df.replace(r'=.*','', regex=True)


          You can also use apply (slower, prefer the first method)



          df.apply(lambda s: s.str.replace(r'=.*',''))






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 26 at 1:17









          rafaelcrafaelc

          31.2k8 gold badges32 silver badges55 bronze badges




          31.2k8 gold badges32 silver badges55 bronze badges












          • It worked very well! Thank you so much :)

            – hrakkar
            Mar 26 at 10:33

















          • It worked very well! Thank you so much :)

            – hrakkar
            Mar 26 at 10:33
















          It worked very well! Thank you so much :)

          – hrakkar
          Mar 26 at 10:33





          It worked very well! Thank you so much :)

          – hrakkar
          Mar 26 at 10:33








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • 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.

          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%2fstackoverflow.com%2fquestions%2f55348385%2fhow-to-edit-cells-in-a-pandas-dataframe-without-header%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

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

          Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript