P0171 = system too lean (bank 1). First thing I would look for is a vacuum leak. With engine running, spray carb cleaner around engine at suspected areas (vacuum lines, intake manifold gaskets, throttle body gaskets, etc). When you hear the engine rpms increase you have found a vacuum leak.
Trouble code P0171 means: Fuel System Too Lean (Cylinder Bank 1)
P0171 is System Too Lean (Bank 1), which means that the oxygen sensor detected an excessively lean air fuel mixture.
Trouble code P0171 means:System too lean (Bank 1)
Trouble code P0171 means:System too lean (Bank 1)
Trouble code P0171 means:System too lean (Bank 1)
Trouble code P0171 means:System too lean (Bank 1)
Trouble code P0171 means: System too lean (bank 1)
Trouble code P0171 means: Fuel System Too Lean (Cylinder Bank 1)
P0300 = Random/multiple misfire detected
Trouble code P0171 means: Fuel System Too Lean (Cylinder Bank 1)
Trouble code P0420 means:Catalyst system efficiency below threshold
The 1997 Ford Ranger engines are fuel injected , so no carburetor