import pandas as pd
def f(row):
if len(row['TYPE'])>4 :
rt = row['TYPE'][0:5]
else:
rt = row['TYPE']
return rt
df=pd.DataFrame({'TYPE':('17.21' ,'47.75.1','68.20.2')})
df['TYPE_NEW'] = df.apply(f, axis=1)
TYPE TYPE_NEW
0 17.21 17.21
1 47.75.1 47.75
2 68.20.2 68.20
import json
dataString = """{"data":[{"priceRub": 222}, {"priceRub": 333}]}"""
# преобразуем в python-объект
dataJson = json.loads(dataString)
# обходим list
for i in dataJson['data']:
# получаем нужные поля
print(i['priceRub'])