I try to search for this problem many places and couldn’t find the right tools. I have a simple time series data, For any sequence of data that is = 1 and span over (for example 1000 time instances). I want to mark those as anomalies (true). Else they should be ignore (as false). How do I achieve this w…
Tag: pandas
Comparing two sequence columns, and base on a condition add element to Dataframe
Hello, I’m looking for a script in Python that can help me with the following problem: Having the following two columns, I need to create gaps between the sequences in order to make them match: Input Output Index column A column B column A column B 0 1 1 1 1 1 2 2 2 2 2 2 2 2
Error in implementing autokeras timeseries model
I was trying to implement autokeras TimeSeriesForecaster on a serial dataset. The features and label of the dataset are respectively given below. df1_x = AutoML preparation The dataframe has no NaN values, the shape of the features dataframe is (7111, 8) i.e. a 2D dataframe. But the error came as following: A…
Pandas groupby and count across multiple columns
I have data ordered by ID, Year, and then a series of event flags indicating whether a thing did or did not happen for that ID in that year: ID Year x y z 1 2015 0 1 0 1 2016 1 1 0 1 2017 0 1 1 2 2015 1 0 1 2 2016 1 1 0 2
Expand Pandas Dataframes adding rows by different ranges
I have a dataframe like this: SEG FAM GAMA MIN_RAT MAX_RAT VALOR PE 001 002 1 2 5,15 PE 001 002 2,1 3 2,55 And I need to “expand” the df adding new rows to make a new dataframe like this: SEG FAM GAMA MIN_RAT MAX_RAT VALOR PE 001 002 1 1 10,30 PE 001 002 1,1 1,1 9,79 PE
LOC search string with AND condition in Python
I’m trying to use LOC with an AND condition. It works fine with OR conditions, but I can’t get it to work with ANDs when there are duplicate values in a column. This table with no duplicates works as expected: But when you create a data frame with two “granny” entries the double replac…
How to ignore NAN turning to String when using df.applymap(str)
I have to turn all the items in dataframe into string and i have tried as below, but it turns nan to string. How can i avoid nan to string here? i tried as below, but not working. Edit i tried df.applymap(str) but some reason i am getting boolean value of NA is ambiguous with my dataframe so i am
Having some problem to understand the x_bin in regplot of Seaborn
I used the seaborn.regplot to plot data, but not quite understand how the error bar in regplot was calculated. I have compared the results with the mean and standard deviation derived from mannual calculation. Here is my testing script. You can see the y and e from the two ways are different. I understand tha…
Apply function to every cell in DataFrame and include value from specific column
Say I have a pandas DataFrame like so: I would like to perform an operation on each cell in columns ‘a’ and ‘b’ that includes both the cell value and the value of the ‘add’ column for that row. Here’s an example operation: I know I can do this with df.apply, but I hav…
Trouble using index on a list
I am trying to scrape odds from multiple sites but obviously, some sites use different names for different teams. To still be able to handle my data efficiently I want to change my scraped data (team names in this case). I have an excel file with all the team names per site for the premier league and one colu…