Category "pandas"

How to change the parameter dynamically in pd.DateOffset in python code?

date_ranges_values = request.POST['range'] ft = [df.index[-1] + DateOffset(date_ranges_values = lambda x:x) for x in range(0, 24))] Suppose I get value in

T-Test in Python for multiple group comparisons

I would like to conduct a simple t-test in python, but I would like to compare all possible groups to each other. Let's say I have the following data: import p

Percentage difference between any two columns of pandas dataframe

I would like to have a function defined for percentage diff calculation between any two pandas columns. Lets say that my dataframe is defined by: R1 R2 R3

Create Python DataFrame from dictionary where keys are the column names and values form the row

I am familiar with python but new to panda DataFrames. I have a dictionary like this: a={'b':100,'c':300} And I would like to convert it to a DataFrame, wher

Create Python DataFrame from dictionary where keys are the column names and values form the row

I am familiar with python but new to panda DataFrames. I have a dictionary like this: a={'b':100,'c':300} And I would like to convert it to a DataFrame, wher

python, sort descending dataframe with pandas

I'm trying to sort a dataframe by descending. I put 'False' in the ascending argument, but my order is still ascending. My code is: from pandas import DataFra

Getting error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 3131: invalid start byte [duplicate]

I am writing a command to join files on macbook M1 using Jupyter notebook, but I have a problem when joining CVS files in the following comman

Connecting means in seaborn box plot

I want to connect box plot means. I can do the basic part but cannot connect box plot means and box plots offset from x axis. similar post but not connecting me

how to fill a Pandas dataframe column with a list containing string values

I have a dataframe with 142 rows. I have created a new column. I want to fill this new column with a list containing strings. my_list = ['abc','def','hig'] df[

Does Pandas, SciPy, or NumPy provide a cumulative standard deviation function?

I have a Pandas series. I need to get sigma_i, which is the standard deviation of a series up to index i. Is there an existing function which efficiently calcul

Dash datatable with expandable/collapsable rows

Similar to qtTree, I would like to have a drill down on a column of a datatable. I guess this is better illustrated with an example. Assume we have a dataframe

pandas combine two columns with null values

I have a df with two columns and I want to combine both columns ignoring the NaN values. The catch is that sometimes both columns have NaN values in which case

Set MultiIndex of an existing DataFrame in pandas

I have a DataFrame that looks like Emp1 Empl2 date Company 0 0 0 2012-05-01 apple 1 0 1 2012-05-29

Pandas - split large excel file

I have an excel file with about 500,000 rows and I want to split it to several excel file, each with 50,000 rows. I want to do it with pandas so it will be the

Pandas/Excel: Any way to encode the ALT-ENTER / CHAR(10) line break into data when calling DataFrame.to_excel()?

I have a pandas DataFrame that I would like to write to Excel. For one column, I have data values that are comma-delimited strings, like "val1,val2" or "val1,va

Pandas: filter dataframe with type of data

I have dataframe. It's a part member_id event_duration domain category 0 299819 17 element.yandex.ru

How to write DataFrame to postgres table

There is DataFrame.to_sql method, but it works only for mysql, sqlite and oracle databases. I cant pass to this method postgres connection or sqlalchemy engine.

pandas: multiple conditions while indexing data frame - unexpected behavior

I am filtering rows in a dataframe by values in two columns. For some reason the OR operator behaves like I would expect AND operator to behave and vice versa.

How can I reshape a Pandas DataFrame to show if certain values in a column are present by day?

I'm writing a script to query a database and return a DataFrame, df, that looks like this: cost data_source process_date revenue 0 0.796895

read Stata File .dta version 69 in python

When using pandas.io.stata.read_stata or pandas.read_stata I receive: ValueError: Version of given Stata file is 69. pandas supports importing versions 105, 108