OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Pandas: In data frame column how to change date time format from '2022-10-11 15:15:00+05:30' to '11-10-2022 15:15'(DD-MM-YYYY HH:MI) [duplicate]

  • Thread starter Thread starter Wick
  • Start date Start date
W

Wick

Guest
  • I have a CSV file containing column called datetime with values like 2022-10-11 15:15:00+05:30 in 15 minutes interval.
  • File has 40k rows and I want to remove +05:30 from all datetime column values.
  • I have to change all values date format from 2022-10-11 15:15:00+05:30 to 11-10-2022 15:15(DD-MM-YYYY HH:MI).

Can anyone help me in changing all 40k rows date format using Pandas

1.Original CSV file

datetime
2015-02-02 09:15:00+05:30
2015-02-02 09:30:00+05:30
2015-02-02 09:45:00+05:30
2015-02-02 10:00:00+05:30
  1. Final output to generate
datetime
09-01-2015 09:15
09-01-2015 09:30
09-01-2015 09:45
09-01-2015 10:00
<ul>
<li>I have a CSV file containing column called datetime with values like <strong>2022-10-11 15:15:00+05:30</strong> in 15 minutes interval.</li>
<li>File has 40k rows and I want to remove <strong>+05:30</strong> from all datetime column values.</li>
<li>I have to change all values date format from <strong>2022-10-11 15:15:00+05:30</strong> to <strong>11-10-2022 15:15(DD-MM-YYYY HH:MI)</strong>.</li>
</ul>
<p>Can anyone help me in changing all 40k rows date format using Pandas</p>
<p>1.Original CSV file</p>
<div class="s-table-container"><table class="s-table">
<thead>
<tr>
<th>datetime</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>2015-02-02 09:15:00+05:30</code></td>
</tr>
<tr>
<td><code>2015-02-02 09:30:00+05:30</code></td>
</tr>
<tr>
<td><code>2015-02-02 09:45:00+05:30</code></td>
</tr>
<tr>
<td><code>2015-02-02 10:00:00+05:30</code></td>
</tr>
</tbody>
</table></div>
<ol start="2">
<li>Final output to generate</li>
</ol>
<div class="s-table-container"><table class="s-table">
<thead>
<tr>
<th>datetime</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>09-01-2015 09:15</code></td>
</tr>
<tr>
<td><code>09-01-2015 09:30</code></td>
</tr>
<tr>
<td><code>09-01-2015 09:45</code></td>
</tr>
<tr>
<td><code>09-01-2015 10:00</code></td>
</tr>
</tbody>
</table></div>
 

Latest posts

Online statistics

Members online
0
Guests online
2
Total visitors
2
Ads by Eonads
Top