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

+1 vote

Sep 16, 2019 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, 2019 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,780 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
2 answers
0 votes
1 answer
0 votes
1 answer

How do I get the path and name of the file that is currently executing?

Hello @kartik, Since Python 3 is fairly mainstream, ...READ MORE

answered May 11 in Python by Niroj
• 58,500 points
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 5,726 views
0 votes
1 answer