Hello, I'm working on the data frame using Pandas, but it hasn't been solved, so I'm posting a question like this.
Data frames need to be loaded and modified for each row. For example, if it's row 1, column 1 contents / column 1 contents / column 2 contents / column 1 contents / column 1, column 2, column 2 contents / column 3 contents should be changed. All the values that need to be changed can be changed to nan, but the data frame is not familiar and cannot be solved due to lack of knowledge...
I ask for your help me Thank you.
pandas dataframe python
def solution(df):
for i in range(10):
for j in range(10):
if i >= j:
df.iloc[i,j] = np.nan
return df
I think you can refer to it and modify it and use it.
For example, if you have a table like this (let's say it's a partial representation)
df = pd.DataFrame([[0.000, 0.0224, 0.0123, 0.0446], [0.0224, 0.000, 0.0145, 0.0105], [0.0123, 0.0145, 0.0000, 0.0255], [0.0446, 0.0105, 0.0255 ,0.000]] , columns = [a, b, c, d])
By writing the code df = pd.DataFrame([[nan , 0.0224, 0.0123, 0.0446], [nan, nan, 0.0145, 0.0105], [nan, nan, nan, 0.0255], [nan, nan, nan, nan]] , columns = [a, b, c, d])
I want to create a new ticket that looks like this.
© 2024 OneMinuteCode. All rights reserved.