Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Help with Python

Options
  • 03-01-2023 12:51pm
    #1
    Hosted Moderators Posts: 23,089 ✭✭✭✭


    I need a bit of help with Python. I picked a relatively small data set to do a CA on. Got it onto colab ok, but I can't seem to do anything with it. Need to tweak it, remove a column or two. All I've managed to do it put in header names.

    Anyone able to help me?



Comments

  • Registered Users Posts: 2 Bateteh2


    In Python, you can use the pandas library to manipulate and analyze your data. Here are a few examples of common operations you can perform on a DataFrame:

    • Removing a column: To remove a specific column from your DataFrame, you can use the drop() function. Here's an example of how to remove a column called 'column_name':
    df = df.drop('column_name', axis=1)
    
    • Renaming columns: To rename a column, you can use the rename() function. Here's an example of how to rename a column called 'old_name' to 'new_name':
    df = df.rename(columns={'old_name':'new_name'})
    

    These are just a few examples of the many operations you can perform on a DataFrame using pandas. You can find more information on the pandas documentation website.

    It's important to note that these examples are assuming that you have loaded your data into a DataFrame called df, if you have loaded it into another variable you should replace df with that variable.



  • Registered Users Posts: 12,382 ✭✭✭✭Calahonda52


    Have just started with Python, using jupiter notebook within the anaconda set up

    keep getting this error [*] when I hit run

    Thanks as always

    “I can’t pay my staff or mortgage with instagram likes”.



  • Administrators, Computer Games Moderators, Sports Moderators Posts: 32,238 Admin ✭✭✭✭✭Mickeroo


    I think that means 'busy', so either it's just taking a while to do something or something is blocking it from proceeding. Sorry, I'm not an expert by any means.



  • Moderators, Computer Games Moderators, Social & Fun Moderators Posts: 80,273 Mod ✭✭✭✭Sephiroth_dude




Advertisement