How can I replace ; with , in an imported excel file and to delete "












4












$begingroup$


I want to import an excel .csv file and ListPlot the data.



file = Import["Desktop/PP_1039.CSV", "Data"]


But I get this data :



(*{{"0.0472;120.9091"}, {"0.0454;113.0303"}, {"0.0441;106.6667"},
{"0.0442;106.6667"}, {"0.0437;103.3333"}, {"0.0425;95.1515"},
{"0.0409;83.6364"}, {"0.0387;72.7273"}, {"0.0354;59.697"},
{"0.0317;45.7576"}, {"0.0275;34.8485"}, {"0.0234;24.8485"},
{"0.0155;12.1212"}, {"0.0115;6.6667"}, {"0.0072;2.7273"},
{"0.0031;2.1212"}} *)


So I'd like to delete the " and to replace ; with ,










share|improve this question











$endgroup$








  • 1




    $begingroup$
    StringReplace?
    $endgroup$
    – Henrik Schumacher
    Feb 1 at 9:32






  • 4




    $begingroup$
    Just be aware that ToExpression (i.e. the answer you accepted) will not handle all number formats that are allowed (and often present) in CSV files, such as 123.4e5.
    $endgroup$
    – Szabolcs
    Feb 1 at 11:50












  • $begingroup$
    You could try importing the file via ReadList[file, Expression]
    $endgroup$
    – user170231
    Feb 1 at 23:15
















4












$begingroup$


I want to import an excel .csv file and ListPlot the data.



file = Import["Desktop/PP_1039.CSV", "Data"]


But I get this data :



(*{{"0.0472;120.9091"}, {"0.0454;113.0303"}, {"0.0441;106.6667"},
{"0.0442;106.6667"}, {"0.0437;103.3333"}, {"0.0425;95.1515"},
{"0.0409;83.6364"}, {"0.0387;72.7273"}, {"0.0354;59.697"},
{"0.0317;45.7576"}, {"0.0275;34.8485"}, {"0.0234;24.8485"},
{"0.0155;12.1212"}, {"0.0115;6.6667"}, {"0.0072;2.7273"},
{"0.0031;2.1212"}} *)


So I'd like to delete the " and to replace ; with ,










share|improve this question











$endgroup$








  • 1




    $begingroup$
    StringReplace?
    $endgroup$
    – Henrik Schumacher
    Feb 1 at 9:32






  • 4




    $begingroup$
    Just be aware that ToExpression (i.e. the answer you accepted) will not handle all number formats that are allowed (and often present) in CSV files, such as 123.4e5.
    $endgroup$
    – Szabolcs
    Feb 1 at 11:50












  • $begingroup$
    You could try importing the file via ReadList[file, Expression]
    $endgroup$
    – user170231
    Feb 1 at 23:15














4












4








4


1



$begingroup$


I want to import an excel .csv file and ListPlot the data.



file = Import["Desktop/PP_1039.CSV", "Data"]


But I get this data :



(*{{"0.0472;120.9091"}, {"0.0454;113.0303"}, {"0.0441;106.6667"},
{"0.0442;106.6667"}, {"0.0437;103.3333"}, {"0.0425;95.1515"},
{"0.0409;83.6364"}, {"0.0387;72.7273"}, {"0.0354;59.697"},
{"0.0317;45.7576"}, {"0.0275;34.8485"}, {"0.0234;24.8485"},
{"0.0155;12.1212"}, {"0.0115;6.6667"}, {"0.0072;2.7273"},
{"0.0031;2.1212"}} *)


So I'd like to delete the " and to replace ; with ,










share|improve this question











$endgroup$




I want to import an excel .csv file and ListPlot the data.



file = Import["Desktop/PP_1039.CSV", "Data"]


But I get this data :



(*{{"0.0472;120.9091"}, {"0.0454;113.0303"}, {"0.0441;106.6667"},
{"0.0442;106.6667"}, {"0.0437;103.3333"}, {"0.0425;95.1515"},
{"0.0409;83.6364"}, {"0.0387;72.7273"}, {"0.0354;59.697"},
{"0.0317;45.7576"}, {"0.0275;34.8485"}, {"0.0234;24.8485"},
{"0.0155;12.1212"}, {"0.0115;6.6667"}, {"0.0072;2.7273"},
{"0.0031;2.1212"}} *)


So I'd like to delete the " and to replace ; with ,







list-manipulation import excel






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 1 at 17:30









Doryx

33




33










asked Feb 1 at 9:24









J.AJ.A

3539




3539








  • 1




    $begingroup$
    StringReplace?
    $endgroup$
    – Henrik Schumacher
    Feb 1 at 9:32






  • 4




    $begingroup$
    Just be aware that ToExpression (i.e. the answer you accepted) will not handle all number formats that are allowed (and often present) in CSV files, such as 123.4e5.
    $endgroup$
    – Szabolcs
    Feb 1 at 11:50












  • $begingroup$
    You could try importing the file via ReadList[file, Expression]
    $endgroup$
    – user170231
    Feb 1 at 23:15














  • 1




    $begingroup$
    StringReplace?
    $endgroup$
    – Henrik Schumacher
    Feb 1 at 9:32






  • 4




    $begingroup$
    Just be aware that ToExpression (i.e. the answer you accepted) will not handle all number formats that are allowed (and often present) in CSV files, such as 123.4e5.
    $endgroup$
    – Szabolcs
    Feb 1 at 11:50












  • $begingroup$
    You could try importing the file via ReadList[file, Expression]
    $endgroup$
    – user170231
    Feb 1 at 23:15








1




1




$begingroup$
StringReplace?
$endgroup$
– Henrik Schumacher
Feb 1 at 9:32




$begingroup$
StringReplace?
$endgroup$
– Henrik Schumacher
Feb 1 at 9:32




4




4




$begingroup$
Just be aware that ToExpression (i.e. the answer you accepted) will not handle all number formats that are allowed (and often present) in CSV files, such as 123.4e5.
$endgroup$
– Szabolcs
Feb 1 at 11:50






$begingroup$
Just be aware that ToExpression (i.e. the answer you accepted) will not handle all number formats that are allowed (and often present) in CSV files, such as 123.4e5.
$endgroup$
– Szabolcs
Feb 1 at 11:50














$begingroup$
You could try importing the file via ReadList[file, Expression]
$endgroup$
– user170231
Feb 1 at 23:15




$begingroup$
You could try importing the file via ReadList[file, Expression]
$endgroup$
– user170231
Feb 1 at 23:15










4 Answers
4






active

oldest

votes


















4












$begingroup$

ToExpression[StringReplace[ToString[file], ";" -> ","]]



{{0.0472, 120.9091}, {0.0454, 113.0303}, {0.0441, 106.6667}, {0.0442,
106.6667}, {0.0437, 103.3333}, {0.0425, 95.1515}, {0.0409,
83.6364}, {0.0387, 72.7273}, {0.0354, 59.697}, {0.0317,
45.7576}, {0.0275, 34.8485}, {0.0234, 24.8485}, {0.0155,
12.1212}, {0.0115, 6.6667}, {0.0072, 2.7273}, {0.0031, 2.1212}}







share|improve this answer









$endgroup$





















    11












    $begingroup$

    Import as Table instead of CSV, and set the "FieldSeparators" option.



    ImportString[
    "1;2
    3;4",
    "Table", "FieldSeparators" -> {";"}]

    (* {{1, 2}, {3, 4}} *)


    "Table" is a generalization of CSV, TSV, etc. where you can customize the delimiters and separators.






    share|improve this answer









    $endgroup$





















      4












      $begingroup$

      ToExpression[file /. {a_String} :> StringSplit[a, ";"]]





      share|improve this answer









      $endgroup$





















        0












        $begingroup$

        Method One:
        1) Caution: Make a copy of your original file and then proceed. Just in case it doesn't work. :)
        2) Select all the contents in which you need to make the changes.
        3) Use "Replace" command to replace whatever with whatever you want. (Replace " with blank space and ; with ,)
        4) That it.



        Method Two:
        1) Caution: Make a copy of your original file and then proceed. Just in case it doesn't work. :)
        2) Copy all the contents in Word. It will most probably be imported as a table.
        3) Select all the contents in which you need to make the changes.
        4) Use "Replace" command to replace whatever with whatever you want. (**Replace " with ***blank space* and ; with ,)
        5) Select all the contents from word that are in table and paste it in Excel again.






        share|improve this answer









        $endgroup$













        • $begingroup$
          In what sense is this solution related to Mathematica?
          $endgroup$
          – Henrik Schumacher
          Feb 2 at 12:42












        Your Answer





        StackExchange.ifUsing("editor", function () {
        return StackExchange.using("mathjaxEditing", function () {
        StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
        StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
        });
        });
        }, "mathjax-editing");

        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "387"
        };
        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
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f190642%2fhow-can-i-replace-with-in-an-imported-excel-file-and-to-delete%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        4 Answers
        4






        active

        oldest

        votes








        4 Answers
        4






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes









        4












        $begingroup$

        ToExpression[StringReplace[ToString[file], ";" -> ","]]



        {{0.0472, 120.9091}, {0.0454, 113.0303}, {0.0441, 106.6667}, {0.0442,
        106.6667}, {0.0437, 103.3333}, {0.0425, 95.1515}, {0.0409,
        83.6364}, {0.0387, 72.7273}, {0.0354, 59.697}, {0.0317,
        45.7576}, {0.0275, 34.8485}, {0.0234, 24.8485}, {0.0155,
        12.1212}, {0.0115, 6.6667}, {0.0072, 2.7273}, {0.0031, 2.1212}}







        share|improve this answer









        $endgroup$


















          4












          $begingroup$

          ToExpression[StringReplace[ToString[file], ";" -> ","]]



          {{0.0472, 120.9091}, {0.0454, 113.0303}, {0.0441, 106.6667}, {0.0442,
          106.6667}, {0.0437, 103.3333}, {0.0425, 95.1515}, {0.0409,
          83.6364}, {0.0387, 72.7273}, {0.0354, 59.697}, {0.0317,
          45.7576}, {0.0275, 34.8485}, {0.0234, 24.8485}, {0.0155,
          12.1212}, {0.0115, 6.6667}, {0.0072, 2.7273}, {0.0031, 2.1212}}







          share|improve this answer









          $endgroup$
















            4












            4








            4





            $begingroup$

            ToExpression[StringReplace[ToString[file], ";" -> ","]]



            {{0.0472, 120.9091}, {0.0454, 113.0303}, {0.0441, 106.6667}, {0.0442,
            106.6667}, {0.0437, 103.3333}, {0.0425, 95.1515}, {0.0409,
            83.6364}, {0.0387, 72.7273}, {0.0354, 59.697}, {0.0317,
            45.7576}, {0.0275, 34.8485}, {0.0234, 24.8485}, {0.0155,
            12.1212}, {0.0115, 6.6667}, {0.0072, 2.7273}, {0.0031, 2.1212}}







            share|improve this answer









            $endgroup$



            ToExpression[StringReplace[ToString[file], ";" -> ","]]



            {{0.0472, 120.9091}, {0.0454, 113.0303}, {0.0441, 106.6667}, {0.0442,
            106.6667}, {0.0437, 103.3333}, {0.0425, 95.1515}, {0.0409,
            83.6364}, {0.0387, 72.7273}, {0.0354, 59.697}, {0.0317,
            45.7576}, {0.0275, 34.8485}, {0.0234, 24.8485}, {0.0155,
            12.1212}, {0.0115, 6.6667}, {0.0072, 2.7273}, {0.0031, 2.1212}}








            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Feb 1 at 9:31









            MeMyselfIMeMyselfI

            609211




            609211























                11












                $begingroup$

                Import as Table instead of CSV, and set the "FieldSeparators" option.



                ImportString[
                "1;2
                3;4",
                "Table", "FieldSeparators" -> {";"}]

                (* {{1, 2}, {3, 4}} *)


                "Table" is a generalization of CSV, TSV, etc. where you can customize the delimiters and separators.






                share|improve this answer









                $endgroup$


















                  11












                  $begingroup$

                  Import as Table instead of CSV, and set the "FieldSeparators" option.



                  ImportString[
                  "1;2
                  3;4",
                  "Table", "FieldSeparators" -> {";"}]

                  (* {{1, 2}, {3, 4}} *)


                  "Table" is a generalization of CSV, TSV, etc. where you can customize the delimiters and separators.






                  share|improve this answer









                  $endgroup$
















                    11












                    11








                    11





                    $begingroup$

                    Import as Table instead of CSV, and set the "FieldSeparators" option.



                    ImportString[
                    "1;2
                    3;4",
                    "Table", "FieldSeparators" -> {";"}]

                    (* {{1, 2}, {3, 4}} *)


                    "Table" is a generalization of CSV, TSV, etc. where you can customize the delimiters and separators.






                    share|improve this answer









                    $endgroup$



                    Import as Table instead of CSV, and set the "FieldSeparators" option.



                    ImportString[
                    "1;2
                    3;4",
                    "Table", "FieldSeparators" -> {";"}]

                    (* {{1, 2}, {3, 4}} *)


                    "Table" is a generalization of CSV, TSV, etc. where you can customize the delimiters and separators.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Feb 1 at 9:33









                    SzabolcsSzabolcs

                    163k14448946




                    163k14448946























                        4












                        $begingroup$

                        ToExpression[file /. {a_String} :> StringSplit[a, ";"]]





                        share|improve this answer









                        $endgroup$


















                          4












                          $begingroup$

                          ToExpression[file /. {a_String} :> StringSplit[a, ";"]]





                          share|improve this answer









                          $endgroup$
















                            4












                            4








                            4





                            $begingroup$

                            ToExpression[file /. {a_String} :> StringSplit[a, ";"]]





                            share|improve this answer









                            $endgroup$



                            ToExpression[file /. {a_String} :> StringSplit[a, ";"]]






                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Feb 1 at 9:33









                            Chris DegnenChris Degnen

                            22.1k23787




                            22.1k23787























                                0












                                $begingroup$

                                Method One:
                                1) Caution: Make a copy of your original file and then proceed. Just in case it doesn't work. :)
                                2) Select all the contents in which you need to make the changes.
                                3) Use "Replace" command to replace whatever with whatever you want. (Replace " with blank space and ; with ,)
                                4) That it.



                                Method Two:
                                1) Caution: Make a copy of your original file and then proceed. Just in case it doesn't work. :)
                                2) Copy all the contents in Word. It will most probably be imported as a table.
                                3) Select all the contents in which you need to make the changes.
                                4) Use "Replace" command to replace whatever with whatever you want. (**Replace " with ***blank space* and ; with ,)
                                5) Select all the contents from word that are in table and paste it in Excel again.






                                share|improve this answer









                                $endgroup$













                                • $begingroup$
                                  In what sense is this solution related to Mathematica?
                                  $endgroup$
                                  – Henrik Schumacher
                                  Feb 2 at 12:42
















                                0












                                $begingroup$

                                Method One:
                                1) Caution: Make a copy of your original file and then proceed. Just in case it doesn't work. :)
                                2) Select all the contents in which you need to make the changes.
                                3) Use "Replace" command to replace whatever with whatever you want. (Replace " with blank space and ; with ,)
                                4) That it.



                                Method Two:
                                1) Caution: Make a copy of your original file and then proceed. Just in case it doesn't work. :)
                                2) Copy all the contents in Word. It will most probably be imported as a table.
                                3) Select all the contents in which you need to make the changes.
                                4) Use "Replace" command to replace whatever with whatever you want. (**Replace " with ***blank space* and ; with ,)
                                5) Select all the contents from word that are in table and paste it in Excel again.






                                share|improve this answer









                                $endgroup$













                                • $begingroup$
                                  In what sense is this solution related to Mathematica?
                                  $endgroup$
                                  – Henrik Schumacher
                                  Feb 2 at 12:42














                                0












                                0








                                0





                                $begingroup$

                                Method One:
                                1) Caution: Make a copy of your original file and then proceed. Just in case it doesn't work. :)
                                2) Select all the contents in which you need to make the changes.
                                3) Use "Replace" command to replace whatever with whatever you want. (Replace " with blank space and ; with ,)
                                4) That it.



                                Method Two:
                                1) Caution: Make a copy of your original file and then proceed. Just in case it doesn't work. :)
                                2) Copy all the contents in Word. It will most probably be imported as a table.
                                3) Select all the contents in which you need to make the changes.
                                4) Use "Replace" command to replace whatever with whatever you want. (**Replace " with ***blank space* and ; with ,)
                                5) Select all the contents from word that are in table and paste it in Excel again.






                                share|improve this answer









                                $endgroup$



                                Method One:
                                1) Caution: Make a copy of your original file and then proceed. Just in case it doesn't work. :)
                                2) Select all the contents in which you need to make the changes.
                                3) Use "Replace" command to replace whatever with whatever you want. (Replace " with blank space and ; with ,)
                                4) That it.



                                Method Two:
                                1) Caution: Make a copy of your original file and then proceed. Just in case it doesn't work. :)
                                2) Copy all the contents in Word. It will most probably be imported as a table.
                                3) Select all the contents in which you need to make the changes.
                                4) Use "Replace" command to replace whatever with whatever you want. (**Replace " with ***blank space* and ; with ,)
                                5) Select all the contents from word that are in table and paste it in Excel again.







                                share|improve this answer












                                share|improve this answer



                                share|improve this answer










                                answered Feb 2 at 2:21









                                DevilDevil

                                91




                                91












                                • $begingroup$
                                  In what sense is this solution related to Mathematica?
                                  $endgroup$
                                  – Henrik Schumacher
                                  Feb 2 at 12:42


















                                • $begingroup$
                                  In what sense is this solution related to Mathematica?
                                  $endgroup$
                                  – Henrik Schumacher
                                  Feb 2 at 12:42
















                                $begingroup$
                                In what sense is this solution related to Mathematica?
                                $endgroup$
                                – Henrik Schumacher
                                Feb 2 at 12:42




                                $begingroup$
                                In what sense is this solution related to Mathematica?
                                $endgroup$
                                – Henrik Schumacher
                                Feb 2 at 12:42


















                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to Mathematica 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%2fmathematica.stackexchange.com%2fquestions%2f190642%2fhow-can-i-replace-with-in-an-imported-excel-file-and-to-delete%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

                                MongoDB - Not Authorized To Execute Command

                                in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

                                Npm cannot find a required file even through it is in the searched directory