Time:09-17
CodePudding user response:
o codeThank you very much!!!!!!!!!!
The import pandas as pd The import numpy as np Df=pd DataFrame ([[' AA ', 1, 2, 3], [' BB ', 1, 2, 3], [' CC ', 1, 2, 3], [' DD ', 1, 2, 3]], the columns=[' name ', 'age', 'class', 'type']) # df=pd read_csv (' XXX. CSV, the header=None) Df
Df=df set_index ([' name ']) Df
Df. Loc [' BB '] Results: The age of 1 Class 2 Type 3 Name: BB, dtype: int64
Df. Loc [' BB '] [' age '] Results: 1
The import pandas as pd # import numpy as np Df=pd DataFrame ([[' AA ', 1, 2, 3], [' BB ', 1, 2, 3], [' CC ', 1, 2, 3], [' DD ', 1, 2, 3]], the columns=[' name ', 'age', 'class', 'type']) Print (df) Print (df [' class '] [df [' name ']=='BB']. Values [0]) Print (df. Loc [df [' name ']=='BB', 'class']. Values [0]) Print (df. Loc [df [' name ']=='BB'] [' class '] values [0])
I this file path is: C: \ users \ \ administrator \ desktop \ 4. XLSX Want to send this file F column and column H three points written in another file File: c: \ users \ \ administrator \ desktop \ as XLSX first working table,
Page link:https//www.codepudding.com/other/5975.html