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 18, 2018 in Python by Shuvodip
0 votes
1 answer
0 votes
2 answers
0 votes
1 answer

I want to download a file from the website by web scraping. Can anyone explain how to do this in jupyter lab (python) with an example?

Hey, Web scraping is a technique to automatically ...READ MORE

answered Apr 7, 2020 in Python by Gitika
• 65,950 points
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, 2020 in Python by Niroj
• 82,820 points
0 votes
1 answer