fillna Questions
16
Solved
I have a Pandas Dataframe as below:
itm Date Amount
67 420 2012-09-30 00:00:00 65211
68 421 2012-09-09 00:00:00 29424
69 421 2012-09-16 00:00:00 29877
70 421 2012-09-23 00:00:00 30990
71 421 2012...
13
This should be straightforward, but the closest thing I've found is this post:
pandas: Filling missing values within a group, and I still can't solve my problem....
Suppose I have the following dat...
Staple asked 13/11, 2013 at 22:43
2
I want to fill in the missing values of two columns with the mean method. I type of the two columns is float64.
df['col1'].dtypes
dtype('float64')
df['col2'].dtypes
dtype('float64')
I used two met...
Filings asked 17/7, 2023 at 15:30
8
Solved
I have a data set in which there is a column known as 'Native Country' which contain around 30000 records. Some are missing represented by NaN so I thought to fill it with mode() value. I wrote som...
7
Solved
I am working with this Pandas DataFrame in Python.
File heat Farheit Temp_Rating
1 YesQ 75 N/A
1 NoR 115 N/A
1 YesA 63 N/A
1 NoT 83 41
1 NoY 100 80
1 YesZ 56 12
2 YesQ 111 N/A
2 NoR 60 N/A...
7
Solved
I would like to fill missing values in one column with values from another column, using fillna method.
(I read that looping through each row would be very bad practice and that it would be bette...
1
Solved
I have two data frames: main and auxiliary. I am concatenating auxiliary to the main. It results in NaN in a few rows and I want to fill them, not all.
Code:
df1 = pd.DataFrame({'Main':[00,10,20,30...
6
Solved
I cannot find a pandas function (which I had seen before) to substitute the NaN's in a dataframe with values from another dataframe (assuming a common index which can be specified). Any help?
1
Solved
I have csv file like the below table:
depth
x1
x2
x3
depth
x1
x2
x3
1000
Nan
Nan
Nan
1001
Nan
Nan
Nan
1002
Nan
Nan
Nan
1003
Nan
10
Nan
1004
Nan
Nan
Nan
1005
Nan
Nan
10
1006
Na...
Disinherit asked 1/1, 2022 at 10:9
1
Solved
I have 3 columns in the dataframe. object, id and price. I want fill
the blanks by reading the id column and discover which price should I
use. For exemple: If the id ends in (A,B or C) the price ...
4
Solved
Discription: both features are in categorical dtypes. and i used this code in a different kernal of same
dateset was working fine, the only difference is the features are in flote64. later i have ...
0
I found this behavior of resample to be confusing after working on a related question. Here are some time series data at 5 minute intervals but with missing rows (code to construct at end):
user v...
Giagiacamo asked 2/12, 2020 at 20:59
2
Solved
I'd like to fillna with the mean number for the column but only for representatives of the same category as the missing value
data = {'Class': ['Superlight', 'Aero', 'Aero', 'Superlight', 'Superlig...
2
Solved
I have two dataframes like this:
import pandas as pd
import numpy as np
df1 = pd.DataFrame({
'key1': list('ABAACCA'),
'key2': list('1675987'),
'prop1': list('xyzuynb'),
'prop2': list('mnbbbas...
Grassgreen asked 8/7, 2020 at 7:51
4
Solved
Given a pd.Series, I would like to replace null values with a list. That is, given:
import numpy as np
import pandas as pd
ser = pd.Series([0,1,np.nan])
I want a function that would return
0 0...
Rockie asked 13/11, 2017 at 15:4
1
Let me break this problem down to a smaller chunk. I have a DataFrame in PySpark, where I have a column arrival_date in date format -
from pyspark.sql.functions import to_date
values = [('22.05.201...
Strafe asked 14/1, 2019 at 11:22
3
I am trying to replace the nan values in a dataframe column 'Functional' using fillna() function. The issues I am facing are below:
I am able to detect the null values using the isnull()
dfcomp[d...
1
Solved
I have dataframe as such:
df = pd.DataFrame({'val': [np.nan,np.nan,np.nan,np.nan, 15, 1, 5, 2,np.nan, np.nan, np.nan, np.nan,np.nan,np.nan,2,23,5,12, np.nan np.nan, 3,4,5]})
df['name'] = ['a']*8 +...
2
Solved
Given that I have a pandas Series, I want to fill the NaNs with zero if either all the values are NaN or if all the values are either zero or NaN.
For example, I would want to fill the NaNs in the...
Peccavi asked 23/4, 2018 at 5:14
2
Solved
I have a dataframe:
>>> k
Out[87]:
Date S E cp Last Q code
30 2017-11-10 22500 2017-11-17 P 170.00 828.47 11/17/2017P22500
32 2017-11-10 22625 2017-11-17 P 180.00 646.91 11/17/2017P2262...
3
Solved
I have a column with na values that I want to fill according to values from another data frame according to a key. I was wondering if there is any simple way to do so.
Example:
I have a data frame...
1
Solved
I have a dataframe problem_data which has NaN values in some cells. I ran the following code.
problem_data[problem_data['level_type'] == 5.0]
It resulted to this :
problem_id level_type point...
1
Solved
Assume I have a pandas series with several consecutive NaNs. I know fillna has several methods to fill missing values (backfill and fill forward), but I want to fill them with the closest non NaN v...
Diacetylmorphine asked 27/6, 2017 at 14:27
1
© 2022 - 2025 — McMap. All rights reserved.