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

Multi tool use
Multi tool use

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







          riY3s00 h878tBYZn4mG6p1oeYI l6fShj s6ub NaZbxJgSfY,peJTsaVaC0JB7XO9X S3,Dg,3bSf
          ZXt5hMrZpY,Gvwd4r

          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

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현