Skip to content
Advertisement

Tag: pandas

How to select rows in Pandas dataframe where value appears more than once

Let’s say I have the Pandas dataframe with columns of different measurement attributes and corresponding measurement values. How can I filter this dataframe to only have measurements that appear more than X number of times? For example, for this dataframe I want to get all rows with more than 5 measurements (lets say only parameters ‘A’ and ‘B’ appear more

Convert pandas DataFrame to list of JSON-strings

I need to know how to implement to_json_string_list() function in that case: to get output like: {“rec1” : “val1”, “rec2” : “val4”} {“rec1” : “val3”, “rec2” : “val4”} I know that there are function to_json(orient=’records’), but it is not that I need, because I get: [{“rec1” : “val1”, “rec2” : “val4”}, {“rec1” : “val3”, “rec2” : “val4”}] Printing is not

python pandas merge multiple csv files

I have around 600 csv file datasets, all have the very same column names [‘DateTime’, ‘Actual’, ‘Consensus’, ‘Previous’, ‘Revised’], all economic indicators and all-time series data sets. the aim is to merge them all together in one csv file. With ‘DateTime’ as an index. The way I wanted this file to indexed in is the time line way which means

Sort a pandas dataframe series by month name

I have a Series object that has: Problem statement: I want to make it appear by month and compute the mean price for each month and present it with a sorted manner by month. Desired Output: I thought of making a list and passing it in a sort function: but the sort_values doesn’t support that for series. One big problem

Pandas finding local max and min

I have a pandas data frame with two columns one is temperature the other is time. I would like to make third and fourth columns called min and max. Each of these columns would be filled with nan’s except where there is a local min or max, then it would have the value of that extrema. Here is a sample

Advertisement