Skip to content
Advertisement

Tag: pandas

Split a dataframe based on a specifc cumsum value

I have a solution working, but it seems cumbersome and I am wondering if there is a better way to achieve what I want. I need to achieve two things: Split a dataframe into two dataframes based on a specifc cumsum value. If a row needs to be split to fulfill the cumsum condition, than this must happen. An example

Filter DataFrame based on partial matching string from list

I have a dataframe with lots of categories. Here list of some of them I want to filter dataframe based on string matching. I don’t want to pass entire row name, i wanna pass something like [‘Совкомбанк’, ‘Тинькофф’]. The expecting result of this is : I tried df = df[df[column_name].isin(values)] but i didn’t work. Answer .isin will check for exact

Select plot linestyle with plotly pandas backend

I want to be able to select the linestyle with the pandas plot method with the plotly backend. Matplotlib: When I use the matplotlib backend in pandas, I can do: which allows me to select the linestyle for each column. The output is: Plotly backend: With plotly I can do How can I select the linestyle of a given line

Lambda and vectorize in python

I’m learning data analysis while performing vectorized operation with lambda function it run at first but again run it shows error as TypeError: <lambda>() takes 1 positional argument but 2 were given sample data of tips.csv file This is the image that I run first which doesn’t show any error Answer You can vectorize solution different way – with numpy.where

Advertisement