[英]How to extract row of elements from a string that has the structure of a table/dataframe in python
[英]How to extract numeric elements from an entire row in a dataframe, using python
你能給出數據幀的csv文件以及你想提取哪些數字嗎?
這是類似數據框的一種方法
#code to extract no. from a dataframe
from numpy.core.arrayprint import printoptions
import pandas as pd
import numpy as np
dict={'0':['almarai investors according to investor type loss','almarai investors according to investor type loss',
'savola group','hh prince','governmenatla','other'],
'1':['31 dec2020','percent','34.5%','23.7%','56.5%','9.1%'],'2':[np.nan,np.nan,1,1,5,4125],
'font':['Normal','Normal','Normal','Normal','Normal','Normal']}
df= pd.DataFrame(dict)
df_numerics=df.select_dtypes(include=np.number)
print(df_numerics)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.