[issue40437] add string.snake function
Rémi Lapeyre
report at bugs.python.org
Wed Apr 29 15:37:39 EDT 2020
Rémi Lapeyre <remi.lapeyre at henki.fr> added the comment:
I don't understand the motivation, why would it be very useful when working with titles of columns that are to be used in databases columns?
Databases can handle columns with spaces in their name:
postgres=# create temporary table foo ("column with spaces" text);
CREATE TABLE
Time: 29,973 ms
postgres=# insert into foo values ('bar');
INSERT 0 1
Time: 0,746 ms
postgres=# select * from foo;
column with spaces
--------------------
bar
(1 row)
Time: 3,452 ms
There is also various library available to do this on Pypi like https://github.com/okunishinishi/python-stringcase and https://github.com/jpvanhal/inflection. I'm pretty sure I used inflection at one company and it worked great.
Finally, the issue on the Pandas repository says how to do it: you can use Series.apply.
----------
nosy: +remi.lapeyre
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40437>
_______________________________________
More information about the Python-bugs-list
mailing list