Live and recent posts from across the Fediverse tagged #pandas, aggregated by home.social.
#pandas
In #Python #Pandas 3.1, reading CSV is multi-threaded, using up to 6 by default.
You can change it temporarily with mode.max_threads:
with pd.option_context('mode.max_threads', 10): df = pd.read_csv('bigfile.csv')
Note: More threads aren't always faster!
Want to set an option in #Python #Pandas, but just temporarily? You can use option_context:
with pd.option_context('display.precision', 2): print(s/3)
Within the "with" block, the display precision is 2. But outside -- before or after -- it is the default.
There are tons of config options in #Python #Pandas. Set them with pd.set_option:
pd.set_option('display.precision', 2)
Now floats in a series or data frame will have 2 digits after the decimal.
Retrieve the value with "get_option":
pd.get_option('display.precision')
Enter the server where you have an account.
Please enter a valid server hostname.