'Read Plain Text Document in pandas, only one column
how can I FIX this, thank you
Solution 1:[1]
You have to specify that your csv file seperator is whitespace.
To do so you have to add sep='\s+' as this says that the seperator in the file is one or more spaces (Regex expression).
The better way
You have to specify delim_whitespace=True as parametes as it is faster that regex I shown you above.
So your code should be like:
pd.read_csv("beer_drug_1687_1739.txt", header=None, delim_whitespace=True)
And also I see that your first row has the names of your columns. So you have to change header=None to header=[0] to get the names of your columns.
If you have any questions feel free to ask.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hadi Hajihosseini |
