-1

I am trying to download a web file with this link in pandas. The issue that I am having is that most tutorials show a file that can be downloaded with a particular extension on the end, which allows for you to more easily directly download it.

This link results in the download of a text file, but it cannot be easily read with conventional methods. How can I download this file directly in pandas with this link.

Nazim Kerimbekov
  • 4,497
  • 8
  • 31
  • 54

2 Answers2

2

Data Science Acolyte, all you have to do is this!

import pandas as pd
df = pd.read_csv('ADAMS.txt')

you can try:

df = pd.read_csv('https://www6.sos.state.oh.us/ords/f?p=VOTERFTP:DOWNLOAD::FILE:NO:2:P2_PRODUCT_NUMBER:1')
oppressionslayer
  • 6,570
  • 2
  • 5
  • 21
0

Please try this code below if it works for you:

import pandas as pd
import io
import requests

url="https://www6.sos.state.oh.us/ords/f?p=VOTERFTP:DOWNLOAD::FILE:NO:2:P2_PRODUCT_NUMBER:1"
s=requests.get(url).content
c=pd.read_csv(io.StringIO(s.decode('utf-8')))

More details here.

Nazim Kerimbekov
  • 4,497
  • 8
  • 31
  • 54
mamtach
  • 78
  • 3
  • 10