We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 620c0ab commit bcef60eCopy full SHA for bcef60e
pandas/tests/io/test_sql.py
@@ -857,6 +857,25 @@ def test_multiindex_roundtrip(self):
857
)
858
tm.assert_frame_equal(df, result, check_index_type=True)
859
860
+ @pytest.mark.parametrize(
861
+ "dtype, expected",
862
+ [
863
+ (None, [float, float]),
864
+ (int, [int, int]),
865
+ (float, [float, float]),
866
+ ({"SepalLength": int, "SepalWidth": float}, [int, float]),
867
+ ],
868
+ )
869
+ def test_dtype_argument(self, dtype, expected):
870
+ # GH10285 Add dtype argument to read_sql_query
871
+ result = sql.read_sql_query(
872
+ "SELECT SepalLength, SepalWidth FROM iris", self.conn, dtype=dtype
873
874
+ assert result.dtypes.to_dict() == {
875
+ "SepalLength": expected[0],
876
+ "SepalWidth": expected[1],
877
+ }
878
+
879
def test_integer_col_names(self):
880
df = DataFrame([[1, 2], [3, 4]], columns=[0, 1])
881
sql.to_sql(df, "test_frame_integer_col_names", self.conn, if_exists="replace")
0 commit comments