@@ -1568,8 +1568,7 @@ class of the csv module. For this, you have to specify ``sep=None``.
1568
1568
.. ipython :: python
1569
1569
1570
1570
df = pd.DataFrame(np.random.randn(10 , 4 ))
1571
- df.to_csv(" tmp.csv" , sep = " |" )
1572
- df.to_csv(" tmp2.csv" , sep = " :" )
1571
+ df.to_csv(" tmp2.csv" , sep = " :" , index = False )
1573
1572
pd.read_csv(" tmp2.csv" , sep = None , engine = " python" )
1574
1573
1575
1574
.. ipython :: python
@@ -1597,8 +1596,8 @@ rather than reading the entire file into memory, such as the following:
1597
1596
.. ipython :: python
1598
1597
1599
1598
df = pd.DataFrame(np.random.randn(10 , 4 ))
1600
- df.to_csv(" tmp.csv" , sep = " | " )
1601
- table = pd.read_csv(" tmp.csv" , sep = " | " )
1599
+ df.to_csv(" tmp.csv" , index = False )
1600
+ table = pd.read_csv(" tmp.csv" )
1602
1601
table
1603
1602
1604
1603
@@ -1607,8 +1606,8 @@ value will be an iterable object of type ``TextFileReader``:
1607
1606
1608
1607
.. ipython :: python
1609
1608
1610
- with pd.read_csv(" tmp.csv" , sep = " | " , chunksize = 4 ) as reader:
1611
- reader
1609
+ with pd.read_csv(" tmp.csv" , chunksize = 4 ) as reader:
1610
+ print ( reader)
1612
1611
for chunk in reader:
1613
1612
print (chunk)
1614
1613
@@ -1620,8 +1619,8 @@ Specifying ``iterator=True`` will also return the ``TextFileReader`` object:
1620
1619
1621
1620
.. ipython :: python
1622
1621
1623
- with pd.read_csv(" tmp.csv" , sep = " | " , iterator = True ) as reader:
1624
- reader.get_chunk(5 )
1622
+ with pd.read_csv(" tmp.csv" , iterator = True ) as reader:
1623
+ print ( reader.get_chunk(5 ) )
1625
1624
1626
1625
.. ipython :: python
1627
1626
:suppress:
0 commit comments