Category "pandas"

Panda dataframe replace() method for row numbers

I need to replace some values in a column with a specific value using the row numbers list of the required values as an array like following array.Can I use dat

dataframe to save csv: not accumulating the records only saving the last dataframe group records

dataframe question in web scraping data group example:the first loop-eg:5 records, second loop-eg:3 records when I did my below code, the csv file was saved the

How to concatenate the values of a dataframe along column axis and fill missing values?

I really stuck in this problem for a long time. I have a data frame, I want to group the data based on the ids and then stick the values for each id together. H

How to deal with SettingWithCopyWarning in Pandas

Background I just upgraded my Pandas from 0.11 to 0.13.0rc1. Now, the application is popping out many new warnings. One of them like this: E:\FinReporter\FM_EXT

Round to 2 Decimal Places Even with Zeros

I am currently using the following logic to round to round to 2 decimal places: billables_all["Parts Charged"] = billables_all["Parts Charged"].fillna(0).round(

Round to 2 Decimal Places Even with Zeros

I am currently using the following logic to round to round to 2 decimal places: billables_all["Parts Charged"] = billables_all["Parts Charged"].fillna(0).round(

Save multiple dataframes to the same file, one after the other

Lets say I have three dfs x,y,z 0,1,1,1 1,2,2,2 2,3,3,3 a,b,c 0,4,4,4 1,5,5,5 2,6,6,6 d,e,f 0,7,7,7 1,8,8,8 2,9,9,9 How can I stick them all together so that

How can fit a keras model with a dataframe of numpy arrays?

I want to train a model with self-generated matrices (word vectors). My data have the following datatypes: print(type(X)) print(type(X[0])) print(type(X[0][0]))

Generating a Non Linear equation in Python like an excel output

I have some sample data below: Freemium: 0.5, 0.3333 , 0.1666, 0.0466, 0.0466, 0.1, 0.1666, 0.3333, 0.5 Minutes:0, 60, 120 ,180 ,240 ,300 ,360 ,420, 480 I want

Scipy linprog constraints not satisfied

I’ve defined a linear programming model using scipy linprog however the equality constraints when I calculate them manually do not satisfy the constraint.

Need pandas groupby.count() or groupby.size.unstack() to output a dataframe I can use

So I need to count the number of occurrences of a value per year, per animal. I've managed to do it but it's outputting a single column kind of dataframe rather

Entire Pandas Column Read in as NAN from read_csv()

I'm having trouble reading in my CSV file with Pandas. It's reading in a stock dataset which contains the Date and OHLCV columns, but for some reason, it's read

How to unmelt a completely melted table

I have this dataframe df which I have melted and then using pd.pivot_table I am able to get the table structure back at least looking at the rows it seems so -

How to create a comparison plot from an Excel file with many worksheets

I want to create a plot that will have in the x axis the months and for each country it will show the Orders per month. Attempting to create a function that rea

Python: Compare values of two fields with multiple strings and add all unique values to a 3rd field

I am still a Python-Rookie and are stuck with an idea. I want to compare the values of Type1 with Type2 and add all unique values to a 3rd field. My demo data:

Replacing a value in a column with a value from the same column based upon information

I am looking for a way to do Missing value imputation. There is a table of entries over a given time, with an entry per hour done on days. There is a seperate

Calculate Mean Absolute Error for each row of a Pandas dataframe

Below is a sample of pandas dataframe that I'm working with. I want to calculate mean absolute error for each row but only considering relevant columns for valu

`pandas.to_latex` - how to make column names bold

When I'm using the pandas.to_latex function to create latex table, the column names are unfortunately not bold. What can I do to make it bold?

Failing to remove all $ in strings in a dataframe

I'm trying to remove unnecessary values in the strings in my dataframe so I can make them integers and do some math logic on them. The commas, and upward arrows

Export multiple .csv files into .txt files in one go

I have multiple .csv files with different names like ATUL.csv, ISEC.csv, XYZ.csv and so on... Every file has similar data format mentioned below: datetime