Data format confusion after changing version of Python












0















I have just moved from using Python 2.7.8 to 3.4.5 In the 2.7.8 version the following line of code run without issue and now using the 3.4.5 I get the exception :



AttributeError: 'Series' object has no attribute 'dt'


The line is:



DeptTemplate['Status change date'].dt.strftime('%d/%m/%Y')


Where I am reformatting the data-frame column 'Status change date' to a date format



The only thing I have changed is the version of Python so I am assuming this is the issue.



I've tried to research the fix but am confused as to what I need to change.










share|improve this question

























  • what version of pandas are you using?

    – Chris
    Nov 19 '18 at 15:48











  • Mmm, this doesn't make sense. If anything, it's a pandas issue. What is the name of your script btw? I can't think of a pandas version where this behaviour changed, it seems there's something external causing this issue

    – roganjosh
    Nov 19 '18 at 15:48













  • Thanks. I think you might be right version of pandas I'm using with 2.7.8 is 0.19.2 and the version of pandas I'm using with 3.4.5 is 0.14.1. Is there a way to upgrade my pandas version using conda?

    – Stacey
    Nov 19 '18 at 15:56











  • @Stacey it certainly is the version of pandas...you can do conda update

    – Chris
    Nov 19 '18 at 15:58











  • how have you ended up with 0.14 version? It sounds like some dependency has trashed your installation on python 3. Thats way old! :) conda should not install that version.

    – roganjosh
    Nov 19 '18 at 16:05


















0















I have just moved from using Python 2.7.8 to 3.4.5 In the 2.7.8 version the following line of code run without issue and now using the 3.4.5 I get the exception :



AttributeError: 'Series' object has no attribute 'dt'


The line is:



DeptTemplate['Status change date'].dt.strftime('%d/%m/%Y')


Where I am reformatting the data-frame column 'Status change date' to a date format



The only thing I have changed is the version of Python so I am assuming this is the issue.



I've tried to research the fix but am confused as to what I need to change.










share|improve this question

























  • what version of pandas are you using?

    – Chris
    Nov 19 '18 at 15:48











  • Mmm, this doesn't make sense. If anything, it's a pandas issue. What is the name of your script btw? I can't think of a pandas version where this behaviour changed, it seems there's something external causing this issue

    – roganjosh
    Nov 19 '18 at 15:48













  • Thanks. I think you might be right version of pandas I'm using with 2.7.8 is 0.19.2 and the version of pandas I'm using with 3.4.5 is 0.14.1. Is there a way to upgrade my pandas version using conda?

    – Stacey
    Nov 19 '18 at 15:56











  • @Stacey it certainly is the version of pandas...you can do conda update

    – Chris
    Nov 19 '18 at 15:58











  • how have you ended up with 0.14 version? It sounds like some dependency has trashed your installation on python 3. Thats way old! :) conda should not install that version.

    – roganjosh
    Nov 19 '18 at 16:05
















0












0








0








I have just moved from using Python 2.7.8 to 3.4.5 In the 2.7.8 version the following line of code run without issue and now using the 3.4.5 I get the exception :



AttributeError: 'Series' object has no attribute 'dt'


The line is:



DeptTemplate['Status change date'].dt.strftime('%d/%m/%Y')


Where I am reformatting the data-frame column 'Status change date' to a date format



The only thing I have changed is the version of Python so I am assuming this is the issue.



I've tried to research the fix but am confused as to what I need to change.










share|improve this question
















I have just moved from using Python 2.7.8 to 3.4.5 In the 2.7.8 version the following line of code run without issue and now using the 3.4.5 I get the exception :



AttributeError: 'Series' object has no attribute 'dt'


The line is:



DeptTemplate['Status change date'].dt.strftime('%d/%m/%Y')


Where I am reformatting the data-frame column 'Status change date' to a date format



The only thing I have changed is the version of Python so I am assuming this is the issue.



I've tried to research the fix but am confused as to what I need to change.







python pandas






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 23:06









halfer

14.4k758109




14.4k758109










asked Nov 19 '18 at 15:44









StaceyStacey

1,06951939




1,06951939













  • what version of pandas are you using?

    – Chris
    Nov 19 '18 at 15:48











  • Mmm, this doesn't make sense. If anything, it's a pandas issue. What is the name of your script btw? I can't think of a pandas version where this behaviour changed, it seems there's something external causing this issue

    – roganjosh
    Nov 19 '18 at 15:48













  • Thanks. I think you might be right version of pandas I'm using with 2.7.8 is 0.19.2 and the version of pandas I'm using with 3.4.5 is 0.14.1. Is there a way to upgrade my pandas version using conda?

    – Stacey
    Nov 19 '18 at 15:56











  • @Stacey it certainly is the version of pandas...you can do conda update

    – Chris
    Nov 19 '18 at 15:58











  • how have you ended up with 0.14 version? It sounds like some dependency has trashed your installation on python 3. Thats way old! :) conda should not install that version.

    – roganjosh
    Nov 19 '18 at 16:05





















  • what version of pandas are you using?

    – Chris
    Nov 19 '18 at 15:48











  • Mmm, this doesn't make sense. If anything, it's a pandas issue. What is the name of your script btw? I can't think of a pandas version where this behaviour changed, it seems there's something external causing this issue

    – roganjosh
    Nov 19 '18 at 15:48













  • Thanks. I think you might be right version of pandas I'm using with 2.7.8 is 0.19.2 and the version of pandas I'm using with 3.4.5 is 0.14.1. Is there a way to upgrade my pandas version using conda?

    – Stacey
    Nov 19 '18 at 15:56











  • @Stacey it certainly is the version of pandas...you can do conda update

    – Chris
    Nov 19 '18 at 15:58











  • how have you ended up with 0.14 version? It sounds like some dependency has trashed your installation on python 3. Thats way old! :) conda should not install that version.

    – roganjosh
    Nov 19 '18 at 16:05



















what version of pandas are you using?

– Chris
Nov 19 '18 at 15:48





what version of pandas are you using?

– Chris
Nov 19 '18 at 15:48













Mmm, this doesn't make sense. If anything, it's a pandas issue. What is the name of your script btw? I can't think of a pandas version where this behaviour changed, it seems there's something external causing this issue

– roganjosh
Nov 19 '18 at 15:48







Mmm, this doesn't make sense. If anything, it's a pandas issue. What is the name of your script btw? I can't think of a pandas version where this behaviour changed, it seems there's something external causing this issue

– roganjosh
Nov 19 '18 at 15:48















Thanks. I think you might be right version of pandas I'm using with 2.7.8 is 0.19.2 and the version of pandas I'm using with 3.4.5 is 0.14.1. Is there a way to upgrade my pandas version using conda?

– Stacey
Nov 19 '18 at 15:56





Thanks. I think you might be right version of pandas I'm using with 2.7.8 is 0.19.2 and the version of pandas I'm using with 3.4.5 is 0.14.1. Is there a way to upgrade my pandas version using conda?

– Stacey
Nov 19 '18 at 15:56













@Stacey it certainly is the version of pandas...you can do conda update

– Chris
Nov 19 '18 at 15:58





@Stacey it certainly is the version of pandas...you can do conda update

– Chris
Nov 19 '18 at 15:58













how have you ended up with 0.14 version? It sounds like some dependency has trashed your installation on python 3. Thats way old! :) conda should not install that version.

– roganjosh
Nov 19 '18 at 16:05







how have you ended up with 0.14 version? It sounds like some dependency has trashed your installation on python 3. Thats way old! :) conda should not install that version.

– roganjosh
Nov 19 '18 at 16:05














1 Answer
1






active

oldest

votes


















0














I agree with the comments above, the version of Python shouldn't make a difference here. The dt method is only available on datetime series. So the columns 'Status change date' should already be a datetime before you use this method.



.dt.strftime does not convert a column to a datetime format. Rather it converts a datetime column to a string representation of a datetime






share|improve this answer























    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%2f53378146%2fdata-format-confusion-after-changing-version-of-python%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









    0














    I agree with the comments above, the version of Python shouldn't make a difference here. The dt method is only available on datetime series. So the columns 'Status change date' should already be a datetime before you use this method.



    .dt.strftime does not convert a column to a datetime format. Rather it converts a datetime column to a string representation of a datetime






    share|improve this answer




























      0














      I agree with the comments above, the version of Python shouldn't make a difference here. The dt method is only available on datetime series. So the columns 'Status change date' should already be a datetime before you use this method.



      .dt.strftime does not convert a column to a datetime format. Rather it converts a datetime column to a string representation of a datetime






      share|improve this answer


























        0












        0








        0







        I agree with the comments above, the version of Python shouldn't make a difference here. The dt method is only available on datetime series. So the columns 'Status change date' should already be a datetime before you use this method.



        .dt.strftime does not convert a column to a datetime format. Rather it converts a datetime column to a string representation of a datetime






        share|improve this answer













        I agree with the comments above, the version of Python shouldn't make a difference here. The dt method is only available on datetime series. So the columns 'Status change date' should already be a datetime before you use this method.



        .dt.strftime does not convert a column to a datetime format. Rather it converts a datetime column to a string representation of a datetime







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 19 '18 at 15:58









        RobertRobert

        33429




        33429






























            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%2f53378146%2fdata-format-confusion-after-changing-version-of-python%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

            Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

            ComboBox Display Member on multiple fields

            Is it possible to collect Nectar points via Trainline?