current position：Home>06python learning notes - reading external text data
06python learning notes - reading external text data
2022-02-01 09:40:54 【User 4576177752001】
「 This is my participation 11 The fourth of the yuegengwen challenge 6 God , Check out the activity details ：2021 One last more challenge 」.
If needed Python Read txt or csv Formatted data , have access to pandas Module read_table Function or read_csv function . there “ or ” It does not mean that each function intelligently reads data in one format , Second, these two types of Kazakhstan numbers can read the data of text files . Because these two functions are similar in function and parameter use , Therefore, the royal guards here read_table Function as an example , Introduce the usage of this function and the meaning of several important parameters .
filepath_or_buffer: Appoint txt File or csv The specific path of the file .
sep: Specifies the separator between fields in the original dataset , The default is Tab tabs .
header: Whether to use the first row in the original dataset as the header , The first row is used as the field name by default .
names: If there are no fields in the original dataset , You can add a specific header to the data frame when reading data by changing parameters . index_col: Specify some columns in the original dataset as the index of the data frame （ label ）.
usecols: Specify which metadata in the set needs to be read .
dtype： When reading data , You can set different data types for each field of the original dataset .
converters: In dictionary format , Set conversion functions for some fields in the dataset .
skiprows: When reading data , Specify the number of rows that need to skip the beginning of the original dataset .
skipfooter: When reading data , Specify the number of rows that need to skip the end of the original dataset .
nrows： Specify the number of rows to read data .
na_values: Specify which feature values in the original dataset are missing values .
skip_blank_lines: Whether to skip the blank line in the original data set when reading data , The default is True.
parse_dates: If the parameter value is True, Then try to parse the row index of the data frame ; If the parameter is a list, try to parse the corresponding date column ; If the parameter is a nested list , Then merge some columns into date Columns ; If the parameter is Dictionary , Then the corresponding column （ The value in the dictionary ）, And generate a new field name （ The key in the dictionary ）.
thousands: Specifies the millennial character in the original dataset .
comment： Specifies the annotator , While reading the data , If you encounter the annotation specified at the beginning of the line , Then skip this line .
encoding: If there is Chinese in the document , Sometimes you need to specify character encoding .
author[User 4576177752001],Please bring the original link to reprint, thank you.
The sidebar is recommended
- Python * * packaging and unpacking details
- Python realizes weather query function
- Python from 0 to 1 (day 12) - Python data application 2 (STR function)
- Python from 0 to 1 (day 13) - Python data application 3
- Numpy common operations of Python data analysis series Chapter 8
- How to implement mockserver [Python version]
- Van * Python! Write an article and publish the script on multiple platforms
- Python data analysis - file reading
- Python data De duplication and missing value processing
- Python office automation - play with browser
guess what you like
Python series tutorial 127 -- Reference vs copy
Control flow in Python: break and continue
Teach you how to extract tables in PDF with Python
leetcode 889. Construct Binary Tree from Preorder and Postorder Traversal（python）
leetcode 1338. Reduce Array Size to The Half（python）
Object oriented and exception handling in Python
How to configure load balancing for Django service
How to embed Python in go
Python Matplotlib drawing graphics
Python object-oriented programming 05: concluding summary of classes and objects
- Python from 0 to 1 (day 14) - Python conditional judgment 1
- Several very interesting modules in Python
- How IOS developers learn Python Programming 15 - object oriented programming 1
- Daily python, Chapter 20, exception handling
- Understand the basis of Python collaboration in a few minutes
- [centos7] how to install and use Python under Linux
- leetcode 1130. Minimum Cost Tree From Leaf Values（python）
- leetcode 1433. Check If a String Can Break Another String（python）
- Python Matplotlib drawing 3D graphics
- Talk about deep and shallow copying in Python
- Python crawler series - network requests
- Python thread 01 understanding thread
- Analysis of earthquake distribution in the past 10 years with Python~
- You need to master these before learning Python crawlers
- After the old friend (R & D post) was laid off, I wanted to join the snack bar. I collected some data in Python. It's more or less a intention
- Python uses redis
- Python crawler - ETF fund acquisition
- Detailed tutorial on Python operation Tencent object storage (COS)
- [Python] comparison of list, tuple, array and bidirectional queue methods
- Go Python 3 usage and pit Prevention Guide
- Python logging log error and exception exception callback method
- Learn Python quickly and take a shortcut~
- Python from 0 to 1 (day 15) - Python conditional judgment 2
- Python crawler actual combat, requests module, python to capture headlines and take beautiful pictures
- The whole activity collected 8 proxy IP sites to pave the way for the python proxy pool, and the 15th of 120 crawlers
- Why can't list be used as dictionary key value in Python
- Python from 0 to 1 (day 16) - Python conditional judgment 3
- What is the python programming language?
- Python crawler reverse webpack, a real estate management platform login password parameter encryption logic
- Python crawler reverse, a college entrance examination volunteer filling platform encrypts the parameter signsafe and decrypts the returned results
- Python simulated Login, selenium module, python identification graphic verification code to realize automatic login
- Python -- datetime (timedelta class)
- Python's five strange skills will bring you a sense of enrichment in mastering efficient programming skills
- [Python] comparison of dictionary dict, defaultdict and orderdict
- Test driven development using Django
- Face recognition practice: face recognition using Python opencv and deep learning
- leetcode 1610. Maximum Number of Visible Points（python）
- Python thread 03 thread synchronization
- Introduction and internal principles of Python's widely used concurrent processing Library Futures
- Python - progress bar artifact tqdm usage