> For the complete documentation index, see [llms.txt](https://visual-python.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://visual-python.gitbook.io/docs/data-analysis/2.-file.md).

# 2. File

Read or Write a File

<figure><img src="https://2909106259-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl07NBXgl5MbkBetObqPW%2Fuploads%2F1vP1oD6ziUTkSwhepbxK%2Fimage.png?alt=media&amp;token=e7ee483c-3932-4021-8c32-b96fd631946f" alt="" width="307"><figcaption></figcaption></figure>

1. In the ***Data Analysis*** category, click ***File**.*

<figure><img src="https://2909106259-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl07NBXgl5MbkBetObqPW%2Fuploads%2FtHjO1InEfMnp1Wj8YcyE%2Fimage.png?alt=media&amp;token=067eb2f1-d093-43f9-bf25-89d8c328f837" alt="" width="425"><figcaption></figcaption></figure>

2. Select the type of action ***Read File*** / ***Write File***
   1. ***Sample Data*** brings up sample data provided by Visual Python.

### Read File

<figure><img src="https://2909106259-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl07NBXgl5MbkBetObqPW%2Fuploads%2F4YkROWUVsNeE9Md4r4do%2Fimage.png?alt=media&amp;token=3dde1922-c228-47c2-a710-cc12bd8ee11c" alt="" width="437"><figcaption></figcaption></figure>

1. ***File Type***: Select the type of file you want to import.
2. ***File Path***: The file-shaped icon lets you find the location of the file to load.
3. ***Allocate to***: Give the file a variable name.

* ***Additional Options***: Allows you to set additional option values. If not set, the default values set in Visual Python are applied. Options not listed here can be applied by entering them directly *in **User Option**.*

1. ***Encoding***: Select the type of encoding.
2. ***Header***: By default, the first row is used as the column name. If you don't want this, select '***None**'.*
3. ***Separator***: Choose a separator to separate the data fields in the file.
4. ***Columns***: Set the column names to a pre-made list or specific values.
5. ***Column List to Use***: Allows you to import only specific columns within the file.
6. ***Column to Use as Index***: Specify which column in the data should be used as the index.
7. ***Na Values***: Replace missing values with the values you entered.
8. ***Rows to Skip***: Skips and fetches as many rows as the value entered at the top of the file.
9. ***Number of Rows***: Fetches as many rows as the entered value from the top of the file.
10. ***Chunksize***: Reads the file in *chunks,* divided by the entered value. Use this when loading large files.

### Write File

<figure><img src="https://2909106259-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl07NBXgl5MbkBetObqPW%2Fuploads%2FAFX0LmS9i5eYqe01z3ul%2Fimage.png?alt=media&amp;token=afbfff7b-4b00-4485-b5f1-e0df72d6e194" alt="" width="515"><figcaption></figcaption></figure>

1. ***File Type***: Set the file type you want to save.
2. ***DataFrame***: Select the dataframe you want to save.
3. ***File Path***: Set the location where you want to save the file.

* ***Additional Options***: Allows you to set additional option values. If not set, the default values set in Visual Python are applied. Options not listed here can be applied by entering them directly *in **User Option**.*

1. ***Encoding***: Select the type of encoding.
2. ***Header***: Select '***False***' if you do not want the column names to be included in the file that will be saved.
3. ***Index***: Select *'***False***'* if you don't want an index to be included.
4. ***Separator***: Choose a separator to separate the data fields in the file.
5. ***Na Replacing Value***: Replaces the missing value with the value you entered.
6. ***Columns***: Select specific columns to save.
