Skip to content

Tag: pandas

How to store CSV file in database?

There is a output file from Python Pandas with a lot of columns with headers. I need to be able handle this file by script and get CSV files in different columns positions. For example, initial file has columns As variation I need to get it in different sequence: I wonder what is the best way to store this fi…

Exponential fit in pandas

I have this data: The data seems to follow an exponential curve. Let’s see the plot: I want to fit an exponential curve ($$ y = Ae^{Bx} $$, A times e to the B*X)and add it as a column in Pandas. Firstly I tried to log the values: And then to use Numpy to fit the equation: But I get

Identify the columns which contain zero and output its location

Suppose I have a dataframe where some columns contain a zero value as one of their elements (or potentially more than one zero). I don’t specifically want to retrieve these columns or discard them (I know how to do that) – I just want to locate these. For instance: if there is are zeros somewhere …

problem with pd.wide_to_long specifications

I have a dataframe that looks like the following: id xx_04-Feb-94 yyy_04-Feb-94 z_04-Feb-94 xx_22-Mar-94 yyy_22-Mar-94 z_22-Mar-94 123 456 789 with values inside the table filled out. I would like to pivot the data from wide to long. the desired output looks as follows: id date xx yyy z 123 04-Feb-94 123 22-M…