Skip to content

Tag: pandas

Spitting a column based on a delimiter

I would like to extract some information from a column in my dataframe: Example I was using str.contain to extract the first part (i.e., all the information before the first dash, where there is. I am still getting the same original column (so no extraction). My output would consist in two columns, one withou…

Multiple dates in a pandas column

I am trying to make the dates in a Pandas DataFrame all of the same format. Currently I have the DataFrame storing the dates in two formats. “6/08/2017 2:15:00 AM” & 2016-01-01T00:05:00 The column name which these dates are stored under is INTERVAL_END. As you can see, one of the dates is a st…

Multiple XML files in directory Python

I am fairly new to Python and this community has been a great help! I am learning a lot. I’m trying to use this existing code to loop through multiple XML files in the same directory. Currently, the code is looking at one specific file. Any help is greatly appreciated! Answer This should help you…

Converting a dataframe with a line separator

I make a function that accepts a dataframe as input: And returns a dataframe, where a certain delimiter number (in the example, it is 6) is the passed parameter: Here’s what I got: How can I simplify the function and make it more versatile? How do I make the function faster? Thanks. Answer You can do th…