You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To read an array from a sheet of an Excel file, you can use the ``read_excel`` function:
@@ -65,7 +61,6 @@ cells:
65
61
births = read_excel(filepath_excel, 'births')
66
62
births
67
63
68
-
id: 4
69
64
70
65
- markdown: |
71
66
The ``open_excel`` function in combination with the ``load`` method allows you to load several arrays from the same Workbook without opening and closing it several times:
The ``open_excel`` function in combination with the ``dump()`` method allows you to open a Workbook and to export several arrays at once. If the Excel file doesn't exist, the ``overwrite_file`` argument must be set to True.
@@ -180,14 +170,13 @@ cells:
180
170
181
171
182
172
- markdown: |
183
-
To write an array in an HDF5 file, you must use the ``read_hdf`` function and provide the key that will be associated with the array:
173
+
To write an array in an HDF5 file, you must use the ``to_hdf`` function and provide the key that will be associated with the array:
184
174
185
175
186
176
- code: |
187
177
# save the array pop in the file 'population.h5' and associate it with the key 'pop'
By default, writing functions will set the name of the column containing the data to 'value'. You can choose the name of this column by using the ``value_name`` argument. For example, using ``value_name='population'`` you can export the previous array as:
These metadata are automatically saved and loaded when working with the HDF5 file format:
@@ -574,7 +549,6 @@ cells:
574
549
new_pop = read_hdf('population.h5', 'pop')
575
550
new_pop.info
576
551
577
-
id: 25
578
552
579
553
- markdown: |
580
554
<div class="alert alert-warning">
@@ -615,7 +589,6 @@ cells:
615
589
616
590
print(session.summary())
617
591
618
-
id: 26
619
592
620
593
- markdown: |
621
594
2) Call the ``load`` method on an existing session and pass the path to the Excel/HDF5 file or to the directory containing CSV files as first argument:
@@ -628,7 +601,6 @@ cells:
628
601
629
602
print(session.summary())
630
603
631
-
id: 27
632
604
633
605
- code: |
634
606
# call the load method on the previous session and add the 'births' and 'deaths' arrays to it
@@ -637,7 +609,6 @@ cells:
637
609
638
610
print(session.summary())
639
611
640
-
id: 28
641
612
642
613
- markdown: |
643
614
The ``load`` method offers some options:
@@ -653,7 +624,6 @@ cells:
653
624
654
625
print(session.summary())
655
626
656
-
id: 29
657
627
658
628
- markdown: |
659
629
2) Setting the ``display`` argument to True, the ``load`` method will print a message each time a new item is loaded:
@@ -666,7 +636,6 @@ cells:
666
636
# each time a new item is loaded
667
637
session.load(filepath_hdf, display=True)
668
638
669
-
id: 30
670
639
671
640
- markdown: |
672
641
### Dumping Sessions (CSV, Excel, HDF5)
@@ -688,15 +657,14 @@ cells:
688
657
# load session saved in 'population.h5' to see its content
689
658
Session('population.h5')
690
659
691
-
id: 31
692
660
693
661
- markdown: |
694
662
<div class="alert alert-info">
695
-
**Note:** Concerning the CSV and Excel formats:
663
+
Note: Concerning the CSV and Excel formats:
696
664
697
-
- all Axis objects are saved together in the same Excel sheet (CSV file) named __axes__(.csv)
698
-
- all Group objects are saved together in the same Excel sheet (CSV file) named __groups__(.csv)
699
-
- metadata is saved in one Excel sheet (CSV file) named __metadata__(.csv)
665
+
- all Axis objects are saved together in the same Excel sheet (CSV file) named `__axes__(.csv)`
666
+
- all Group objects are saved together in the same Excel sheet (CSV file) named `__groups__(.csv)`
667
+
- metadata is saved in one Excel sheet (CSV file) named `__metadata__(.csv)`
700
668
701
669
These sheet (CSV file) names cannot be changed.
702
670
</div>
@@ -715,7 +683,6 @@ cells:
715
683
# load session saved in 'population.h5' to see its content
716
684
Session('population.h5')
717
685
718
-
id: 32
719
686
720
687
- markdown: |
721
688
2) By default, dumping a session to an Excel or HDF5 file will overwrite it. By setting the ``overwrite`` argument to False, you can choose to update the existing Excel or HDF5 file:
@@ -733,7 +700,6 @@ cells:
733
700
# load session saved in 'population.h5' to see its content
734
701
Session('population.h5')
735
702
736
-
id: 33
737
703
738
704
- markdown: |
739
705
3) Setting the ``display`` argument to True, the ``save`` method will print a message each time an item is dumped:
@@ -744,7 +710,6 @@ cells:
744
710
# each time an item is dumped
745
711
session.save('population.h5', display=True)
746
712
747
-
id: 34
748
713
749
714
# The lines below here may be deleted if you do not need them.
0 commit comments