I wanted to change the entire row where index is 9 how can i do that

+1 vote
Sep 16 in Python by anonymous

1 answer to this question.

0 votes

Import the file as a pandas dataframe and then you this code(Make necessary changes):

import pandas as pd

df = pd.read_csv("<path/to/file>")


answered Sep 16 by Rishi

Thanks alot. I have one more problem now i wanted to change the date time format to YYYY-MM-SS HH:MM:SS so can you please suggest some peace of code to satisfy this solution.


Try this:

import datetime

date1 = "3/05/18 12:39"
date, time = date1.split(' ')
date2 = datetime.datetime.strptime(date, '%d/%m/%y').strftime('%Y/%m/%d')
date2 = (date2+' '+time)

Related Questions In Python

0 votes
1 answer

How can I find out the index of an element from row and column in Python?

You probably want to use np.ravel_multi_index: [code] import numpy ...READ MORE

answered Apr 16, 2018 in Python by charlie_brown
• 7,720 points
0 votes
1 answer

How can I change the data type to string in Python?

You can use str(variablename) This is called conversion ...READ MORE

answered Dec 17, 2018 in Python by Shuvodip
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

How do I use urllib to see if a website is 404 or 200 in Python?

For Python 3, try doing this: import urllib.request, ...READ MORE

answered Nov 29, 2018 in Python by Nymeria
• 3,520 points

edited Dec 11, 2018 by Nymeria 829 views
0 votes
1 answer

how do i change to lowercase letters in strings?

use lower() for lowercasing.example: "ALIREZA".lower() > ...READ MORE

answered Apr 15 in Python by Alireza Bahrami
0 votes
1 answer

How can I change the iteration variable inside a for loop in python?

Assume you have a list of lists: my_list ...READ MORE

answered Jun 10 in Python by Shubham Bansal
0 votes
1 answer