'How to extract the delimiter in large csv file from s3 through pandas
How to extract the delimiter in large csv file from s3 through python pandas.
Input data -
id|name|age|address
Output result -
|
Code tried:
from detect_delimiter import detect
s3 = session.client('s3')
file = s3.get_object(Bucket="test", Key="input/csvfolder/test_123456789.csv")
csv_string = file["Body"].read()
df = pd.read_csv(io.BytesIO(csv_string),sep=",",encoding="cp1252",chunksize=1)
print(detect(df))
Error :
AttributeError: 'TextFileReader' object has no attribute 'splitlines'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
