Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14040

pandas: how to read html and casting all fields to string

$
0
0

If I import this HTML file

pd_df = pd.read_html('./output.html')pd_df[0]

the last field becomes a float, but it's a string (in example from 05269 to 5269.0). I know I can apply pd_df = pd.read_html('./output.html',converters={'CAP': str}), but my question is: is there a way to apply globally str casting to all fields, using read_html?

Because this is an example file, this is a simple example, but often I have a lot of fields and a global option would be great.


Viewing all articles
Browse latest Browse all 14040

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>