Try this:
from io import StringIO
csvtext = StringIO("""1 1 1 1 1
2
3 4 4 4 4""")
data = pd.read_csv(csvtext, sep='\n', header=None)
data.to_csv('out.csv', index=False, header=False)
#on windows
!type out.csv
Output:
1 1 1 1 1
2
3 4 4 4 4
More Related Contents:
- Remap values in pandas column with a dict, preserve NaNs
- Conditional Replace Pandas
- Convert pandas dataframe to NumPy array
- Append existing excel sheet with new dataframe using python pandas
- Find the column name which has the maximum value for each row
- Import CSV file as a pandas DataFrame
- Get a list from Pandas DataFrame column headers
- How to drop a list of rows from Pandas dataframe?
- How to convert string to datetime format in pandas python?
- FutureWarning: elementwise comparison failed; returning scalar, but in the future will perform elementwise comparison
- Python: Convert timedelta to int in a dataframe
- How to insert pandas dataframe via mysqldb into database?
- Pandas make new column from string slice of another column
- Update a dataframe in pandas while iterating row by row
- Conditionally format Python pandas cell
- Selecting columns from pandas MultiIndex
- How to concatenate multiple column values into a single column in Pandas dataframe
- Python Pandas write to sql with NaN values
- Pandas style function to highlight specific columns
- pandas.io.json.json_normalize with very nested json
- Python pandas convert datetime to timestamp effectively through dt accessor
- Checking if particular value (in cell) is NaN in pandas DataFrame not working using ix or iloc
- Time Series Analysis – unevenly spaced measures – pandas + statsmodels
- Move column by name to front of table in pandas
- matplotlib savefig() size control
- Is there a way to speed up handling large CSVs and dataframes in python?
- pandas convert from datetime to integer timestamp
- mean from pandas and numpy differ
- Replace NaN with empty list in a pandas dataframe
- When is it appropriate to use df.value_counts() vs df.groupby(‘…’).count()?